Terminal
Terminal/Skill
Checks Salesforce metadata before deploying: a validation for production orgs, a dry run for sandboxes and scratch orgs.
By Salesforce
Works with
npx skills add forcedotcom/sf-skills --skill platform-deploy-validateRun a server-side validation before deploying metadata. Validation surfaces errors without modifying the org and — for production targets — produces a job ID usable with platform-quick-deploy for a fast, test-free deploy.
Always prefer sf project deploy validate (prod) or sf project deploy start --dry-run (sandbox/scratch) over the Tooling API directly.
Classify the org with the gate's classifier — it is the authoritative source of truth and resolves the org the same way the deploy hook does (it handles sandbox/scratch markers, trial and Developer Edition orgs including SDOs, and treats a Dev Hub with no such signal as production; returns one of production|sandbox|scratch|trial|unknown):
"${CLAUDE_PLUGIN_ROOT}/scripts/sf-deploy-gate" bucket <alias>
Only production takes the production path (Step 2b); every other result takes the sandbox/scratch path (Step 2a). unknown means the org type could not be confirmed (usually an incomplete org record). Say so plainly: the deploy gate still allows the deploy, auto-deploy on save stays off for that org, and re-authenticating with sf org login web usually restores the classification.
sf project deploy start --dry-run --target-org <alias> --json [scope flags]
Scope flags (use exactly one, not all):
--source-dir <path> — deploy a directory--metadata <Type:Name> — deploy specific components--manifest manifest/package.xml — deploy from manifestDefault test level: omit --test-level for sandboxes (defers to org default). Add --test-level RunLocalTests only if the user asks.
Report back: success/failure, components attempted, any errors. No job ID is returned for dry-runs (this is expected).
sf project deploy validate --target-org <alias> --json [scope flags] --test-level RunLocalTests
Production validations REQUIRE a test level. Use RunLocalTests by default; switch to RunSpecifiedTests --tests <ClassName>... if the user has explicitly listed tests.
The response returns a job ID (result.id) valid for 10 days. Persist it for platform-quick-deploy:
mkdir -p .sfdx
echo '{"jobId":"<id>","createdAt":"<iso8601>","targetOrg":"<alias>","testLevel":"RunLocalTests"}' > .sfdx/last-validation.json
Report:
platform-quick-deploy with this job IDIf validation fails, parse result.details.componentFailures and result.details.runTestResult.failures and surface:
Do NOT propose fixes that change unrelated metadata. Stay scoped to what the validation reported.
--json on every CLI callsf project deploy start against prod from this skill)--ignore-errors or --ignore-warnings during validation; those flags belong to actual deploys, not validationplatform-quick-deploy (do not start a regular deploy against prod).sfdx/last-validation.json so the quick-deploy skill can find itAlways end with:
platform-quick-deploy (with job ID + expiry) OR to platform-metadata-deploy for non-prod