portable/compound-engineering/skills/systematic-debugging/SKILL.md
Use when debugging unexpected errors during implementation -- provides a structured 4-phase methodology instead of trial-and-error
npx skillsauth add the-rabak/compound-engineering-plugin systematic-debuggingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
A structured methodology for debugging unexpected errors encountered during implementation. Prevents trial-and-error guessing by enforcing a disciplined observe-hypothesize-test-fix cycle with an explicit causal-chain gate.
Announce at start: "I'm using the systematic-debugging skill to diagnose this issue."
bug-reproduction-validator agent instead)docs/solutions/Gather evidence before forming any theories. Do not skip this phase.
Output of Phase 1: A clear, factual description of the symptoms with no theories attached.
Form structured theories about the root cause. Do not jump to fixing yet.
List 3 possible root causes ranked by likelihood.
For each hypothesis, write the causal chain explicitly:
Trigger -> Mechanism -> Failure
Example:
Empty cache key -> config loader returns fallback shape -> validator receives missing field -> request fails with 500
Identify the uncertain links in each chain.
For each hypothesis, define:
Run a lightweight assumption audit:
Do NOT:
Verify or eliminate each hypothesis systematically. Start with the most likely.
Test the most likely hypothesis first:
If confirmed: Move to Phase 4 (Fix)
If ruled out: Test the next hypothesis
If all 3 ruled out: Return to Phase 2 with new hypotheses based on what you learned
For every uncertain link in the causal chain, test a prediction:
Techniques:
Do NOT:
Apply a targeted fix to the confirmed root cause. You are only allowed to enter this phase once the causal chain is explicit enough to explain why the failure happens.
Fix the root cause -- not the symptom. If the error is "undefined is not a function," the fix is not adding a null check -- it is understanding WHY the value is undefined and fixing THAT.
Make the minimal fix -- Change as little as possible. Do not refactor, clean up, or "improve" other code while fixing the bug.
Verify the fix:
Check for siblings -- Is this same bug likely to exist in similar code elsewhere? If so, fix those too.
Remove diagnostics -- Remove any log statements, debug prints, or breakpoints added during Phase 3.
Invalidate failed fixes explicitly -- If the attempted fix does not hold, say what part of the chain was wrong and return to Phase 1 or 2. Never silently stack another guess on top.
Stop treating the problem as a local bug and recommend a design-level workflow when any of these are true:
When that happens, recommend /workflows:debug for orchestration or escalate to /workflows:brainstorm, /workflows:architecture, or /deepen-plan as appropriate.
Include in your execution report:
### Debugging Session
- **Symptom:** [what failed]
- **Causal chain:** [trigger -> mechanism -> failure]
- **Root cause:** [what was actually wrong]
- **Fix:** [what was changed]
- **Prevention:** [how to prevent this in the future]
This information feeds into the learnings brief for subsequent tasks and can be captured in docs/solutions/ via /workflows:compound.
If you discovered a pattern that would help prevent this issue in the future:
development
Mutates a single field or content region of an existing self-contained HTML artifact in place (island-first, no-added-facts, injection-safe) without regenerating the document from scratch. Invoked by a workflow command whenever it needs to back-write into an artifact it already composed -- e.g. a ref/status update, or a content rewrite that must re-project the affected view -- never by the user directly.
development
Composes a self-contained, interactive HTML artifact (island-first, single file, token-layer themed, injection-safe) from a workflow command's structured plan payload. Invoked by a workflow command at its artifact-write step -- currently `/workflows:plan` -- never by the user directly.
development
Mutates a single field or content region of an existing self-contained HTML artifact in place (island-first, no-added-facts, injection-safe) without regenerating the document from scratch. Invoked by a workflow command whenever it needs to back-write into an artifact it already composed -- e.g. a ref/status update, or a content rewrite that must re-project the affected view -- never by the user directly.
development
Composes a self-contained, interactive HTML artifact (island-first, single file, token-layer themed, injection-safe) from a workflow command's structured plan payload. Invoked by a workflow command at its artifact-write step -- currently `/workflows:plan` -- never by the user directly.