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

Sf Deploy

  • 41 installs
  • 12 repo stars
  • Updated July 14, 2026
  • clientell-ai/salesforce-skills

Apply Salesforce deployment patterns—scratch org definitions, feature flags, and metadata push flows—when shipping changes to orgs safely.

About

sf-deploy is a Salesforce deployment patterns reference skill aimed at solo builders and small teams shipping on the Salesforce platform. It centers on a fully worked project-scratch-def.json template—org edition, feature toggles, lightning and mobile settings, security session policies, and object sharing—so scratch orgs mirror production-like capabilities before metadata deploys. Use it when you are preparing scratch orgs for feature branches, aligning enableSetPasswordInApi and community settings with integration tests, or documenting how your repo expects deploys to run. The skill is reference-heavy rather than a single-button deployer: you combine these patterns with your CLI pipeline and org authentication. It fits indie consultants and product teams who need dependable org shapes without rereading scattered Salesforce docs each sprint.

  • Complete project-scratch-def.json template with editions, features, and nested settings blocks
  • Scratch org feature catalog spanning Service Cloud, Communities, Omni-Channel, and API enablement
  • Security, chatter, communities, case, path, and opportunity settings presets for realistic orgs
  • Object-level sharing model examples for Opportunity and Case in scratch definitions
  • Deployment patterns reference for Salesforce CLI–style promote workflows

Sf Deploy by the numbers

  • 41 all-time installs (skills.sh)
  • Ranked #802 of 1,435 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)
npx skills add https://github.com/clientell-ai/salesforce-skills --skill sf-deploy

Add your badge

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

Listed on Skillselion
Installs41
repo stars12
Security audit3 / 3 scanners passed
Last updatedJuly 14, 2026
Repositoryclientell-ai/salesforce-skills

What it does

Apply Salesforce deployment patterns—scratch org definitions, feature flags, and metadata push flows—when shipping changes to orgs safely.

Files

SKILL.mdMarkdownGitHub ↗

Deployment Orchestrator

You are a Salesforce deployment specialist. Manage multi-step deployments with error handling and dependency resolution.

Deployment Workflow

1. Pre-Deployment Checks

# Verify org connection
sf org display --target-org myOrg

# Check what will be deployed
sf project deploy preview -d force-app/

# Validate without deploying
sf project deploy start -d force-app/ --dry-run --target-org myOrg

2. Generate package.xml

# From org (full manifest)
sf project generate manifest --from-org myOrg --output-dir manifest/

# From local source
sf project generate manifest -d force-app/ --output-dir manifest/

3. Deployment Order (Dependencies First)

Deploy in this order to avoid dependency failures: 1. Custom Objects & Fields — schema must exist before code references it 2. Custom Labels & Custom Metadata — referenced by Apex and Flows 3. Permission Sets & Custom Permissions — required by bypass logic 4. Apex Classes — service classes, selectors, utilities first 5. Apex Triggers — depend on handler classes 6. Flows — may reference Apex actions 7. LWC — may wire to Apex controllers 8. Layouts, FlexiPages, Profiles — reference everything above

4. Deploy Commands

# Deploy specific directory
sf project deploy start -d force-app/main/default/classes/ --target-org myOrg

# Deploy with specific tests
sf project deploy start -d force-app/ --test-level RunSpecifiedTests --tests MyClassTest,MyOtherClassTest --target-org myOrg

# Deploy with all tests (production)
sf project deploy start -d force-app/ --test-level RunLocalTests --target-org myOrg

# Deploy specific metadata
sf project deploy start -m ApexClass:MyClass,ApexClass:MyClassTest --target-org myOrg

# Quick deploy (after successful validation)
sf project deploy quick --job-id <validationId> --target-org myOrg

5. Delta Deployments

For CI/CD, deploy only changed files:

# Using sfdx-git-delta
sfdx sgd:source:delta --from origin/main --to HEAD --output delta/
sf project deploy start -d delta/force-app/ --target-org myOrg

Scratch Org Workflows

# Create scratch org from definition file
sf org create scratch -f config/project-scratch-def.json -a scratch1 -d 30

# Create from org shape (clones source org config)
sf org create scratch --source-org prodOrg -a scratch1

# Delete scratch org
sf org delete scratch -o scratch1 --no-prompt

Package Development

# Create unlocked package
sf package create --name "My Package" --package-type Unlocked --path force-app

# Create package version
sf package version create --package "My Package" --installation-key test1234 --wait 10

# Install package in target org
sf package install --package 04t... --target-org myOrg --wait 10
  • Unlocked Packages: Org-independent, no namespace lock, editable after install
  • 2GP Managed: Namespace-locked, IP protection, AppExchange distribution

Destructive Changes

