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
80310 skills6 agents10 commands3 MCP
Install
> /plugin marketplace add forcedotcom/sf-skills
> /plugin install salesforce-development@salesforce

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/set-default

Context preview

What this command does when you run it.

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.

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 --json
  • **If no org was named:** present the authenticated orgs as a short numbered list (alias · username · status) 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
Ships withsf-skills

This repository provides a curated collection of Salesforce agent skills for building applications.

Get the whole plugin