grzmol/vibe-force/sf-deployment-strategies

Claude Code and agent skill by grzmol/vibe-force

Trust tier 3
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Source check pending

Checking that the SKILL.md file is still in the repository.

Covers how Salesforce metadata reaches an org — source deploy versus Metadata API versus change sets versus DevOps Center versus packaging, the full sf project deploy start flag surface, validate plus quick deploy as the production path, test levels and coverage rules, destructive changes, per-metadata-type deployment gotchas (Profiles, Flows, custom settings, record types, picklists, sharing rules, layouts, translations), environment promotion pipelines with git branching, drift and conflict detection, rollback reality, zero-downtime schema and Apex change patterns, CI/CD wiring, and the deployment error catalogue. Use this skill when a task mentions sf project deploy start, deploy validate, deploy quick, --test-level, RunLocalTests, destructiveChanges.xml, package.xml manifests, quick deploy job ids, deployment failures, promoting to production, rollback, or the vf-check deploy-validate / deploy-quick / verify checks.

Install

npx vskill@latest install grzmol/vibe-force/sf-deployment-strategies

Semi-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-deployment-strategies.

Salesforce Deployment Strategies

How vibe-force gets metadata into an org safely. Wave 3 of the harness workflow is exactly two serial steps — deploy-validate then deploy-quick — and this skill explains why, what they enforce, and everything that goes wrong around them.

