commerce-b2b-open-code…
Integrate Salesforce B2B Commerce open source components from GitHub into B2B Commerce stores. Use when users mention \"integrate open code components\",…
Execute the destructiveChanges.xml delete-and-deploy workflow against a Salesforce org. TRIGGER when the user asks to delete/remove a custom object, field, Apex class, flow, or any metadata component FROM an org, or to perform a 'destructive deploy' / removal as part of a
$ npx -y skills add forcedotcom/sf-skills --skill platform-destructive-deploy --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/platform-destructive-deployContext preview
The summary Claude sees to decide when to auto-load this skill.
Execute the destructiveChanges.xml delete-and-deploy workflow against a Salesforce org. TRIGGER when the user asks to delete/remove a custom object, field, Apex class, flow, or any metadata component FROM an org, or to perform a 'destructive deploy' / removal as part of a
name: platform-destructive-deploy description: "Execute the destructiveChanges.xml delete-and-deploy workflow against a Salesforce org. TRIGGER when the user asks to delete/remove a custom object, field, Apex class, flow, or any metadata component FROM an org, or to perform a 'destructive deploy' / removal as part of a release. Validates first and gates production with explicit confirmation. DO NOT TRIGGER for local file deletion (use Bash), or for net-new deploys (use platform-metadata-deploy)." allowed-tools: - Bash - Read - Write - Glob - Grep
Coordinate metadata deletion against a Salesforce org via the destructiveChanges manifest. Runs in three phases: scope → validate → execute, with stricter guardrails for production.
Ask the user (or infer from context) which components to delete. For each, capture:
Before generating the manifest, scan the local project for references to each component. Use Grep over `force-app/`:
grep -rn "<componentApiName>" force-app/ --include='*.cls' --include='*.trigger' --include='*.xml' --include='*.js' --include='*.html'
If references are found:
Write to `manifest/destructiveChangesPre.xml` (for pre-deploy deletion) or `manifest/destructiveChangesPost.xml` (for post-deploy deletion). Use the standard Salesforce metadata format:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Project__c</members>
<members>OldThing__c</members>
<name>CustomObject</name>
</types>
<types>
<members>Account.Status__c</members>
<name>CustomField</name>
</types>
<version>62.0</version>
</Package>Use the API version from `sfdx-project.json`'s `sourceApiVersion`.
Group components by metadata type (one `<types>` block per type). For namespaced fields, use `Object.Field` notation.
ALWAYS validate before executing a destructive deploy:
sf project deploy validate \ --pre-destructive-changes manifest/destructiveChangesPre.xml \ --manifest manifest/package.xml \ --target-org <alias> \ --test-level RunLocalTests \ --json
(For post-destructive: use `--post-destructive-changes`.)
If `package.xml` doesn't exist, create an empty one alongside (deletion-only deploy needs a package descriptor):
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<version>62.0</version>
</Package>If validation fails, surface errors and STOP. Common failure modes:
Confirm whether the target is production before executing. The reliable check is the gate's classifier (returns `production|sandbox|scratch|trial|devhub|unknown`):
sf org display --target-org <alias> --json | "${CLAUDE_PLUGIN_ROOT}/scripts/sf-deploy-gate" classifyIf the classifier returns `production`: 1. Display destructive confirmation banner (mirroring `platform-quick-deploy`) 2. List EVERY component that will be deleted 3. Require explicit "yes, delete from PRODUCTION" confirmation 4. Reject `--purge-on-delete` unless the user types it explicitly
The PreToolUse hook (`sf-deploy-gate destructive`) will already block bare destructive commands against prod — surface that denial to the user, do not work around it.
sf project deploy start \ --pre-destructive-changes manifest/destructiveChangesPre.xml \ --manifest manifest/package.xml \ --target-org <alias> \ --json \ --wait 30
Add `--purge-on-delete` only if the user explicitly asked to permanently delete (skip the recycle bin).
After a successful destructive deploy:
# Remove the now-deleted local files to keep source tracking accurate rm -rf force-app/main/default/<path-to-component>
This repository provides a curated collection of Salesforce agent skills for building applications.
Repo: forcedotcom/sf-skills
Integrate Salesforce B2B Commerce open source components from GitHub into B2B Commerce stores. Use when users mention \"integrate open code components\",…
Replace OOTB (out-of-the-box) B2B Commerce components with open source equivalents in site metadata content.json files, or look up the equivalent open code…
Use this skill to diagnose and resolve what blocks a DevOps Center promotion of a work item's feature branch: Git merge conflicts and deployment failures.…
Use this skill to manage the full lifecycle of a DevOps Center pipeline — list all pipelines, get a single pipeline's details, create a new pipeline linked to…
Analyzes DevOps Center test failures and Code Analyzer violations in plain language — failure category, offending file/class/method/line, rule violated, fix…
Configures DevOps Center pipeline testing infrastructure: enables a test provider so its suites become available, re-syncs a configured provider to pull in new…