mcpField
D
dx-org-switch

dx-org-switch

github.com/forcedotcomCloud & DevOps1.1k5.8k installsUpdated 1d ago
Repository

About dx-org-switch

A skill for setting and verifying the default Salesforce org in the unified `sf` CLI. It helps Salesforce developers choose a local project setting or, when explicitly requested, a global setting.

Key features

  1. 01Select an org by username or alias
  2. 02List authenticated orgs when unspecified
  3. 03Set local default org
  4. 04Set global default org on request
  5. 05Verify the configured target org

Use cases

  1. 01Switching the org used by a Salesforce project
  2. 02Setting an org for work outside a project
  3. 03Checking which org the CLI targets

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/forcedotcom/sf-skills --skill dx-org-switch

After installing, type/dx-org-switchin Claude Code to confirm it loaded.

Details

From the project README

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

Comments

Markdown supported