Skill: Systematic Debugging
This skill enforces root-cause investigation before any fix attempt. Random fixes waste time and create new bugs.
When to Use
Use for any technical issue:
- Test failures
- Bugs in production or development
- Unexpected behavior
- Performance problems
- Build failures
- Integration issues
Do not skip this skill when:
- The issue seems simple (simple bugs have root causes too)
- You are under time pressure (systematic debugging is faster than thrashing)
- A fix seems obvious (obvious fixes often mask the real problem)
Execution Model
- Primary agent runs this skill directly.
- Rationale: Debugging requires iterative investigation in the same context. Delegating to a subagent loses the accumulated understanding.
- Exception: For multi-component issues spanning independent subsystems, delegate per-subsystem investigation to separate agents via the
dispatch-parallel-agents skill.
Workflow
Phase 1: Root Cause Investigation
No fixes are allowed until this phase is complete.
- Read error messages carefully -- stack traces, line numbers, error codes. Do not skip past them.
- Reproduce consistently -- determine the exact steps. If not reproducible, gather more data instead of guessing.
- Check recent changes --
git diff, recent commits, new dependencies, config changes, environmental differences.
- Gather evidence at component boundaries -- for multi-layer systems (CI -> build -> deploy, API -> service -> database), add diagnostic logging at each boundary to identify where the failure occurs.
- Trace data flow -- follow the bad value backward through the call stack to its origin. Fix at the source, not at the symptom.
Phase 2: Pattern Analysis
- Find working examples -- locate similar working code in the same codebase.
- Compare against references -- if implementing a pattern, read the reference implementation completely. Do not skim.
- Identify differences -- list every difference between working and broken code, however small.
- Understand dependencies -- what components, settings, config, and environment does this code need?
Phase 3: Hypothesis and Testing
- Form a single hypothesis -- state clearly: "I think X is the root cause because Y."
- Test minimally -- make the smallest possible change to test the hypothesis. One variable at a time.
- Verify before continuing -- if the hypothesis is wrong, form a new one. Do not stack fixes.
- Acknowledge unknowns -- if you do not understand something, say so. Do not pretend.
Phase 4: Implementation
- Fix the root cause, not the symptom.
- One change at a time -- no "while I'm here" improvements, no bundled refactoring.
- Verify the fix -- run the relevant tests, confirm the issue is resolved, confirm no regressions.
- If 3+ fixes have failed -- stop. The issue is likely architectural, not a bug. Discuss with the user before attempting more fixes.
Rules
- No fixes without investigation: Phase 1 must be complete before proposing any fix.
- One hypothesis at a time: Do not apply multiple changes simultaneously.
- Evidence over intuition: Every fix must be justified by evidence from the investigation, not by "it might work."
- Escalate after 3 failed attempts: Three failed fixes indicate an architectural problem. Stop fixing and discuss with the user.
- Do not increase timeouts as a fix: Find the real timing issue instead.
- Read error messages completely: Stack traces contain the answer more often than not.
1---2name: systematic-debugging3description: Investigate bugs, test failures, and unexpected behavior through root-cause analysis before proposing fixes. Use when encountering any technical issue.4license: MIT5---67# Skill: Systematic Debugging89This skill enforces root-cause investigation before any fix attempt. Random fixes waste time and create new bugs.1011---1213## When to Use1415Use for any technical issue:1617- Test failures18- Bugs in production or development19- Unexpected behavior20- Performance problems21- Build failures22- Integration issues2324Do **not** skip this skill when:2526- The issue seems simple (simple bugs have root causes too)27- You are under time pressure (systematic debugging is faster than thrashing)28- A fix seems obvious (obvious fixes often mask the real problem)2930---3132## Execution Model3334- **Primary agent** runs this skill directly.35- **Rationale**: Debugging requires iterative investigation in the same context. Delegating to a subagent loses the accumulated understanding.36- **Exception**: For multi-component issues spanning independent subsystems, delegate per-subsystem investigation to separate agents via the `dispatch-parallel-agents` skill.3738---3940## Workflow4142### Phase 1: Root Cause Investigation4344**No fixes are allowed until this phase is complete.**45461. **Read error messages carefully** -- stack traces, line numbers, error codes. Do not skip past them.472. **Reproduce consistently** -- determine the exact steps. If not reproducible, gather more data instead of guessing.483. **Check recent changes** -- `git diff`, recent commits, new dependencies, config changes, environmental differences.494. **Gather evidence at component boundaries** -- for multi-layer systems (CI -> build -> deploy, API -> service -> database), add diagnostic logging at each boundary to identify where the failure occurs.505. **Trace data flow** -- follow the bad value backward through the call stack to its origin. Fix at the source, not at the symptom.5152### Phase 2: Pattern Analysis53541. **Find working examples** -- locate similar working code in the same codebase.552. **Compare against references** -- if implementing a pattern, read the reference implementation completely. Do not skim.563. **Identify differences** -- list every difference between working and broken code, however small.574. **Understand dependencies** -- what components, settings, config, and environment does this code need?5859### Phase 3: Hypothesis and Testing60611. **Form a single hypothesis** -- state clearly: "I think X is the root cause because Y."622. **Test minimally** -- make the smallest possible change to test the hypothesis. One variable at a time.633. **Verify before continuing** -- if the hypothesis is wrong, form a new one. Do not stack fixes.644. **Acknowledge unknowns** -- if you do not understand something, say so. Do not pretend.6566### Phase 4: Implementation67681. **Fix the root cause, not the symptom.**692. **One change at a time** -- no "while I'm here" improvements, no bundled refactoring.703. **Verify the fix** -- run the relevant tests, confirm the issue is resolved, confirm no regressions.714. **If 3+ fixes have failed** -- stop. The issue is likely architectural, not a bug. Discuss with the user before attempting more fixes.7273---7475## Rules76771. **No fixes without investigation**: Phase 1 must be complete before proposing any fix.782. **One hypothesis at a time**: Do not apply multiple changes simultaneously.793. **Evidence over intuition**: Every fix must be justified by evidence from the investigation, not by "it might work."804. **Escalate after 3 failed attempts**: Three failed fixes indicate an architectural problem. Stop fixing and discuss with the user.815. **Do not increase timeouts as a fix**: Find the real timing issue instead.826. **Read error messages completely**: Stack traces contain the answer more often than not.