Skip to content

Sets the default Salesforce org for the Salesforce CLI, locally by default and globally on request.

CCM score
77 of 100
skills.sh installs
5.9K
GitHub stars
1.2K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers picking an org from sf org list, then setting it as the default target-org with sf config set
  • Applies changes to the current project directory by default, with a --global option for system-wide scope
  • Verifies the new value with sf config get target-org --json and reports any error
  • Warns that a SF_TARGET_ORG environment variable overrides the config, and suggests sf org login web for unauthorized orgs

Install

$ npx -y skills add forcedotcom/sf-skills --skill dx-org-switch -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Steps

  1. Identify the org: the user provides a username or alias (orgIdentifier). If not provided, run sf org list to show authenticated orgs and ask the user which one to use.
  2. Set the default org:
    • Local (default): sf config set target-org <orgIdentifier>
      • Applies only within the current project directory. Use this for normal project work.
    • Global (only if user explicitly requests): sf config set target-org <orgIdentifier> --global
      • Applies system-wide across all directories. Use when working outside a project or when the user asks for global scope.
    • If this fails, report the error and suggest running sf org login web if the org may not be authorized.
  3. Verify:
    • sf config get target-org --json
    • Note: the JSON output does not include a scope/location field — it cannot confirm whether the value is local or global. Confirm the value only, e.g.: target-org is now set to: <value>
    • If it fails, report the error and advise running sf config get target-org.

Notes

Details

Repository
github.com/forcedotcom/sf-skills
Categories
CLI & Terminal, DevOps & Cloud
First seen
Jul 14, 2026

Questions

What does the dx-org-switch skill do?

The dx-org-switch skill changes which Salesforce org the Salesforce CLI commands run against by setting the default target-org. It works when you say things like switch org, change default org, or use alias, and it applies to scratch orgs, sandboxes, or production.

How do I install the dx-org-switch skill?

Run npx -y skills add forcedotcom/sf-skills --skill dx-org-switch -y in your project. Once installed, the agent can set the target org locally for the project, or globally when you explicitly ask for it.

Does dx-org-switch need the Salesforce CLI?

Yes, the skill works through the sf command line tool, version 2.0.0 or later. It uses sf org list to show authenticated orgs and sf config set target-org to change the default org.

Where does dx-org-switch rank in its category?

It sits in the CLI and Terminal category, where it ranks in the top 50. Other skills in that category include herdr, gws-shared, opentui, cf-cli and pnpm.

More from forcedotcom/sf-skills

All 78

Similar to Dx Org Switch

More CLI & Terminal