agentforce-architectur…
Declared architecture snapshot for one Agentforce agent: planner, topics, actions, flows, Apex, prompt templates, and NGA…
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
Claude Code
$ npx -y skills add forcedotcom/sf-skills --skill platform-destructive-deploy --agent claude-code
Codex
$ npx skills add forcedotcom/sf-skills --skill platform-destructive-deploy -a codex -y
Cursor
$ npx skills add forcedotcom/sf-skills --skill platform-destructive-deploy -a cursor -y
Gemini CLI
$ npx skills add forcedotcom/sf-skills --skill platform-destructive-deploy -a gemini-cli -y
GitHub Copilot
$ npx skills add forcedotcom/sf-skills --skill platform-destructive-deploy -a github-copilot -y
OpenCode
$ npx skills add forcedotcom/sf-skills --skill platform-destructive-deploy -a opencode -y
Windsurf
$ npx skills add forcedotcom/sf-skills --skill platform-destructive-deploy -a windsurf -y
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)."
metadata:
internal: true
domains: ["Platform"]
relatedSkills: ["platform-metadata-deploy"]
cliTools:
- tool: ["sf"]
semver: ">=2.0.0"
allowed-tools:
- Bash
- Read
- Write
- Glob
- GrepCoordinate metadata deletion against a Salesforce org via the destructiveChanges manifest. Runs in three phases: scope → validate → execute, with stricter guardrails for production.
**Plugin required.** This skill runs commands that ship with its plugin, and a standalone `npx skills add` install doesn't include them. If one of those commands isn't found, or `CLAUDE_PLUGIN_ROOT` is empty, tell the user this skill needs its plugin installed. Don't improvise a replacement for the command. Where a step says what to do when its command fails, do that.
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:
Classify the target with the plugin's deploy gate, which resolves the org the same way the deploy hook does:
"${CLAUDE_PLUGIN_ROOT}/scripts/sf-deploy-gate" bucket <alias>Take the **Sandbox / Scratch / Trial path** only when the last line of the output is exactly `sandbox`, `scratch`, or `trial`. Every other result takes the **Production path** with full confirmation: `production`, `unknown`, empty output, `command not found` or `No such file or directory` (exit 127), an unresolved `${CLAUDE_PLUGIN_ROOT}`, or a non-zero exit with no bucket word. Don't ask the user what type of org it is, and don't classify the org yourself (with `sf org display`, `sf org list`, or the instance URL). Judge by the output, not the exit code: `unknown` can come with exit 0 or 2.
Tell the user why the org is treated as production:
Take this path for every Step 3a result except `sandbox`, `scratch`, or `trial`: 1. Display destructive confirmation banner (mirroring `platform-metadata-deploy`'s production confirmation banner) 2. List EVERY component that will be deleted 3. Require explicit "yes, delete from PRODUCTION" confirmation. Without it, STOP. 4. Reject `--purge-on-delete` unless the user types it explicitly 5. After confirmation, run the deploy command below
When the Salesforce Development plugin is installed, its PreToolUse deploy gate also denies every destructive deploy or delete against an org it classifies as production, even after the confirmation above. It has no override. If it denies the command, show the denial to the user and stop. Don't change the command or retry another way to get past it. Without the plugin there is no hook, and the confirmation above is the only gate.
This repository provides Salesforce agent skills, plugins, and sample apps for building applications.
Declared architecture snapshot for one Agentforce agent: planner, topics, actions, flows, Apex, prompt templates, and NGA…
Use this skill to Upgrade Einstein Bots into Agentforce agents end-to-end in a single pass, orchestrating per-bot Agent Spec…
Data Cloud 360° view of a single Agentforce session. TRIGGER when user asks to trace, inspect, summarize, or describe a specific…
Build, modify, audit, repair, optimize, debug, and deploy agents with Agentforce Agent Script. TRIGGER when: user creates,…
Analyze production Agentforce agent behavior using session traces and Data Cloud, and manage Agent Health Monitoring (AHM)…
Use to design an AI agent persona — identity, voice, tone, behavioral style, guardrails — and encode it into Agent Script (.agent…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.