switching-org

Switch the active Salesforce CLI target org using sf config set.

Updated Apr 19, 2026
One-click install
npx skills add https://github.com/cchrisv/professorFlowVisualPicker --skill switching-org
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: switching-org
Source: https://github.com/cchrisv/professorFlowVisualPicker/tree/main/.agents/skills/switching-org
Command: npx skills add https://github.com/cchrisv/professorFlowVisualPicker --skill switching-org

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Switches the active Salesforce org (default target-org) used by the Salesforce CLI so commands run against the correct environment without manual reconfiguration.

Core Features & Use Cases

  • Switch the default target org locally with sf config set target-org <orgIdentifier> for project-scoped work.
  • Optionally set the global default with sf config set target-org <orgIdentifier> --global for system-wide effectiveness.
  • Verify the active org with sf config get target-org --json and handle common errors (unauthorized org, invalid identifier).

Quick Start

Provide your target org identifier and run the recommended sf config set target-org <orgIdentifier> to switch the default org.

Frequently Asked Questions about switching-org

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I switch the default Salesforce org for the sf CLI?

Switch the default Salesforce org by running sf config set target-org <orgIdentifier> to ensure commands target the correct environment. This updates the active org context locally for project-scoped work without manual reconfiguration.

Can I set a global default org for Salesforce CLI commands?

Yes, you can set a global default org for Salesforce CLI commands by adding the --global flag to the sf config set target-org command. This makes the chosen environment the system-wide default for all sf operations.

What is the best way to switch between scratch orgs and sandboxes in Salesforce?

The best way to switch between scratch orgs and sandboxes is using sf config set target-org with the specific alias or identifier. This reliably updates the active Salesforce org context for repeatable environment switching.

Do I need Salesforce CLI v2 to switch org contexts?

Yes, you need Salesforce CLI v2 or higher to switch org contexts using this method. The Skill requires the sf command line interface to execute the config set target-org and verification commands properly.

How do I verify the active Salesforce org after switching?

Verify the active Salesforce org by running sf config get target-org --json after switching. This confirms the current default target org and helps handle common errors like unauthorized or invalid org identifiers.

Why does my Salesforce org switch fail with an unauthorized error?

A Salesforce org switch may fail with an unauthorized error if the org identifier is invalid or authentication has expired. Verify the active org with sf config get target-org to identify and resolve the connection issue.