API version for all examples: 67.0 (Summer '26), the apiVersion value in config/vibe-force.defaults.json.

When to use

  • Building or debugging any sf project deploy * invocation.
  • Deciding a test level and proving the coverage rule that applies to it.
  • Deleting metadata (destructive changes) or deploying a type with known gotchas.
  • Designing dev -> integration -> UAT -> production promotion and its git branching.
  • Detecting drift between repo and org, or resolving source-tracking conflicts at deploy time.
  • Planning a rollback, a forward-fix, or a zero-downtime schema/Apex change.
  • Wiring CI/CD gates around vf-check deploy-validate / deploy-quick / verify.
  • Not for scratch org or sandbox provisioning (skill sf-scratch-orgs-sandboxes), not for

package versions (skill sf-packaging-release), not for writing the tests themselves (skill sf-apex-testing).

Decision table: which delivery mechanism

MechanismUse whenAvoid when
sf project deploy start (source format)Default for everything in this harness: dev, integration, UATYou need a validated-then-quick production deploy
sf project deploy validate + sf project deploy quickProduction. Long test runs you cannot afford to fail at the end of a change windowSandboxes — validate/quick are documented as production-only
sf project deploy start --metadata-dir <dir>You hold a metadata-format ZIP/dir from another toolSource-format projects (the normal case)
Change setsAdmin-only, one-off, click-path change with no repoAnything the repo owns; there is no review, diff, or replay
DevOps CenterOrg-centric teams that want a UI over git work itemsAgent-driven pipelines that need deterministic CLI exit codes
Unlocked / managed packagesVersioned, installable artifacts with an upgrade pathFast iteration inside one org; see skill sf-packaging-release

Test levels

LevelRunsCoverage ruleAllowed on
NoTestRunnothingnoneDevelopment environments only (sandbox, DE, trial). Default for development environments. Not accepted by deploy validate
RunSpecifiedTestsonly --testseach class and each trigger in the deployment package must reach 75% individuallyany
RunLocalTestsall org tests except those from installed managed and unlocked packagesorg-wide 75% overall, and Apex triggers must have some coverageany; default for production deploys that include Apex, and the default for deploy validate
RunAllTestsInOrgall tests including managed package testsas RunLocalTestsany
RunRelevantTests (Beta)tests Salesforce infers from the payload and its dependencieseach class and trigger in the package must reach 75% individuallyany

Default behaviour when --test-level is omitted depends on the payload and the target org. For a production deploy, all non-managed tests run if the package contains Apex classes or triggers; if the package has no Apex components, no tests run (API 34.0 and later). Never rely on that inference in automation — always pass --test-level explicitly. config/vibe-force.defaults.json pins testLevels.sandbox and testLevels.production to RunLocalTests.

--tests is space- or repeat-separated, not comma-separated: --tests AccountServiceTest ContactServiceTest "Test With Space".

Core patterns

1. Everyday deploy (dev / integration / UAT)
bash
sf project deploy start \
--target-org vf-int \
--source-dir force-app \
--test-level RunLocalTests \
--wait 45 \
--coverage-formatters json --results-dir .vibeforce/reports/coverage \
--concise

Full flag table: references/deploy-command-reference.md.

2. Narrow the payload
bash
# by directory (repeat or space-separate)
sf project deploy start --source-dir force-app/main/default/classes force-app/main/default/objects --target-org vf-dev
# by type, by name, by wildcard (quote the wildcard)
sf project deploy start --metadata ApexClass --target-org vf-dev
sf project deploy start --metadata ApexClass:AccountService --target-org vf-dev
sf project deploy start --metadata 'ApexClass:Account*' --target-org vf-dev
sf project deploy start --metadata "Profile:My Profile" --metadata ApexClass --target-org vf-dev
# by manifest (children are included automatically)
sf project deploy start --manifest manifest/package.xml --target-org vf-uat

--source-dir, --metadata, and --manifest are mutually exclusive within one command.

3. Preview and dry run before you commit
bash
sf project deploy preview --target-org vf-int # conflicts, deletions, ignored files
sf project deploy start --dry-run --test-level RunLocalTests --target-org vf-int --source-dir force-app

--dry-run validates and runs Apex tests but never saves. This — not deploy validate — is the supported way to validate against a sandbox. There is no --dry-run flag on sf project retrieve start; use sf project retrieve preview to see incoming drift.

4. Production: validate, then quick deploy
bash
# Step 1 (long): validate. Returns a job id, saves nothing.
sf project deploy validate \
--target-org vf-prod \
--source-dir force-app \
--test-level RunLocalTests \
--coverage-formatters json --results-dir .vibeforce/reports/coverage \
--wait 180 --verbose
# Step 2 (short): deploy the validated payload, skipping tests.
sf project deploy quick --job-id 0Af0x000017yLUFCA2 --target-org vf-prod --wait 60

The validation job id is valid for 10 days. Quick deploy succeeds only if the validation succeeded, its Apex tests passed, and coverage requirements were met. --use-most-recent on deploy quick only searches validations from the past 3 days, so automation must persist the job id rather than rely on it. Runbook, state-file contract, and hook interaction: references/validate-quick-deploy.md.

vf-check deploy-validate writes {jobId, targetOrg, testLevel, validatedAt, expiresAt, sha} to <project>/.vibeforce/state/deploy-jobs.json; vf-check deploy-quick reads the newest non-expired entry for the target org. The vibe-force hooks refuse a deploy-quick (and a raw sf project deploy start) against any alias in productionAliases unless hooks.blockProductionDeploy is false or VF_ALLOW_PROD=1 is exported. VF_HOOK_MODE=off disables the guard entirely and should never be used in CI.

5. Async, report, resume, cancel
bash
sf project deploy validate --source-dir force-app --target-org vf-prod --async --test-level RunLocalTests
sf project deploy report --job-id 0Af0x000017yLUFCA2 --target-org vf-prod --wait 30
sf project deploy resume --job-id 0Af0x000017yLUFCA2 --wait 60 # also updates source tracking
sf project deploy cancel --job-id 0Af0x000017yLUFCA2 --target-org vf-prod --wait 10

deploy report does not update source tracking; deploy resume does. Exit codes: Succeeded 0, Canceled 1, Failed 1, SucceededPartial 68, InProgress/Pending/Canceling 69.

6. Destructive changes

Deletions travel in a manifest alongside a package.xml. Wildcards are not supported in destructive manifests.

xml
<!-- manifest/destructiveChangesPost.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Account.Legacy_Score__c</members>
<name>CustomField</name>
</types>
</Package>
xml
<!-- manifest/package.xml - required even for a delete-only deploy -->
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<version>67.0</version>
</Package>
bash
sf project deploy start \
--target-org vf-int \
--manifest manifest/package.xml \
--post-destructive-changes manifest/destructiveChangesPost.xml \
--purge-on-delete \
--ignore-warnings \
--test-level RunLocalTests --wait 60

--pre-destructive-changes deletes before additions, --post-destructive-changes after — use post when the additions remove the dependency that blocks the delete (for example, updating an Apex class to stop referencing a field, then deleting the field in the same deploy). --purge-on-delete bypasses the Recycle Bin. --ignore-warnings is the one legitimate CI use of that flag: deleting a component that no longer exists in the org raises a warning that would otherwise mark the deploy unsuccessful.

The vibe-force hooks block any command carrying --pre-destructive-changes, --post-destructive-changes, or --purge-on-delete when hooks.blockDestructive is true (the default) unless the run is explicitly approved.

7. Per-type gotchas

Profiles, Flows, custom settings, record types, picklists, sharing rules, layouts, and translations each fail in their own way. One example, then the full table in references/metadata-gotchas.md:

bash
# WRONG: the flow's own <status>Active</status> is overridden by the flowDefinition
sf project deploy start --metadata Flow:VF_Lead_Router --target-org vf-int
# RIGHT: control activation explicitly through FlowDefinition.activeVersionNumber
sf project deploy start --metadata Flow:VF_Lead_Router FlowDefinition:VF_Lead_Router --target-org vf-int

If a FlowDefinition is part of the deployment, its activeVersionNumber wins over the status field in the flow. Deploying flowDefinitions with a stale number silently activates the wrong version.

8. Drift detection
bash
# Does the org contain anything the repo does not know about?
sf project retrieve preview --target-org vf-int # tracked orgs only
sf project deploy start --dry-run --manifest manifest/package.xml --target-org vf-prod
# Untracked orgs (production, Full/Partial sandboxes): retrieve and diff
sf project retrieve start --manifest manifest/package.xml --target-org vf-prod --output-dir /tmp/prod-snapshot
diff -ru force-app /tmp/prod-snapshot | head -200

Production never allows source tracking, so drift there is a git question, not a CLI question: keep a scheduled job that retrieves the manifest and fails the build on a non-empty diff.

9. Environment promotion

main is what production runs. Feature branches build in scratch orgs; merges promote forward through integration and UAT; production is a validate + quick deploy off the release tag. Branch model, GitHub Actions YAML, JWT auth, and per-stage gates: references/pipeline-and-cicd.md.

StageOrgCommandGate
featurescratchdeploy start --source-dir force-appvf-check local
integrationvf-intdeploy start --test-level RunLocalTestsvf-check local + vf-check apex
UATvf-uatdeploy start --manifest ... --test-level RunLocalTestsvf-check verify
productionvf-proddeploy validate then deploy quickvf-check deploy-validate -> deploy-quick -> verify
10. Rollback reality

Salesforce has no native rollback. A failed deploy rolls back itself (unless --ignore-errors), but a successful deploy that turns out to be wrong cannot be undone by the platform. Four real options, in order of preference:

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

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/grzmol/vibe-force/sf-deployment-strategies/badge)](https://verified-skill.com/skills/grzmol/vibe-force/sf-deployment-strategies)

Something wrong with this skill or its page? Tell us.