AI agents: machine-readable docs and automated org setup at /llms.txtAI agents: read setup instructions as HTML at /llms.html

Setting Up Claude Code for Agentforce

Getting Started with Claude Code

You need an org with Agentforce enabled. Get a LabBox if you need one.

1. Install Claude Code

Other platforms and installation options.

2. Connect Salesforce

Install Salesforce CLI if needed:

1
sf --version

The output should start with @salesforce/cli/.

If the org is already authorized, skip sign-in and use its existing alias.

Use your chosen alias with --target-org in later commands. If you're signed in to Labs, select that org before copying the build prompt.

3. Install the Agentforce plugin

In your project directory, run claude and follow the sign-in prompts. Then install the plugin inside Claude Code:

1
/plugin install agentforce-adlc@claude-plugins-official

Requires Python 3.9+. Run /plugin to confirm the plugin is installed and enabled; restart Claude Code if its skills are missing.

For Apex, Flow, and other platform work, you can also install Salesforce Development. See Skills and plugins for commands and prerequisites.

4. Build an agent

Paste this prompt into Claude Code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Check setup:

1. Check SF CLI: `sf --version`
   If missing, follow https://developer.salesforce.com/docs/platform/sfdx-setup/guide/sfdx-setup-install-cli.html for your OS.
2. Check that the agentforce-adlc plugin is installed and enabled with `claude plugin list`, or that the agentforce-generate, agentforce-test, and agentforce-observe skills are already available through a file-copy installation.
   If neither is available, install the plugin: `claude plugin install agentforce-adlc@claude-plugins-official`, then restart Claude Code.
   Plugin skills use the agentforce-adlc: prefix; file-copy skills use the same names without that prefix.
   Obtain authorization before changing the global environment.
   Verify the running coding agent can discover and load agentforce-generate and agentforce-test before continuing.
3. Select the intended org alias or username from the setup page or user request. Replace <org-alias> below with that value; if the intended org is unclear, ask before continuing.
   Verify the org privately: `sf data query --query "SELECT Id, Name, IsSandbox FROM Organization" --target-org <org-alias> --json`
   Confirm the returned org name and Id match the intended target. If authentication fails, reconnect this org with its Labs credential command or `sf org login web --alias <org-alias>`, then verify it again.
   Pass `--target-org <org-alias>` on every subsequent org command; do not rely on or change the default org.

Ask what the agent must do, which data and actions it can use, and how to test it. Wait for my answer before building.

Use agentforce-generate to implement the agent and its actions. Show me the changes before publishing. After publishing, run agentforce-test and report passing tests, failures, and remaining limitations.

Keep credentials out of chat, logs, and source files. Deploy only when the user's request explicitly asks; obtain authorization before tests that deploy metadata or run live actions.