sf-deploy

Orchestrates Salesforce metadata deployments, validation, and CI/CD workflows using sf CLI v2.

1|Updated May 7, 2026
One-click install
npx skills add https://github.com/amanpraaj/sf-skill-hub --skill sf-deploy-amanpraaj
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sf-deploy
Source: https://github.com/amanpraaj/sf-skill-hub/tree/main/skills/salesforce/sf-deploy
Command: npx skills add https://github.com/amanpraaj/sf-skill-hub --skill sf-deploy-amanpraaj

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve? Deploying Salesforce metadata to orgs involves dependency ordering, test-level selection, validation gates, and failure triage that are easy to get wrong, causing failed deployments, broken Flows, and permission errors in production. ## Core Features & Use Cases - Two-Phase Deployment: Runs dry-run validation before actual deploys, then uses quick deploy with the validation job ID for safe production rollouts. - Ordered Deployment Sequencing: Deploys objects and fields first, then permission sets, Apex, and Flows as drafts to prevent dependency and FLS failures. - Failure Triage & CI/CD Guidance: Maps common errors like INVALID_CROSS_REFERENCE_KEY to root causes and provides pipeline patterns with test gates and Code Analyzer v5 static analysis. - Use Case: You need to push a release containing new custom objects, Apex classes, and Flows to production. The skill validates with a dry run, deploys in the correct order with RunLocalTests, verifies the result, and hands off test-data creation to sf-data. ## Quick Start Ask the agent to validate and deploy the force-app directory to your target org alias with local tests, then report the deployment status and next steps.

Frequently Asked Questions about sf-deploy

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

FAQPage Schema
How do I deploy Salesforce metadata with sf CLI v2?▼

Run sf project deploy start with a scope such as --source-dir, --metadata, or --manifest, plus --target-org. Validate first with --dry-run, then deploy for real or use sf project deploy quick with the validation job ID.

What is the correct order to deploy Salesforce objects, Apex, and Flows?▼

Deploy custom objects and fields first, then permission sets, then Apex classes, then Flows as drafts, and activate Flows last. This ordering prevents dependency errors, FLS failures, and invalid Flow references.

Which test level should I use for production deployments?▼

Use RunLocalTests for standard production deployments to execute all local tests. RunSpecifiedTests suits hotfixes targeting specific classes, and RunRelevantTests can speed up Apex-heavy releases where org policy allows.

Why does my Salesforce deployment fail with INVALID_CROSS_REFERENCE_KEY?▼

This error means a component references metadata missing from the target org, such as a lookup field pointing to an undeployed object. Deploy the referenced metadata first or include both components in the same manifest.

Can I deploy Agentforce agents with sf project deploy?▼

Yes, use the Agent pseudo metadata type to sync Bot, BotVersion, GenAiPlannerBundle, GenAiPlugin, and GenAiFunction components together. Deploy Apex and Flow dependencies first, then publish and activate the agent with sf agent commands.

How do I delete metadata from a Salesforce org during deployment?▼

Create a destructiveChanges.xml listing components to remove and pass it with --pre-destructive-changes or --post-destructive-changes alongside your manifest. Always test deletions in a sandbox with --dry-run first and keep backups in version control.