<!-- destructiveChangesPost.xml — deletes AFTER deployment -->
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>OldClass</members>
        <name>ApexClass</name>
    </types>
    <version>62.0</version>
</Package>
  • destructiveChangesPre.xml — deletes BEFORE deploy (remove dependencies first)
  • destructiveChangesPost.xml — deletes AFTER deploy (clean up replaced components)
  • Deploy with: sf project deploy start -d force-app/ --post-destructive-changes destructiveChangesPost.xml

Authentication Methods

MethodUse CaseCommand
Web LoginInteractive / devsf org login web
JWT BearerCI/CD (headless)sf org login jwt --client-id ... --jwt-key-file ...
SFDX Auth URLCI/CD (simpler)sf org login sfdx-url --sfdx-url-file authUrl.txt
Device FlowHeadless (no cert)sf org login device

Salesforce Code Analyzer

# Run static analysis
sf scanner run --target force-app/ --format csv --outfile results.csv

# Run with specific rules
sf scanner run --target force-app/ --category "Security,Best Practices"

Test Level Guide

LevelWhenCommand Flag
NoTestRunNon-prod, metadata-only--test-level NoTestRun
RunSpecifiedTestsKnown affected tests--test-level RunSpecifiedTests --tests MyTest
RunLocalTestsProduction deploy--test-level RunLocalTests
RunAllTestsInOrgFull validation--test-level RunAllTestsInOrg

Error Diagnosis

Common Deployment Errors

ErrorCauseFix
Entity not found: CustomObject__cMissing dependencyDeploy custom object first
Dependent class is invalidCompile error in dependencyFix dependent class first
Code coverage is below 75%Insufficient testsRun sf-test skill to generate tests
Component not found: c:myComponentMissing LWC dependencyDeploy LWC before FlexiPage
Test failure: System.AssertExceptionTest expecting wrong dataFix test assertions
FIELD_CUSTOM_VALIDATION_EXCEPTIONValidation rule blocking test dataUpdate test data to pass validation
INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITYSharing/permission issueCheck profile/permission set deployment

Diagnosing Failures

# Check deploy status
sf project deploy report --job-id <jobId>

# Get detailed error info
sf project deploy resume --job-id <jobId>

CI/CD Pipeline (GitHub Actions)

name: Salesforce CI/CD
on:
  pull_request:
    branches: [main]
  push:
    branches: [main]

jobs:
  validate:
    runs-on: ubuntu-latest
    if: github.event_name == 'pull_request'
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
      - run: npm install @salesforce/cli -g
      - name: Authenticate
        run: sf org login jwt --client-id ${{ secrets.SF_CLIENT_ID }} --jwt-key-file server.key --username ${{ secrets.SF_USERNAME }} --instance-url ${{ secrets.SF_INSTANCE_URL }} --alias ci-org
      - name: Validate
        run: sf project deploy start -d force-app/ --dry-run --test-level RunLocalTests --target-org ci-org

  deploy:
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/main' && github.event_name == 'push'
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
      - run: npm install @salesforce/cli -g
      - name: Authenticate
        run: sf org login jwt --client-id ${{ secrets.SF_CLIENT_ID }} --jwt-key-file server.key --username ${{ secrets.SF_USERNAME }} --instance-url ${{ secrets.SF_INSTANCE_URL }} --alias prod-org
      - name: Deploy
        run: sf project deploy start -d force-app/ --test-level RunLocalTests --target-org prod-org

Gotchas

  • Profiles cause merge conflicts — prefer Permission Sets for deployable permissions
  • Destructive changes cannot be rolled back — always validate first
  • Quick deploy validations expire after 10 days
  • Source tracking resets when scratch org expires
  • Package dependencies must be installed in dependency order
  • API version mismatches between components can cause silent deployment failures
  • RunLocalTests skips managed package tests — RunAllTestsInOrg includes them
  • Sandbox refresh does not preserve manual configuration changes

Rollback Strategy

Salesforce has no native rollback. Mitigation: 1. Always validate (--dry-run) before deploying 2. Keep previous version in git — rollback = deploy previous commit 3. For destructive changes, prepare destructiveChangesPost.xml 4. Use scratch orgs / sandboxes for testing before production

References

  • Deploy Patterns — scratch orgs, packages, destructive changes, sandbox types, Code Analyzer, sfdx-git-delta, auth methods, DevOps Center

Workflow

1. Verify org authentication and connection 2. Analyze what needs to be deployed 3. Resolve dependencies and determine deploy order 4. Validate deployment (dry-run) 5. Deploy with appropriate test level 6. Monitor deployment status 7. Diagnose and fix any errors 8. Verify deployment success

Related skills

FAQ

Is Sf Deploy 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/CDintegrationsdevops

This week in AI coding

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

unsubscribe anytime.