Find the root cause of a bug, a failing test or unexpected behaviour before changing any code, then fix it with a regression test. Use on "ça marche pas", "bug", "pourquoi ça plante", "this test fails", or after a fix that did not hold.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Debug?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/sycatle-debug-57c25761)
---
name: debug
description: Find the root cause of a bug, a failing test or unexpected behaviour before changing any code, then fix it with a regression test. Use on "ça marche pas", "bug", "pourquoi ça plante", "this test fails", or after a fix that did not hold.
invocation: explicit
---
# Debug
**No fix without a root cause.** Reproduce, explain why it happens, then change the code.
A fix for a symptom moves the bug somewhere you are not looking. It also teaches nothing: the same cause
comes back in the next feature. Guessing feels faster, and it is, until the third guess. The pressure to
"just try something" is strongest exactly when the cause is least understood.
## Steps
1. **Reproduce it.** Find the smallest input or sequence that shows the bug every time, ideally as a
failing test. Done when you can make it happen on demand. A bug you cannot reproduce is not ready to
be fixed: gather evidence (logs, versions, the exact input) instead.
2. **Read what it says.** The full error, the first stack frame in your code, the log lines just before.
The answer is in the error message more often than anyone admits.
3. **Find what changed.** When it used to work: `git log`, `git bisect`, the dependency or config that
moved. A working version next to a broken one narrows the search faster than reading code.
4. **Form one hypothesis and test it.** "X is null because Y returns early when Z": predict what you will
see, then look (a log line, a debugger, an assertion). One variable at a time. Done when the evidence
confirms the cause, not when the theory sounds right.
5. **Fix the cause** with a regression test that fails before the fix and passes after (the `tdd` loop).
Then run everything (`verify`): a fix that breaks something else is not a fix.
6. **Say what it was**, in a sentence or two: the cause, why it happened, why the fix holds. If the same
mistake could exist elsewhere, look, and say what you found.
## When to stop and step back
Three hypotheses in and still wrong: stop patching. You are probably missing a fact about how the system
works, not looking at the wrong line. Re-read the code path from the entry point, write down what you
know for certain versus what you assume, and question the assumptions first. If the cause turns out to
be a design problem, say so, and propose it as a ticket rather than burying it under a workaround.