forcedotcom/sf-skills

dx-org-switch

Switches the active Salesforce org (default target-org) using the Salesforce CLI.

All-time #2660 Trending #5885 First seen Jun 26, 2026
8-week activity · all time api

Installation

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

Summary

  • Switches the active Salesforce org (default target-org) using the Salesforce CLI.
  • Use whenever someone wants to change which org CLI commands run against — whether they say \"switch org\", \"change default org\", \"set my org to\", \"use alias\", \"point to\", or describe wanting to work against a specific org, scratch org, sandbox, or production.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from forcedotcom/sf-skills · top by installs.

npx skills add forcedotcom/sf-skills

Browse all from forcedotcom/sf-skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 972
License LICENSE.txt
Default branch main
Open issues 15
Status Active

Skill metadata

Parsed from SKILL.md frontmatter.

Version1.0
More metadata
version
1.0
domains
["Developer Experience"]
cliTools
{"0":"tool: [\"sf\"]","semver":">=2.0.0"}

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,174 B
  • docs SUMMARY.md 372 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 5,245 installs

SKILL.md

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.

  1. 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

  • Unified CLI uses keys like target-org and target-dev-hub. Legacy sfdx keys (defaultusername, defaultdevhubusername) are deprecated in this context.
  • The sf CLI does not have --local or --scope flags for config set. Local scope is the default behavior.
  • If the org does not change after setting the config, check whether SFTARGETORG is set — environment variables override config values.
  • Salesforce CLI config (unified) reference: https://developer.salesforce.com/docs/atlas.en-us.sfdxclireference.meta/sfdxclireference/clireferenceconfigcommandsunified.htm#clireferenceconfigsetunified