Debug
Five-phase systematic debugging (reproduce → isolate → root cause → fix-with-regression-test → verify). Use when the user reports a bug, hits an error or failing test, or wants methodical investigation. Invocable as /debug, /debug "<symptom>", /debug --error <log>, /debug --test <test-name>.
| Name | Type | Description |
|---|---|---|
symptom | string | Description of the bug, error message, or unexpected behavior. |
error_log optional | string | Error log or stack trace (--error mode). |
test_name optional | string | Name of the failing test (--test mode). |
| Name | Type | Description |
|---|---|---|
reproduction | string | Confirmed minimal reproduction case. |
root_cause | string | Named root cause with evidence. |
fix | string | Minimal fix addressing the root cause. |
regression_test | string | Test that would have caught this bug. |
gap_analysis | string | Why this was not caught and what closes the gap. |
- may write files (regression test and fix)
Debug using five phases — do not skip or reorder. Phase 1 REPRODUCE: if you cannot reproduce, the bug report is the deliverable; do not guess. Phase 2 ISOLATE: narrow to the smallest surface. Phase 3 ROOT CAUSE: name the root cause before proposing any fix. Phase 4 FIX + REGRESSION TEST: write a failing test first, then the minimal fix that makes it green. Phase 5 VERIFY: run the suite and cite the output. After fixing: 'Why was this not caught?' — name the gap. Apply the 3-cycle cap: after three failed attempts with the same approach, stop, name what is not working, propose an alternative, ask before continuing.