Skip to content

salesforce

The salesforce plugin integrates Salesforce CLI with Claude Code, providing org authentication and a general-purpose CLI agent that can run any sf command including SOQL queries. It supports headless container environments with JWT, access-token, and SFDX URL authentication flows. The usage guide below demonstrates how to use natural language to query accounts, opportunities, cases, and contacts through the CLI agent.

v1.0.0 Development
/plugin install salesforce@f5xc-salesdemos-marketplace
  • Salesforce CLI (@salesforce/cli)
  • Salesforce org with API access
  • A user account with permissions to query objects (Cases, Opportunities, Accounts, Contacts)

Install the Salesforce CLI on your workstation:

Terminal window
brew install sf

Verify the installation:

Terminal window
sf --version

You should see output like @salesforce/cli/2.x.x.

Look at your Salesforce URL in the browser. If you access Salesforce at https://acme.lightning.force.com, your login domain is https://acme.my.salesforce.com.

Terminal window
sf org login web --alias my-org --set-default --instance-url https://YOUR-DOMAIN.my.salesforce.com

Replace YOUR-DOMAIN with your company domain from Step 1. Your browser opens — complete the SSO or login flow and authorize the app. You should see:

Successfully authorized your-email@company.com with org ID 00DXXXXXXXXXXXXXXX
Terminal window
sf org display --target-org my-org

Confirm the output shows Connected Status: Connected with your username and instance URL.

Step 4: Portable auth for containers (optional)

Section titled “Step 4: Portable auth for containers (optional)”

If you need to authenticate in a headless environment (CI/CD, container, remote session), export the SFDX auth URL from your workstation:

Terminal window
sf org display --verbose --target-org my-org

