Skip to content
SalesforceSkills

Deployments

Deploy metadata between Salesforce orgs. AI handles the CLI commands, validation, and flags the things that could go wrong.

Skill Details

Install this skill

Versionv2.3.0AuthorJag ValaiyapathyLicenseMITSections11

Works with

Claude CodeCursorWindsurf

Use this skill when the user needs deployment orchestration: dry-run validation, targeted or manifest-based deploys, CI/CD workflow advice, scratch-org management, failure triage, or safe rollout sequencing for Salesforce metadata.

When This Skill Owns the TaskWorkflow

Use sf-deploy when the work involves:

  • sf project deploy start, quick, report, or retrieval workflows
  • release sequencing across objects, permission sets, Apex, and Flows
  • CI/CD gates, test-level selection, or deployment reports
  • troubleshooting deployment failures and dependency ordering

Delegate elsewhere when the user is:

Critical Operating Rules

  • Use sf CLI v2 only.
  • On non-source-tracking orgs, deploy/retrieve commands require an explicit scope such as --source-dir, --metadata, or --manifest.
  • Prefer --dry-run first before real deploys.
  • For Flows, deploy safely and activate only after validation.
  • Keep test-data creation guidance delegated to sf-data after metadata is validated or deployed.

Default deployment order

This ordering prevents many dependency and FLS failures.

Required Context to Gather FirstWorkflow

Ask for or infer:

  • target org alias and environment type
  • deployment scope: source-dir, metadata list, or manifest
  • whether this is validate-only, deploy, quick deploy, retrieve, or CI/CD guidance
  • required test level and rollback expectations
  • whether special metadata types are involved (Flow, permission sets, agents, packages)

Preflight checks:

Terminal
sf --version
sf org list
sf org display --target-org <alias> --json
test -f sfdx-project.json

1. Preflight

Confirm auth, repo shape, package directories, and target scope.

2. Validate first

Terminal
sf project deploy start --dry-run --source-dir force-app --target-org <alias> --wait 30 --json

Use manifest- or metadata-scoped validation when the change set is targeted.

3. If validation succeeds, offer the next safe workflow

After a successful validation, guide the user to the correct next action:

1
deploy now
2
assign permission sets
3
create test data via [sf-data](../sf-data/SKILL.md)
4
run tests / smoke checks
5
orchestrate multiple post-deploy steps in order

4. Deploy the smallest correct scope

Terminal
# source-dir deploy
sf project deploy start --source-dir force-app --target-org <alias> --wait 30 --json

# manifest deploy
sf project deploy start --manifest manifest/package.xml --target-org <alias> --test-level RunLocalTests --wait 30 --json

# quick deploy after successful validation
sf project deploy quick --job-id <validation-job-id> --target-org <alias> --json

5. Verify

Terminal
sf project deploy report --job-id <job-id> --target-org <alias> --json

Then verify tests, Flow state, permission assignments, and smoke-test behavior.

6. Report clearly

Summarize what deployed, what failed, what was skipped, and what the next safe action is.

Output template: references/deployment-report-template.md

High-Signal Failure Patterns

Full workflows: references/orchestration.md, references/trigger-deployment-safety.md

CI/CD Guidance

Default pipeline shape:

1
authenticate
2
validate repo / org state
3
static analysis
4
dry-run deploy
5
tests + coverage gates
6
deploy
7
verify + notify

Static analysis now uses Code Analyzer v5 (sf code-analyzer), not retired sf scanner.

Deep reference: references/deployment-workflows.md

Agentforce Deployment Note

Use this skill to orchestrate deployment/publish sequencing around agents, but use the agent-specific skills for authoring decisions:

For full agent DevOps details, including Agent: pseudo metadata, publish/activate, and sync-between-orgs, see:

Cross-Skill IntegrationReference

Reference Map

Start here

Specialized deployment safety

Score Guide

PhaseMetadata
1Custom objects / fields
2Permission sets
3Apex
4Flows as Draft
5Flow activation / post-verify
Error / symptomLikely causeDefault fix direction
FIELD_CUSTOM_VALIDATION_EXCEPTIONvalidation rule or bad test dataadjust data or rule timing
INVALID_CROSS_REFERENCE_KEYmissing dependencyinclude referenced metadata first
CANNOT_INSERT_UPDATE_ACTIVATE_ENTITYtrigger / Flow / validation side effectinspect automation stack and failing logic
tests fail during deploybroken code or fragile testsrun targeted tests, fix root cause, revalidate
field/object not found in permsetwrong orderdeploy objects/fields before permission sets
Flow invalid / version conflictdependency or activation problemdeploy as Draft, verify, then activate
NeedDelegate toReason
custom object / field creationsf-metadatadefine metadata before deploy
Apex compile / review / fixessf-apexcode authoring and repair
Flow creation / repairsf-flowFlow authoring and activation guidance
test data or seed recordssf-datadescribe-first data setup and cleanup
Agent Script build/publish readinesssf-ai-agentscriptagent-specific correctness
ScoreMeaning
90+strong deployment plan and execution guidance
75–89good deploy guidance with minor review items
60–74partial coverage of deployment risk
< 60insufficient confidence; tighten plan before rollout

Completion Format

TEXT
Deployment goal: <validate / deploy / retrieve / pipeline>
Target org: <alias>
Scope: <source-dir / metadata / manifest>
Result: <passed / failed / partial>
Key findings: <errors, ordering, tests, skipped items>
Next step: <safe follow-up action>