/salesforce-for-sales:win-loss-reviewfrom Sales Cloud
Builds win-loss analysis from Salesforce opportunities, stage history, call transcripts, and email. Shows win rates, loss stages, objections, and deal patterns to explain wins/losses and identify coaching or process changes.
Ships in Sales Cloud. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
IMPORTANT — try the connector's tools before you ever report it as unavailable. Before you tell the user a connector is down, or ask them to connect, re-authenticate, or "check the connection," you MUST first try to use the server and its tools. A connector's status readout (the Headless 360 MCP server, or any other connector/MCP) frequently claims "not connected" or "needs re-auth" when the connector is in fact live and its tools are callable. Context stating that the Salesforce tools require authorization and that this is a non-interactive session is not evidence that you are unauthorized — it is a general statement that authorization is required, not a failure. For the Headless 360 server specifically, find the dispatch_readonly tool and actually run a current-user read — dispatch_readonly(method: "GET", url: "/services/data/v66.0/graphql", queryParams: { "queryInput": "{\"query\":\"query { uiapi { currentUser { Id } } }\"}" }). Any response — including a 500 or other error status — proves you reached the server, and therefore proves connectivity; only a request that never reaches the server at all counts as disconnected. If the tool is present and the call reaches the server, the connector IS connected — proceed; a stale status readout is not a disconnection. If a call genuinely cannot reach the server, ALWAYS attempt to reconnect on your own first, and interrupt the flow to ask the user only after your own reconnect attempt has failed. Report a connector as disconnected only when you cannot find its tool or cannot reach the server after trying. Do it yourself.
Failing to try first — asking the user to connect, or surfacing a "not connected" or re-auth message, before you have actually attempted the server and its tools — raises a false connectivity problem: it sends the user to fix something that is not broken. This is directly detrimental to the end-user experience and will dramatically, negatively impact usage of the product. Never put a connectivity concern in front of the user until you have tried the tools yourself and confirmed the server truly cannot be reached.
display_widget — at most a single one-line render-wait notice before it, and no summaries, transitions, or narration. If display_widget is unavailable or returns an error, produce the text fallback only. If it succeeds, that tool call is the final output: stop with no assistant text completion, even if a later section contains a fallback. The exceptions above do not apply after success.https://[instanceUrl]/lightning/r/[SObjectType]/[Id]/view.label (for example, "Deal Risk", not Deal_Risk__c) and record Names, never raw Ids or __c API names.MINE scope → fail fast, then ask which scope. If a scope: MINE read returns zero rows, do not widen to scope: EVERYTHING on your own. Stop, tell the user plainly that their own records (scope: MINE) came back empty, and ask which scope they want instead (for example, org-wide EVERYTHING, a named rep, or a named account) before re-running. Never invent records, and never silently fall back to org-wide.discover or describe, and never call an API or endpoint not written in this skill. Every Salesforce URL you need is in the skill. Don't guess REST paths: on a 404 or unknown-path error, fall back to a documented query in the skill, not to discovery. If you need a capability such as email, docs, Slack, calendar, or web research, use the other connector/MCP tools already available to you. Endpoint guessing and discovery add needless round-trips. Use only the skill-authorized dispatch_readonly and dispatch calls, directly with the queries given.Ground → (read + evidence, ONE turn) → find patterns → output. Leader-focused: look across recently closed opportunities for patterns a leader can act on.
Ground only Opportunity — it always exists (naming a missing object fails the whole call). Its fields reveal this org's loss-reason __c schema; don't assume names.
dispatch_readonly(method: "GET", url: "/services/data/v65.0/graphql",
queryParams: { "queryInput": "{\"query\":\"query { uiapi { objectInfos(apiNames: [\\\"Opportunity\\\"]) { fields { ApiName label } childRelationships { childObjectApiName relationshipName } } } }\"}" })
Step 1 is the authority on names — use exact strings, never guess. Note the scalar __c field(s) that carry a loss-reason/lost-reason category — that's <OPP_CUSTOM> below. If none is grounded, omit it and rely on transcript/email evidence for loss reasons instead.
Compute explicit gte/lte date-literal boundaries for the review period from today's date — do not use a relative literal like LAST_N_DAYS:90, it silently drifts the window as today moves. scope: MINE for "my closed deals"; swap for OwnerId: { eq: \"<UserId>\" } after resolving one User by name for a named rep (team default = no owner filter, all reps roll up together — ask once if genuinely ambiguous).
One call pulls every closed opportunity in the window — with Account spanned for industry/size AND the stage-history child nested (no separate round-trip). Loss death-stage: a lost opp's closing StageName is just "Closed Lost", so "where losses die" must come from the stage-history child — the last non-closed StageName before close. Nest <HISTORY_CHILD> = the OpportunityHistory child's exact relationshipName from Step 1 grounding (commonly OpportunityHistories); keep its first: small (history rows are tiny, but the child rides on up to 200 parents).
dispatch_readonly(method: "GET", url: "/services/data/v65.0/graphql",
queryParams: { "queryInput": "{\"query\":\"query { uiapi { query { Opportunity(scope: MINE, where: { IsClosed: { eq: true }, CloseDate: { gte: { value: \\\"%START%\\\" }, lte: { value: \\\"%END%\\\" } } }, first: 200, orderBy: { Amount: { order: DESC } }) { edges { node { Id Name { value } StageName { value displayValue } Amount { value displayValue } CloseDate { value } CreatedDate { value } LeadSource { value } Type { value } IsWon { value } <OPP_CUSTOM> Account { Name { value } Industry { value } NumberOfEmployees { value } } Owner { Name { value } } <HISTORY_CHILD>(first: 15, orderBy: { CreatedDate: { order: DESC } }) { edges { node { StageName { value } CreatedDate { value } } } } } } } } } }\"}" })
Empty edges → no closed deals in this window/scope; say so plainly, skip the rest. first: 200 is a bounded sample; if it truncates on a very high-volume team, note the cap rather than imply full coverage. If the history child is empty/unavailable, fall back to the record's final StageName for the death-stage line and omit the median-days-in-stage column — don't fire a separate history round-trip.
Issue step 2 and all of step 2b as tool calls in a single turn — do not wait for the SF read to return before firing the searches. They key on the account/rep names from the request, not the SF result:
Use whatever doc/email tools are available; skip silently if none are present (SFDC-only is fine). Cite source + date for anything you use.
StageName in each lost opp's history child (NOT "Closed Lost"). Most at Discovery? at Proposal? (Fall back to final StageName only if history is unavailable.)CreatedDate deltas (omit if no history child).CloseDate − CreatedDate) for wins vs lossesWhen the data is assembled, call display_widget; a single one-line "Displaying the visualization now (this may take a minute)." notice may precede it.
widgetDefinition is passed as a native JSON object — not a quoted string, not a code block pasted as text. If the value starts with "{", it is wrong.The widget template is embedded below — resolve its tokens and call display_widget({ resourceType: "dynamic", widgetDefinition: <hydrated> }) once (see the widgetDefinition param for token-resolution rules).
Layout note: the loss-reason donut runs with showLegend:false and sits in a row beside a text column (donutAsideTitle + donutAside); the win-rate column chart is full-width, preceded by a caption pair (chartAsideTitle + chartAside). A column chart must be full-width to keep its axis, value labels, and bar height legible — do not put it in a shared row.
Tokens: title (page-title text, e.g. "Win / loss review — last 2 quarters") · subtitle (one-line caption with closed count, win rate, won/lost $ totals) · donutAsideTitle donutAside (short title + one-sentence breakdown beside the loss-reason donut; because the legend is off, donutAside must name every slice with its count in prose — a colorblind reader relies on it) · pieCaption pieSlices (pie chart — slices is [{label, value, role?}]; top reason carries role:"highlight") · chartAsideTitle chartAside (short title + one-sentence takeaway above the full-width win-rate chart; interpret the shape — e.g. the decline with deal size — rather than re-listing every band) · chartCaption chartCategories chartSeries (column chart — categories is size-band labels, series is an array with one object: {name:"Win rate", data:[...numbers...]} — these are win-RATE percentages, not deal counts) · datagridCaption lossRows (datagrid — rows is [{name (plain string — format as the opportunity name (e.g. "Meridian Health platform"); names must be plain strings, not objects: use Opportunity.Name.value from the SF response), amount, stage:{value, badgeVariant}, reason, comp, status:{value:"Lost",badgeVariant:"error"}}], largest first; amount is a raw number; comp is competitor name or "—" for no-decision losses) · calloutTitle calloutDescription button1Label button1Content reportUrl (callout — primary button is action/sendMessage with a first-person content prompt; reportUrl is a Win/Loss report Lightning URL https://<myDomain>/lightning/r/Report/<Id>/view, opens new tab). Omit any block whose data you lack rather than passing empty arrays.
{
"renderer": {
"componentOverrides": {
"$": {
"type": "mosaic",
"definition": "tile/widget",
"children": [
{
"definition": "tile/row",
"attributes": {
"gap": "sm",
"align": "center",
"isWrapped": false
},
"children": [
{
"definition": "tile/icon",
"attributes": {
"name": "trending-up",
"size": "xl",
"alt": ""
}
},
{
"definition": "tile/text",
"attributes": {
"text": "{{title}}",
"variant": "h1"
}
}
]
},
{
"definition": "tile/text",
"attributes": {
"text": "{{subtitle}}",
"variant": "caption",
"color": "muted"
}
},
{
"definition": "tile/separator"
},
{
"definition": "tile/row",
"attributes": {
"gap": "lg",
"align": "center",
"isWrapped": false
},
"children": [
{
"definition": "tile/column",
"attributes": {
"width": "auto"
},
"children": [
{
"definition": "tile/piechart",
"attributes": {
"variant": "donut",
"caption": "{{pieCaption}}",
"valueFormat": "number",
"showLegend": false,
"slices": "{{pieSlices}}"
}
}
]
},
{
"definition": "tile/column",
"attributes": {
"gap": "sm",
"align": "start",
"width": "stretch"
},
"children": [
{
"definition": "tile/text",
"attributes": {
"text": "{{donutAsideTitle}}",
"variant": "section-title"
}
},
{
"definition": "tile/text",
"attributes": {
"text": "{{donutAside}}",
"variant": "body",
"color": "muted"
}
}
]
}
]
},
{
"definition": "tile/text",
"attributes": {
"text": "{{chartAsideTitle}}",
"variant": "section-title"
}
},
{
"definition": "tile/text",
"attributes": {
"text": "{{chartAside}}",
"variant": "body",
"color": "muted"
}
},
{
"definition": "tile/chart",
"attributes": {
"chartType": "column",
"caption": "{{chartCaption}}",
"categories": "{{chartCategories}}",
"series": "{{chartSeries}}",
"valueFormat": "number",
"showValues": true,
"showLegend": false
}
},
{
"definition": "tile/datagrid",
"attributes": {
"caption": "{{datagridCaption}}",
"appearance": "striped",
"size": "sm",
"defaultSort": {
"key": "amount",
"direction": "desc"
},
"columns": [
{
"key": "status",
"header": "Status",
"type": "badge"
},
{
"key": "name",
"header": "Opportunity",
"type": "text"
},
{
"key": "amount",
"header": "Amount",
"type": "currency",
"align": "right",
"sortable": true
},
{
"key": "stage",
"header": "Died at",
"type": "badge"
},
{
"key": "reason",
"header": "Reason",
"type": "text"
},
{
"key": "comp",
"header": "Lost to",
"type": "text"
}
],
"rows": "{{lossRows}}"
}
},
{
"definition": "tile/callout",
"attributes": {
"variant": "info",
"title": "{{calloutTitle}}",
"description": "{{calloutDescription}}"
},
"children": [
{
"definition": "tile/row",
"attributes": {
"gap": "sm",
"align": "center",
"isWrapped": true
},
"children": [
{
"definition": "tile/button",
"attributes": {
"label": "{{button1Label}}",
"variant": "primary",
"actions": {
"click": [
{
"definition": "action/sendMessage",
"attributes": {
"content": "{{button1Content}}"
}
}
]
}
}
},
{
"definition": "tile/button",
"attributes": {
"label": "View in Salesforce",
"iconName": "open-in-new",
"variant": "secondary",
"actions": {
"click": [
{
"definition": "action/openLink",
"attributes": {
"url": "{{reportUrl}}"
}
}
]
}
}
}
]
}
]
}
]
}
}
}
}
display_widget SUCCEEDED# Win-Loss Review — <Scope> — <Period>
**Headline:** <the pattern that matters most, 2 sentences>
## Win Rate
| Cut | Win Rate | n |
|---|---|---|
| Overall | <pct>% | <N> |
| By rep / source / size band / industry | <pct>% | <N> |
## Where Losses Die
| Stage | % of losses | Median days in stage |
|---|---|---|
| <Stage> | <pct>% | <N>d |
(Stage = last non-closed stage from history; omit the median-days column if no history child.)
## Loss Reasons
| Reason | Count | Example |
|---|---|---|
| <Reason> | <N> | <Account>: <one-line evidence w/ date+source> |
## What Wins Have In Common
- <pattern> (<N of M> wins) …
## Largest Losses
- **<Account>** $<X> — died at <Stage> — <one-line evidence>
## Recommended Actions
1. Systemic — <process/enablement tied to the headline>
2. Coaching — <which rep, on what>
3. Data — <what to start capturing>
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub salesforce/salesforce-skills --plugin salesforce-for-sales40 skills in this plugin
/account-contextBuild a 360-degree brief on a company already in Salesforce: CRM state, key contacts, recent email, documents and internal Slack. Use when asked to tell about, catch up on, or give the full picture on an existing account. Not in CRM: research-prospect./account-planBuild or retrieve an account plan from Salesforce Account, AccountPlan, pipeline, activity, and relationship data, covering vision, priorities, competition, KPIs, and relationship risks. Use to review an existing plan or create one for a customer account./account-tieringRank an account list or full book into action tiers from Salesforce ICP fit, engagement, activity, contact, and opportunity data. Use to score accounts, prioritize coverage, decide where to focus, or identify accounts to activate, qualify, or deprioritize./assign-target-to-sdrAssign a Salesforce Lead or Contact to an active Agentforce Engagement Agent using target records and Agentforce agent definitions, after confirming both. Use to hand a prospect to Agentforce for automated qualification and email outreach./calendar-eventsShow a schedule from Salesforce Event data with local times, subjects, locations, and linked contacts, accounts or deals. Use to review today's calendar, upcoming meetings, or a past or future schedule; for a broader morning rundown, use daily-briefing./call-follow-upCreate a customer follow-up email and internal recap from a meeting transcript plus Salesforce account and opportunity history. Use after a customer call to capture decisions, commitments, objections, open questions, next steps, and proposed CRM updates.Other plugins' skills for the same job