grzmol/vibe-force/sf-scratch-orgs-sandboxes
Claude Code and agent skill by grzmol/vibe-force
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Covers provisioning and lifecycle management of Salesforce development environments — Dev Hub setup, scratch org definition files (edition, features, settings, objectSettings, snapshot, sourceOrg, release, hasSampleData), sf org create scratch / resume scratch / delete scratch, org shapes and scratch org snapshots, sandbox types and licenses, sf org create sandbox / refresh sandbox / resume sandbox / delete sandbox, sandbox definition files, Apex post-copy scripts, source tracking in scratch orgs and sandboxes, and ephemeral CI orgs. Use this skill when a task mentions project-scratch-def.json, "spin up a scratch org", scratch org allocations or expiry, snapshot, org shape, Dev Hub, sandbox refresh or clone, SandboxInfo, sandbox templates, source tracking conflicts, tracksSource, sf project reset tracking, or when deciding whether work belongs in a scratch org, a Developer sandbox, or a Full sandbox.
Install
npx vskill@latest install grzmol/vibe-force/sf-scratch-orgs-sandboxesSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as grzmol/vibe-force/sf-scratch-orgs-sandboxes.
Salesforce Scratch Orgs and Sandboxes
Environment provisioning for the vibe-force delivery harness. Every wave-0 scout run and every wave-4 verification run needs a known-shape org; this skill decides which org, defines it declaratively, and scripts its whole lifecycle.
API version for all examples: 67.0 (Summer '26), the apiVersion value in config/vibe-force.defaults.json. Do not hardcode another version in project files.
When to use
- Choosing between scratch org, Developer/Developer Pro sandbox, Partial Copy, and Full sandbox.
- Authoring or repairing
config/*-scratch-def.json/config/*-sandbox-def.json. - Creating, resuming, seeding, verifying, and deleting an org from a script or CI job.
- Diagnosing
sf org create scratchfailures (feature not enabled, allocation exhausted,
snapshot expired, org shape stale).
- Deciding source tracking on/off, and resolving or resetting tracking state.
- Not for deploying metadata (skill
sf-deployment-strategies), not for seeding strategy itself
(skill sf-data-management), not for sf auth basics (skill sf-cli-operations).
Decision table: which org
| Need | Use | Why | |
|---|---|---|---|
| Feature branch build + local gate + throwaway verification | scratch org | Declarative shape, source tracking on, 1–30 day expiry, free from Dev Hub allocation | |
| Per-developer long-lived workspace tied to production metadata | Developer sandbox | Metadata copy of production, source tracking supported, 200 MB data | |
| Same, but needs more room for seeded test data | Developer Pro sandbox | 1 GB data, source tracking supported | |
| UAT against a representative slice of production data | Partial Copy sandbox | Template-driven data subset; source tracking not supported | |
| Performance/integration rehearsal, full data, release staging | Full sandbox | Full data copy; source tracking not supported | |
| Package installation smoke test | scratch org (no namespace) | --no-namespace avoids namespace clash when installing a packaged version | |
| Package or metadata you cannot untangle from production config | Developer/Developer Pro sandbox + org-dependent unlocked package | Dependencies validate at install time; see skill sf-packaging-release |
Source tracking is supported and on by default in scratch orgs and in Developer / Developer Pro sandboxes. It cannot be enabled for Partial Copy sandboxes, Full sandboxes, or Developer Edition orgs.
Dev Hub and allocations
Enable Dev Hub in Developer, Enterprise, Unlimited, or Performance edition. The Dev Hub edition sets the allocations:
| Dev Hub edition | Active scratch orgs | Daily scratch orgs (rolling 24 h) | Snapshots (active and daily) | |
|---|---|---|---|---|
| Developer Edition or trial | 3 | 6 | 3 | |
| Enterprise Edition | 40 | 80 | 40 | |
| Unlimited Edition | 100 | 200 | 100 | |
| Performance Edition | 100 | 200 | 100 |
Scratch org storage: 500 MB data, 50 MB files. Snapshots carry a 200 MB data storage limit, expire after 90 days, and their data is retained 100 days from creation.
CI rule: always sf org delete scratch --no-prompt in a trap/finally. An abandoned org burns an active allocation until it expires (default 7 days).
Core patterns
1. Definition file is the contract
config/project-scratch-def.json is the single declaration of org shape. edition is the only required key; everything else defaults. Full option table and ready-to-use files: references/scratch-org-definition.md.
2. Create with explicit Dev Hub, alias, and duration
--duration-days accepts 1–30, default 7. --target-dev-hub (-v) is required unless the target-dev-hub config variable is set. --edition, --snapshot, and --source-org are mutually exclusive. Command-line overrides (--name, --description, --username, --admin-email, --release) win over the definition file.
3. Long creations: async plus resume
sf org resume scratch also recovers a creation that timed out. Use --use-most-recent when the job id was lost.
4. Snapshots for expensive shapes
When a shape needs installed packages plus manual setup, build it once and snapshot it. Scratch org creation from a snapshot is slower than from an edition, so raise --wait.
Snapshots cannot be created from a namespaced scratch org or from an org that was itself created from a snapshot. Connected apps, named credentials, and external credentials are never copied.
5. Org shape when production config is the source of truth
Chatbot, DevOpsCenter, MultiCurrency, and PersonAccounts are intentionally not captured by an org shape — add them back through features/settings in the definition file.
6. Full lifecycle loop (the shape agents and CI both run)
Create -> deploy source -> assign permission sets -> seed data -> run tests -> destroy. Scripted end to end in references/org-lifecycle-scripts.md.
--no-track-source is the right call for CI: tracking costs SourceMember polling and file system work that a throwaway org never benefits from.
7. Sandbox creation and refresh
--target-org on every sandbox command is the production org that holds the sandbox licenses, not the sandbox. Sandbox names are 10 or fewer alphanumeric characters and cannot be changed on refresh. Default --wait is 6 minutes, which is almost always too short — pass 30–60. Full flag tables, definition options, and the post-refresh checklist: references/sandbox-operations.md.
8. Post-copy automation
apexClassName in the sandbox definition names an Apex class implementing SandboxPostCopy; it runs after every create, clone, and refresh. Use it for the deterministic parts of post-refresh work (deactivating integration users, rewriting endpoints, blanking emails).
9. Source tracking hygiene
sf project reset tracking --revision <n> rewinds to a specific SourceMember.RevisionCounter; get the number with sf data query --query "SELECT MemberName, MemberType, RevisionCounter FROM SourceMember" --use-tooling-api --target-org vf-dev. There is no --dry-run flag on sf project retrieve start; use sf project retrieve preview.
Anti-patterns
| Anti-pattern | Failure | Fix | |
|---|---|---|---|
sf org create scratch -e developer with no definition file for feature work | Features and settings the code needs are absent; deploy fails on unrelated metadata | Keep a checked-in definition file; --edition only for throwaway probes | |
Omitting --target-dev-hub in CI | Job picks up whatever target-dev-hub the runner happens to have | Always pass -v <alias> explicitly | |
No trap/finally delete in CI | Allocation exhausted by abandoned orgs for up to 30 days | trap 'sf org delete scratch -o "$ALIAS" -p' EXIT | |
| Source tracking left on in CI scratch orgs | Slower deploys, spurious conflict checks | --no-track-source for ephemeral orgs | |
sf project reset tracking to "fix" a conflict | Real divergence silently hidden; the next deploy overwrites org work | Resolve with deploy preview then targeted --ignore-conflicts | |
| Expecting source tracking in a Full or Partial Copy sandbox | deploy preview reports nothing; conflicts undetected | Use manifest-driven deploys there; see skill sf-deployment-strategies | |
| Treating a snapshot as version control | Snapshot expires in 90 days; shape drifts from the repo | Repo is the source of truth; snapshot only caches dependencies | |
| Reusing a sandbox name right after delete | The sandbox name ... could not be found / name-in-use error | Wait for deletion to finish, or pick a new 10-character name |
Verification
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/sf-scratch-orgs-sandboxes/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/grzmol/vibe-force/sf-scratch-orgs-sandboxes)