Skip to content
Development
Command

/set-default

Set the project's target-org (the org that all sf commands run against by default). If no org is named, lists the authenticated orgs for the user to pick.

From plugin
sf-skills
1.1k15 skills6 agents15 commands4 MCP
$ npx -y skills add forcedotcom/sf-skills --agent claude-code

Command definition

set-default.md
description: Set the project's target-org (the org that all sf commands run against by default). If no org is named, lists the authenticated orgs for the user to pick.
allowed-tools:
  - Bash
argument-hint: "[alias-or-username] [--global]"

Set the active target-org for the current project (or globally).

Workflow:

1. **Parse arguments** ($ARGUMENTS):

  • `<alias-or-username>` (optional) — which org to make the default. If omitted (e.g. the user said "connect an org" with no name), help them pick in step 2.
  • `--global` (optional) — write to user-level config instead of project-level

2. **List the authenticated orgs:**

   sf org list --skip-connection-status --json

`--skip-connection-status` avoids a token refresh for every authenticated org; step 4 checks the chosen org's connection.

  • **If no org was named:** present the authenticated orgs as a short numbered list (alias · username) and ask which one to set as the default. Use the org they choose as `<alias>` below. If the list is empty, tell the user to authenticate first via `/salesforce-development:login --alias <name>` (a browser login), then stop.
  • **If an org was named:** confirm the alias/username appears in the list. If not, tell the user to authenticate first via `/salesforce-development:login --alias <name>`.

3. **Set the target-org:**

   # Project-local (default)
   sf config set target-org <alias>

   # User-global
   sf config set target-org <alias> --global

4. **Verify the change:**

   sf org display --target-org <alias> --json

Rules:

  • Default is project-local (`.sf/config.json`) which is what most users want
  • Use `--global` only when the user is working outside any specific project
  • If the alias/username can't be found in `sf org list`, do not silently proceed
Read more
@forcedotcom
Ships withsf-skills

This repository provides Salesforce agent skills, plugins, and sample apps for building applications.

1.1k200 skills6 agents4 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
1.1k
Star history of forcedotcom/sf-skills on GitHub, a chart by star-history.com

Other commands on sf-skills.

discover

discover

Command

Show ranked what's-next nudges across the six-stage journey, run on-demand org feature detection, or find an uninstalled plugin…

@forcedotcom@forcedotcomInstall Command
feedback

feedback

Command

Record a quick 1-5 satisfaction rating as local usage telemetry. Manual-only — never dispatched by the model.

@forcedotcom@forcedotcomInstall Command
login

login

Command

Authenticate to a new Salesforce org via the browser (sf org login web). Optionally set the org as the project's default target.

@forcedotcom@forcedotcomInstall Command
logout

logout

Command

Sign out of one or all Salesforce orgs (sf org logout). Confirms before destructive action.

@forcedotcom@forcedotcomInstall Command
org

org

Command

Show just the connected Salesforce org details — alias, edition, API version, instance URL, username.

@forcedotcom@forcedotcomInstall Command

More commands from other plugins.

build
Auto-invoked

build

Command

Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.

@addyosmani@addyosmaniInstall Command