sf-scratch-orgs-sandboxes

Provision and manage Salesforce scratch orgs and sandboxes through definition files and CLI lifecycle scripts.

2|Updated Sep 12, 2026
One-click install
npx skills add https://github.com/grzmol/vibe-force --skill sf-scratch-orgs-sandboxes-grzmol
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sf-scratch-orgs-sandboxes
Source: https://github.com/grzmol/vibe-force/tree/main/skills/sf-scratch-orgs-sandboxes
Command: npx skills add https://github.com/grzmol/vibe-force --skill sf-scratch-orgs-sandboxes-grzmol

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Choosing, creating, and tearing down Salesforce development environments is error-prone: wrong org types waste sandbox licenses, missing features break deploys, and abandoned scratch orgs exhaust Dev Hub allocations. This Skill provides decision tables, definition file templates, and scripted lifecycles so every environment is provisioned declaratively and cleaned up deterministically. ## Core Features & Use Cases - Org type selection: Decision tables map each workload (feature branches, UAT, release staging, package testing) to the right scratch org or sandbox type, including source tracking support per type. - Declarative provisioning: Ready-to-use scratch org and sandbox definition files covering editions, features, settings, objectSettings, snapshots, org shapes, and post-copy Apex classes. - Scripted lifecycle: Copy-ready bash for create, deploy, seed, test, and destroy loops, async create with resume, nightly snapshot refresh, CI matrix orgs, and allocation reclamation. - Troubleshooting reference: Signup error codes (C-1007 through VR-0003), snapshot and shape failures, sandbox CLI errors, and source tracking conflict recovery. - Use Case: A CI pipeline needs a throwaway org per pull request. Use the ephemeral org script with a trap-based delete and --no-track-source to run gates against a one-day scratch org without leaking Dev Hub allocations. ## Quick Start Ask the assistant to create a scratch org from config/project-scratch-def.json against the vf-devhub Dev Hub with a 7-day duration and then verify its shape.

Frequently Asked Questions about sf-scratch-orgs-sandboxes

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

FAQPage Schema
How do I create a Salesforce scratch org with a definition file?

Run sf org create scratch with --definition-file pointing to a JSON file that declares edition, features, and settings, plus --target-dev-hub, --alias, and --duration-days (1-30, default 7). The definition file is the single declaration of org shape; only edition is required.

Scratch org vs sandbox: which Salesforce environment should I use?

Use a scratch org for disposable feature and CI work where the shape is declarable in a definition file. Use a Developer or Developer Pro sandbox when work depends on production configuration, and Partial Copy or Full sandboxes when testing against production data or scale.

Does source tracking work in Salesforce sandboxes?

Source tracking is supported and on by default in Developer and Developer Pro sandboxes, but cannot be enabled in Partial Copy, Full, or Developer Edition orgs. In unsupported sandboxes, use manifest-driven deploys and sf project deploy start --dry-run for drift detection.

Why did sf org create scratch fail with an error code?

Query ScratchOrgInfo in the Dev Hub to read the ErrorCode: C-1007 means duplicate username, S-2006 means invalid country code, SN-0001 means the snapshot expired, and SH-0002 means no org shape exists for the source org. Each code has a documented fix in the troubleshooting reference.

How do I automate sandbox post-refresh tasks in Salesforce?

Set apexClassName in the sandbox definition file to an Apex class implementing SandboxPostCopy; it runs after every create, clone, and refresh. Use it for deterministic work like deactivating integration users, rewriting endpoints, and scrubbing email addresses.

How do I avoid exhausting scratch org allocations in CI?

Always delete scratch orgs in a trap or finally block, since abandoned orgs hold an active allocation until expiry. Create CI orgs with --no-track-source and --duration-days 1, and reclaim leaked orgs by deleting ActiveScratchOrg records in the Dev Hub.