Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
forcedotcom avatar

Deploying Metadata

  • 2.5k installs
  • 763 repo stars
  • Updated July 24, 2026
  • forcedotcom/sf-skills

deploying-metadata is an sf-skills module for Salesforce metadata deploy orchestration, dry-runs, CI pipelines, and failure triage with sf CLI v2.

About

Deploying Metadata is a Salesforce DevOps skill for orchestrating metadata releases with sf CLI v2 only. It owns sf project deploy start, quick, report, retrieval workflows, release sequencing, CI CD guidance, and failure triage while delegating Apex authoring, LWC creation, Flow authoring, and data seeding to sibling sf-skills. Critical rules require explicit deploy scope on non-source-tracking orgs, dry-run validation before real deploys, and safe Flow rollout as Draft before activation. Default ordering deploys custom objects and fields first, then permission sets, Apex, Flows as Draft, and post-verify activation to avoid FLS and dependency errors. Workflows gather target org alias, scope via source-dir metadata or manifest, test level, and rollback expectations, then run preflight sf org display and validate with JSON output. CI pipelines cover authenticate, static analysis with sf code-analyzer v5, dry-run, tests including RunRelevantTests, deploy, and verify. Use it when shipping Salesforce metadata, scratch org management, pipeline design, or troubleshooting INVALID_CROSS_REFERENCE_KEY and test failures during deploy.

  • sf CLI v2 only with --dry-run validation before production deploys.
  • Default metadata order: objects, permission sets, Apex, Flows as Draft, then activate.
  • Supports source-dir, manifest, quick deploy after validation, and deploy report verification.
  • Delegates Apex, LWC, Flow authoring, and test data to specialized sf-skills.
  • CI guidance uses sf code-analyzer v5 and optional RunRelevantTests for Apex-heavy releases.

Deploying Metadata by the numbers

  • 2,512 all-time installs (skills.sh)
  • +7 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #70 of 1,453 DevOps & CI/CD skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

deploying-metadata capabilities & compatibility

Capabilities
sf project deploy validate and deploy workflows · metadata ordering and flow draft activation sequ · deploy report and test verification steps · ci cd pipeline shape with code analyzer v5 · high signal deployment failure pattern triage
Works with
salesforce
Use cases
ci cd · devops
npx skills add https://github.com/forcedotcom/sf-skills --skill deploying-metadata

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs2.5k
repo stars763
Security audit3 / 3 scanners passed
Last updatedJuly 24, 2026
Repositoryforcedotcom/sf-skills

How do I safely validate and deploy Salesforce metadata without dependency, Flow, or permission set ordering failures?

Validate and deploy Salesforce metadata with sf CLI v2 dry-runs, ordered releases, CI gates, and deployment failure triage.

Who is it for?

Salesforce teams using sf CLI v2 who need deploy sequencing, CI gates, and structured failure triage.

Skip if: Skip when the task is writing Apex, LWC, or Flow definitions; use generating-* skills first.

When should I use this skill?

User deploys Salesforce metadata, manages scratch orgs, sets up CI CD, or troubleshoots sf project deploy errors.

What you get

Validated deploy or retrieval with clear report, test results, and next safe action documented.

  • Deployment report with pass or fail status and next safe action

By the numbers

  • Supports pre-destructive-changes and post-destructive-changes deployment flags

Files

SKILL.mdMarkdownGitHub ↗

deploying-metadata: Comprehensive Salesforce DevOps Automation

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 Task

Use deploying-metadata 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:

  • authoring Apex code → generating-apex
  • authoring LWC components → generating-lwc-components
  • creating custom objects or fields → generating-custom-object, generating-custom-field
  • building Flows → generating-flow
  • doing org data operations → handling-sf-data
  • authoring or testing Agentforce agents → developing-agentforce

---

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 `handling-sf-data` after metadata is validated or deployed.

Default deployment order

PhaseMetadata
1Custom objects / fields
2Permission sets
3Apex
4Flows as Draft
5Flow activation / post-verify

This ordering prevents many dependency and FLS failures.

---

Required Context to Gather First

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:

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

---

Recommended Workflow

1. Preflight

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

2. Validate first

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 handling-sf-data 4. run tests / smoke checks 5. orchestrate multiple post-deploy steps in order

4. Deploy the smallest correct scope

# 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

# manifest deploy with Spring '26 relevant-test selection
sf project deploy start --manifest manifest/package.xml --target-org <alias> --test-level RunRelevantTests --wait 30 --json

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

5. Verify

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

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

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

  • When org policy and release risk allow it, consider --test-level RunRelevantTests for Apex-heavy deployments.
  • Pair this with modern Apex test annotations such as @IsTest(testFor=...) and @IsTest(isCritical=true) — see generating-apex for authoring guidance.

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 skill for authoring decisions:

  • developing-agentforce for .agent authoring, Agent Builder, Prompt Builder, and metadata config

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

  • references/agent-deployment-guide.md

---

Cross-Skill Integration

NeedDelegate toReason
custom object creationgenerating-custom-objectdefine objects before deploy
custom field creationgenerating-custom-fielddefine fields before deploy
Apex authoring / fixesgenerating-apexcode authoring and repair
Flow creation / repairgenerating-flowFlow authoring and activation guidance
test data or seed recordshandling-sf-datadescribe-first data setup and cleanup
Agent authoring and publish readinessdeveloping-agentforceagent-specific correctness

---

Reference Map

Start here

  • references/orchestration.md
  • references/deployment-workflows.md
  • references/deployment-report-template.md

Specialized deployment safety

  • references/trigger-deployment-safety.md
  • references/agent-deployment-guide.md
  • references/deploy.sh

Asset templates

  • assets/package.xml — manifest template covering common metadata types
  • assets/destructiveChanges.xml — template for removing metadata from target orgs

---

Score Guide

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

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>

Related skills

Forks & variants (1)

Deploying Metadata has 1 known copy in the catalog totaling 534 installs. They canonicalize to this original listing.

How it compares

Use deploying-metadata for CLI-based org promotion and deletions; use separate Salesforce authoring skills for writing Apex or LWC source locally.

FAQ

Must I dry-run before deploying?

Yes. Prefer --dry-run first before real deploys per the skill operating rules.

What deploy order prevents permission errors?

Deploy custom objects and fields before permission sets, then Apex, then Flows as Draft before activation.

Which static analysis tool does CI use?

sf code-analyzer (Code Analyzer v5), not the retired sf scanner.

Is Deploying Metadata safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

DevOps & CI/CDdeployinfra

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.