Skip to content

forcedotcom/sf-skills / plugins/builder/salesforce-development/skills/dx-org-manage

dx-org-manage

Verified

Use to EXECUTE Salesforce org operations immediately via the sf CLI (this skill runs them, it does NOT generate scripts): create scratch orgs (from edition, definition file, snapshot, or org shape), list/display/resume/delete scratch orgs, open orgs in browser. Trigger: 'create scratch org', 'create org from snapshot', 'delete scratch org', 'open my org'. Do NOT use for switching the default org (use dx-org-switch), deploying metadata (use platform-metadata-deploy), or creating/checking/listing/deleting org snapshots (use dx-org-snapshot-manage).

references/creating-snapshot.md

View on GitHub
# Creating Snapshots

Creates a point-in-time snapshot of a scratch org using `sf org create snapshot`. Snapshots preserve scratch org state and configuration for reuse in scratch org definition files.

---

## Required Inputs

Infer from the user's request:

- **Source org**: Scratch org ID (starts with 00D) or username/alias to snapshot
- **Snapshot name**: Unique name for the snapshot (required)
- **Dev Hub**: Dev Hub org alias/username (uses default if not specified)
- **Description** (optional): Document snapshot contents, version control reference

---

## Workflow

1. **Gather inputs** — get source org, snapshot name, and optional description
2. **Build command** — construct `sf org create snapshot` with appropriate flags
3. **Execute via Bash tool** — run command with `--json` flag
4. **Return result** — report snapshot ID and status

### Command Patterns

| User intent | Execute via Bash tool |
|-------------|---------|
| Create snapshot with name only | `sf org create snapshot --source-org <orgId or alias> --name <SnapshotName> --json` |
| Create snapshot with description | `sf org create snapshot --source-org <orgId or alias> --name <SnapshotName> --description "<desc>" --json` |
| Specify Dev Hub explicitly | `sf org create snapshot --source-org <orgId or alias> --name <SnapshotName> --target-dev-hub <devHubAlias> --json` |

---

## Rules / Constraints

| Constraint | Rationale |
|-----------|-----------|
| Always use `--json` flag | Provides structured output for reliable parsing and error handling |
| Snapshot names must be unique in the Dev Hub | Duplicate names cause creation to fail |
| Source org must be a scratch org | Snapshots only work with scratch orgs, not sandboxes or production orgs |
| Source org accepts ID or username/alias | Command auto-resolves aliases to org IDs; org IDs start with 00D |
| Include description for tracking | Best practice: reference version control tag or commit ID in description |

---

## Troubleshooting

| Issue | Resolution |
|-------|------------|
| Error creating snapshot | Surface the CLI's own error unchanged; the message states what to do next |
| `@salesforce/plugin-signups does not exist in the registry` | Snapshot commands live in the `signups` plugin, which ships bundled with a normal `sf` install. This error means the CLI environment is incomplete (slim image) or the plugin registry is unreachable (offline). Because the registry is unavailable, `sf plugins install` cannot succeed — do NOT attempt it (it will fail and loop). Surface the error and advise the user to repair their environment from a connected machine: reinstall or update the Salesforce CLI (for example with `sf update`, or a fresh global CLI install through their normal package manager) so the bundled `signups` plugin is present, or run in an image that already includes it. Never run any install/repair from inside the skill. |
| "No org found for <alias>" error | Source org alias doesn't exist or isn't authenticated — verify with `sf org list` |
| Snapshot name already exists | Use a different unique name — snapshot names must be unique per Dev Hub |
| "An error while created the org snapshot" | Generic error — check that source org is a scratch org and still active |
| Long-running snapshot creation | Use `sf org get snapshot --snapshot <name>` to check status — snapshot creation is asynchronous |

---

## Output Expectations

The command returns JSON output with the created snapshot details.

See `examples/snapshots/success_output.json` and `examples/snapshots/error_output.json` for complete response structures.

Example success response:
```json
{
  "result": {
    "SnapshotId": "0Ym...",
    "SnapshotName": "MySnapshot",
    "Status": "Active",
    "SourceOrg": "00D..."
  }
}
```

---

## Using Snapshots

After creating a snapshot, use it to create scratch orgs by:

1. **In scratch org definition file:**
   ```json
   {
     "snapshot": "MySnapshot"
   }
   ```

2. **Or via command flag:**
   ```bash
   sf org create scratch --snapshot MySnapshot --target-dev-hub <alias> --alias <name> --json
   ```

See `snapshot_usage.md` for detailed examples.

---

## Additional Resources

- See `cli_flags.md` for detailed explanation of all available flags
- See `snapshot_usage.md` for how to use snapshots in scratch org creation
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall