This handles switching your default Salesforce org through the CLI, which is one of those things you do constantly when juggling multiple sandboxes, scratch orgs, or prod environments. It sets target-org locally by default (project-scoped) or globally if you ask for it, and includes a verification step since the CLI's JSON output won't tell you which scope actually took effect. The instructions are thorough about when to use local versus global scope and include a helpful reminder that SF_TARGET_ORG environment variables will override everything. Solid for teams that context-switch between orgs throughout the day.

skills.sh installs
5.8K
GitHub stars
1.2K
last updated
Aug 21, 2026

Install

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

Installs into .claude/skills of the current project.

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

Sponsors

Details

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

More from forcedotcom/sf-skills

All 158
1samber avatarfrontend-design-deslopsamber/cc-skillsProduce distinctive, non-generic UI and design applications well, working strategy-first. Identify the project (landing page, SaaS app, dashboard, ecommerce, pr5.8Kskills.sh installs
2affaan-m avatarvite-patternsaffaan-m/eccVite build tool patterns including config, plugins, HMR, env variables, proxy setup, SSR, library mode, dependency pre-bundling, and build optimization. Activat5.8Kskills.sh installs
3forcedotcom avataragentforce-testforcedotcom/sf-skillsWrite, run, and analyze structured test suites for Agentforce agents — functional AND security. TRIGGER when: user writes or modifies test spec YAML (AiEvaluati5.8Kskills.sh installs
4wondelai avatardesign-sprintwondelai/skillsRun a structured 5-day process to prototype, test, and validate product ideas with real users. Use when the user mentions "design sprint", "validate before we b5.7Kskills.sh installs
5samber avatarcopywriting-tone-of-voice-creatorsamber/cc-skillsBuild a brand tone of voice guide (TONE.md) via discovery, voice definition, and channel modulation. Outputs voice attributes with do's/don'ts, NN/g positioning5.7Kskills.sh installs
6affaan-m avatarmanim-videoaffaan-m/eccBuild reusable Manim explainers for technical concepts, graphs, system diagrams, and product walkthroughs, then hand off to the wider ECC video stack if needed.5.7Kskills.sh installs