Copy the Sfdx Auth Url value (starts with force://). In the container, run:

Terminal window
export SFDX_AUTH_URL="force://PlatformCLI::YOUR_AUTH_TOKEN@your-domain.my.salesforce.com"
echo "$SFDX_AUTH_URL" | sf org login sfdx-url --sfdx-url-stdin=- --alias=my-org --set-default
MethodBest ForRequires
Web LoginWorkstations with a browserBrowser + SSO
SFDX URLContainers, CI/CD, portable authAuth URL from an authenticated session
JWT BearerAutomated pipelinesConnected App + private key + consumer key
Access TokenEnvironment variable authSF_ACCESS_TOKEN + SF_ORG_INSTANCE_URL

Note: Device flow (sf org login device) is blocked since August 2025 and is not supported.

VariablePurpose
SF_ACCESS_TOKENBearer token for access-token auth
SFDX_AUTH_URLForce auth URL for SFDX URL auth
SF_ORG_INSTANCE_URLOrg instance URL
SF_JWT_KEY_FILEPath to JWT private key
SF_CLIENT_IDConnected App consumer key
SF_USERNAMESalesforce username for JWT

Check your Salesforce org connection status, CLI version, and authenticated orgs.

/salesforce:sf-status

What to expect: A table showing your sf CLI version, authenticated org alias, username, instance URL, connected status, and API version.

Authenticate to a Salesforce org. Optionally provide an alias.

/salesforce:sf-login
/salesforce:sf-login my-org

What to expect: If an org with that alias is already authenticated, it reports the connection details. If not, it checks for available credentials (environment variables) and authenticates using the first fully satisfied method.

Top-level intent router. Automatically activates when you mention Salesforce, org management, or data queries in natural language.

You sayRoutes to
”login to salesforce”, “authenticate org”salesforce-auth skill
”check org status”, “list orgs”cli-operator agent
”show me opportunities”, “look up case”cli-operator agent (SOQL query)
“generate Apex class”, “create Flow”afv-library development skills

Container-adapted authentication skill. Supports four auth methods and automatically detects which credentials are available. Prioritizes: access-token, then JWT, then SFDX URL, then web login.

Autonomous Salesforce CLI agent that executes sf commands with safety guardrails. All Salesforce operations are delegated to this agent to keep the main session context lean.

Safety rules:

  • Read-only by default — write operations require explicit approval
  • Never deploys without a preview and confirmation step
  • Never echoes access tokens, auth URLs, or credentials in output
  • Sanitizes all user-provided values (rejects shell metacharacters)
  • Uses --json output for structured, parseable results

Response format:

## Result: [SUCCESS | FAILURE | PARTIAL]
### Command Executed
### Output Summary
### Issues

These prompts work with any Salesforce org. Replace the placeholder values with your own information. Each prompt produces results specific to your role, accounts, and territory.

After authenticating, verify everything works:

/salesforce:sf-status

Then try a simple natural language query:

list my authenticated salesforce orgs

What to expect: A table showing all connected orgs with alias, username, instance URL, and connection status.

Discover which accounts you are assigned to:

what salesforce accounts am I on the account team for? My email is your-email@company.com

What to expect: A list of accounts grouped by account owner, showing your team member role on each. If most roles show as empty, that is a common data hygiene gap — the account team memberships exist but roles were not populated.

Compare your account coverage with a teammate to find gaps:

In salesforce, find all accounts where Colleague Name is on the account team. Then for each of those accounts, check if your-email@company.com is also on the account team. Show me two lists: accounts where we are BOTH tagged, and accounts where only my colleague is tagged but I am missing.

What to expect: A summary table showing overlap count and gap count, followed by two lists. If you recently changed roles, you may find zero overlap — this reveals which accounts you need to be added to.

See all open opportunities across your accounts:

show me all open salesforce opportunities on Colleague Name's account team accounts, sorted by close date, include the stage, amount, and probability

What to expect: A summary with total opportunity count, raw pipeline, and weighted pipeline. Then a stage distribution table and a list of top opportunities by amount. The output flags data hygiene issues like past-due close dates or null amounts.

Get the full picture on a specific deal:

show me a detailed view of the OPPORTUNITY NAME opportunity in salesforce - include the opportunity team members, any activities or tasks, and the account contacts

What to expect: The opportunity overview (stage, amount, close date, probability, forecast category, owner), opportunity team members with roles, tagged contacts, recent tasks and events, and field change history showing how the deal amount and close date have moved over time.

Check for open support cases on your accounts:

show me all open salesforce cases across Colleague Name's account team accounts, grouped by account, sorted by most recent first

What to expect: A count of open cases with priority and status breakdown, then case details grouped by account. Stale cases (months or years old with no activity) are flagged as hygiene candidates.

Get a forecast-ready view of your pipeline:

for Colleague Name's accounts, show me a quarterly pipeline summary - group the open opportunities by close date quarter with count, total amount, and weighted amount for each quarter

What to expect: A table with one row per quarter showing opportunity count, total pipeline, and weighted pipeline. Includes a stage mix breakdown per quarter and highlights the top weighted deals. Past-due opportunities are grouped separately.

Deep dive into a specific customer:

give me a full account overview for ACCOUNT NAME in salesforce including contacts, open opportunities, and recent cases

What to expect: Company profile (industry, revenue, employees, location), key contacts with titles and email, open opportunities with stages and amounts, and recent support cases with status.

Look up a specific support case by number:

look up salesforce case CASE-NUMBER and show me the case details, the customer account, and who owns it

What to expect: Case subject, status, priority, description, the customer account profile, and the case owner with contact information.

For power users, you can ask for specific SOQL-style queries in natural language. The plugin translates your request into the appropriate SOQL and runs it.

query salesforce for all Contacts at ACCOUNT NAME - show Name, Title, Email, Phone, and Department
show me all salesforce opportunities that closed won in the last 90 days on ACCOUNT NAME
count all open salesforce cases grouped by priority and status across my accounts
query the CUSTOM_OBJECT__c object in salesforce for records where Status__c = 'Active'

The 30 Salesforce development skills from the forcedotcom/afv-library activate automatically for Apex, Flow, LWC, SOQL, metadata, Agentforce, and deployment tasks. Install them separately:

Terminal window
npx skills add forcedotcom/afv-library
TopicSkill
Apex classes and servicesgenerating-apex
Apex testsgenerating-apex-test
Flowsgenerating-flow
LWC and UI bundlesbuilding-ui-bundle-app
Custom objectsgenerating-custom-object
Custom fieldsgenerating-custom-field
Validation rulesgenerating-validation-rule
Permission setsgenerating-permission-set
FlexiPagesgenerating-flexipage
Agentforce agentsdeveloping-agentforce
Agentforce testingtesting-agentforce
Deploymentdeploying-ui-bundle
SLDS2 migrationuplifting-components-to-slds2
Trigger refactoringtrigger-refactor-pipeline