Debug
Get a command that goes red, then shrink, list hypotheses, fix, and keep it as the regression test.
SKILL.mdmarkdown · 36 lines
---
name: debug
description: >
Track down hard bugs and performance regressions: get a command that reproduces the problem, then find the cause.
Use when the user says "debug this", "why is this failing", or "why did this get slow",
or when you've already tried to fix the same problem twice.
---
# Debug
## 1. Get a command that goes red
Before reading code and guessing, get one command that fails while the bug exists and passes once it's fixed. Try in this order:
1. A failing test
2. A curl call or script against a local server
3. A replay of a saved real request or dataset
4. git bisect between a good and a bad version
If you can't build one, stop. Tell the user what you tried and ask for a log, a capture, or an environment that reproduces it. Don't start changing code without a repro.
## 2. Shrink it
Remove one input, step, or setting at a time and rerun. Keep the smallest case that still goes red.
## 3. List hypotheses
Write down 3 possible causes and rank them before testing any. For each, say what you'd see if it were true.
Confirm with logs or a debugger, not by reading code.
## 4. Fix
- Fix the cause, not the symptom. No "skip if empty" checks that hide the problem.
- The command from step 1 goes green. Keep it as the regression test.
## 5. Report
The cause in one sentence, how you confirmed it, what changed, and where the same kind of bug might live.
## Don't
- Don't paste secrets or tokens. Replace them with <REDACTED> in any output.
- Don't change several things and then look. Change one variable at a time.