core/capabilities/debugging/systematic-debug/SKILL.md
Four-phase debugging framework that finds root causes before attempting fixes. Use when investigating errors, debugging failures, fixing bugs, analyzing test failures, diagnosing unexpected behavior, examining stack traces, or when the user says "it's broken", "this doesn't work", or "why is this failing".
npx skillsauth add xoai/sage systematic-debugInstall 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.
Find the root cause BEFORE attempting any fix. Random fixes waste hours and create new bugs. Quick patches mask underlying issues.
Core Principle: If you haven't completed Phase 1, you CANNOT propose fixes. Symptom fixes are failure. You MUST complete each phase before proceeding to the next.
Any time something is broken: test failures, runtime errors, unexpected behavior, performance degradation, flaky tests, production incidents, "it works on my machine" issues. Also use when a previous fix didn't hold — that means root cause was wrong.
Before touching anything:
git log, git diff.
The cause is almost always in recent changes.DO NOT skip this phase. DO NOT propose a fix yet. You don't understand the problem yet.
Form 2-3 hypotheses about what could cause the observed behavior.
For each hypothesis:
For multi-component systems, trace data flow across component boundaries:
For each hypothesis, gather evidence. This means adding targeted logging, running specific commands, or inspecting state — NOT making code changes.
Rules:
When you find the root cause:
Now — and ONLY now — you may fix it:
One fix at a time. Don't combine fixes. Don't "also improve" nearby code.
If 3+ fixes have failed for the same issue:
STOP. You're treating symptoms, not the root cause. Return to Phase 1 with fresh eyes. Question whether the architecture itself is the problem, not just the code. Discuss with your human partner before attempting more fixes.
This is NOT a failed hypothesis — it may be wrong architecture.
| Anti-Pattern | What to Do Instead | |-------------|-------------------| | "Let me just try..." | STOP. What's your hypothesis? What evidence supports it? | | Changing 5 things at once | Revert. Change ONE thing. Verify. | | "It works now but I'm not sure why" | DANGER. Find out why or the bug will return. | | Fixing the test instead of the code | Tests are the specification. If the test is wrong, fix it with evidence. If the code is wrong, fix the code. | | Adding a workaround | Find the root cause. Workarounds become permanent. | | "Works on my machine" | The difference between your machine and the failing one IS the bug. |
See references/ for specialized techniques:
root-cause-tracing.md — Backward tracing through call stack to find original triggerdefense-in-depth.md — Adding validation at multiple layers after finding root causetesting
Root cause diagnosis with evidence, Reproducing test, Minimal patch
tools
Session resumption with context
tools
Configure Sage preset and project settings. Switch between base, startup, enterprise, or opensource constitution presets. Use when the user says "configure sage", "change preset", or "sage settings".
development
Brief (medium+ tasks), Spec, Implementation plan