/sf-compound-engineering:sf-debug [mode:explain|agent-observe] [error, test path, log, or subject]from sf-compound-engineering
Diagnoses Salesforce failures including tests, governor limits, deploys, LWC, and sharing. Traces causal chains from UI through Flow, trigger, Apex, DML, and callback before proposing fixes.
Ships in sf-compound-engineering. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
First argument mode:<name> selects a mode; everything after it passes to that mode's guide. Load only the guide for the chosen mode.
| Mode | Use for | Guide |
|---|---|---|
(none) | Reproduce, find the root cause, fix | this file |
explain | Explain how or why code works, recap work, or say the last message in plain language | references/explain/guide.md |
agent-observe | Analyze production Agentforce sessions (STDM traces) | references/agent-observe/guide.md |
Principles enforced: 2 (verifiability), 3 (jagged intelligence). See
PRINCIPLES.md.
Persona dispatch. This skill dispatches personas as isolated subagents — see
../sf-work/references/dispatch/guide.mdfor the mechanics (isolated subagents, same-response parallelism, same-file-conflict check). Thesf-bug-reproduction-validator(a writer) and any reviewers it spawns live underreferences/personas/; research personas are referenced from../sf-plan/references/personas/.
Investigate Salesforce-specific bugs systematically — tracing the full causal chain (UI → Flow → trigger → Apex → DML → callback) before proposing a fix — and optionally implement the fix with test-first discipline.
<feature_description> #$ARGUMENTS </feature_description>
Procedure lives in sibling files, not only in this orchestrator:
references/mandatory-debugging-gate.md before acting on this section.references/3-strikes-escalation-rule.md before acting on this section.references/defense-in-depth-pattern.md before acting on this section.references/related.md before acting on this section.mode:pipeline, read references/pipeline-mode.md before mutating.Iron Law: no fixes without root-cause classification first (references/mandatory-debugging-gate.md).
Default is interactive. mode:pipeline (set by sf-ship mode:babysit or sf-lfg) is non-interactive: never ask the user; fix only convergent bugs; return the structured JSON in references/pipeline-mode.md. Status spellings are fixed: fixed-and-pushed | fixed-not-pushed | diagnosed-no-fix | flaky-infra | needs-human. Those spellings stay in this file. A caller branches on them; a reference that restates them does not replace this line. fixed-not-pushed means the fix is committed locally and the push did not happen — never report that as fixed-and-pushed or as diagnosed-no-fix.
Trigger context awareness: when a bug surfaces in a trigger, identify whether it fires on before insert, after update, after undelete, etc., and whether the same logic must hold across all relevant contexts.
Governor limit framing: System.LimitException or Too many SOQL queries: 101 errors are causal-chain symptoms; the cause is usually a query inside a loop, a recursive trigger, or unbatched DML several layers up.
Sharing-context bugs: failing tests in production that pass in sandbox often trace to with sharing / without sharing / inherited sharing mismatches; reproduce with System.runAs(User) for the suspect role.
Mixed DML / setup/non-setup: errors of the form MIXED_DML_OPERATION mean a DML on a setup object (User, Group, GroupMember) and a non-setup object happen in the same transaction; the fix is to split into asynchronous contexts.
Deploy validation failures: sf project deploy validate failures are reproducible against a sandbox; capture the validation ID and run the relevant Apex test selectively before re-validating.
When asking the user a question, use the host's blocking question tool already in the current tool list (match by capability, not by a host-specific name). Presence in that list is proof the tool exists; never call a question tool to discover it. Fall back to numbered options in chat when no blocking tool is available. Ask one question at a time. Prefer concise single-select choices when natural options exist.
Record which files this fix owns, and which files were already dirty. Commit and publish only the fix-owned files.
Do not ask whether to open a pull request when the branch contains only this fix. State the branch, the files, and that a pull request will be opened, then continue. If the branch also holds work this run did not create, commit the fix-owned files when they are separable and stop before push, naming the other files. If a fix-owned file was already dirty, ask once before including the user's edits.
An instruction already in context that names how this repo ships (drafts only, commit only, review first) outranks that default. Do not widen the diff to the rest of the branch. mode:pipeline still follows references/pipeline-mode.md and does not open a pull request on its own.
Offer /sf-compound once, only when the verified fix produced reasoning that the final code, tests, and comments do not carry, and losing it would plausibly cause the same failure again. If the document would not change what a later reader does, skip it and do not ask.
references/3-strikes-escalation-rule.md (opens in a new tab)references/agent-observe/guide.md (opens in a new tab)references/agent-observe/references/capture-learnings.md (opens in a new tab)references/agent-observe/references/inputs-to-gather-before-starting.md (opens in a new tab)references/agent-observe/references/inspiration.md (opens in a new tab)references/agent-observe/references/phase-0-discover-the-data-space.md (opens in a new tab)references/agent-observe/references/phase-1-alt-fallback-when-stdm-is-unavailable.md (opens in a new tab)references/agent-observe/references/phase-1-observe-query-stdm-preferred-path.md (opens in a new tab)references/agent-observe/references/phase-2-reproduce-live-preview-3-run-classification.md (opens in a new tab)references/agent-observe/references/phase-3-improve-edit-the-agent-file-directly.md (opens in a new tab)references/agent-observe/references/when-to-use-this-skill.md (opens in a new tab)references/defense-in-depth-pattern.md (opens in a new tab)references/explain/guide.md (opens in a new tab)references/explain/references/agents/work-recap-scout.md (opens in a new tab)references/explain/references/boundaries.md (opens in a new tab)references/explain/references/check-in.md (opens in a new tab)references/explain/references/destinations.md (opens in a new tab)references/explain/references/execution-flow.md (opens in a new tab)references/explain/references/explainer-html.md (opens in a new tab)references/explain/references/explainer-markdown.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub divingsbysangam/salesforce-compound-engineering-plugin --plugin sf-compound-engineering10 skills in this plugin
/sf-compoundCapture durable Salesforce knowledge in docs/solutions/, or refresh stale learnings. Use when the lesson is not in the final code or tests. Use sf-debug for an open failure./sf-deployValidate, deploy, retrieve, and delete Salesforce metadata; manage orgs, manifests, test runs, and test data; set up the environment. Use for 'deploy', 'validate', 'retrieve', 'package.xml', 'scratch org', 'setup'./sf-generateGenerate Salesforce source: Apex, triggers, Flows, objects/fields/tabs/apps, permission sets, validation rules, FlexiPages, test data, prompt templates, MCP tools, Agentforce agents and tests./sf-knowSalesforce platform knowledge on demand: governor limits, Apex/LWC/Flow patterns, security (CRUD/FLS, sharing), integrations, GraphQL, Hosted MCP, agent-native design. Use when a question needs platform facts./sf-lfgTake a Salesforce request through to an open PR without check-ins. Use only for 'lfg' or an explicit end-to-end ship. Use sf-plan or sf-work when each step stays in review./sf-planPlan Salesforce work before code: ideate, brainstorm, strategy, or an implementation plan. Use for 'plan this' or STRATEGY.md. Use sf-work to implement; use sf-debug when a test is already failing.Other plugins' skills for the same job