From lich-skills
Enforces scientific-method debugging loop (Observe→Hypothesize→Experiment→Conclude) for non-trivial bugs like crashes, flaky tests, performance regressions, or CI failures.
npx claudepluginhub lichamnesia/lich-skills --plugin lich-skillsThis skill uses the workspace's default tool permissions.
A four-phase loop that turns debugging from "try random fixes and hope" into
Guides systematic debugging of bugs, test failures, or unexpected behavior via reproduce-understand-hypothesize-fix-verify phases before fixes.
Guides root cause debugging for bugs, test failures, and unexpected behavior. Enforces reproduce-investigate-hypothesize-fix process with evidence before fixes. No guessing.
Enforces root cause investigation for bugs, test failures, unexpected behavior, and performance issues through four phases before proposing fixes.
Share bugs, ideas, or general feedback.
A four-phase loop that turns debugging from "try random fixes and hope" into a disciplined investigation. Each phase has a goal, hard rules, and a rationalization table for the excuses an agent will invent to skip it.
The core principle: you may not write a fix until you have evidence that your hypothesis is correct. Guessing is not debugging.
If the bug survived one fix attempt, switch to this skill immediately.
OBSERVE ──▶ HYPOTHESIZE ──▶ EXPERIMENT ──▶ CONCLUDE
│ │ │ │
▼ ▼ ▼ ▼
Gather List 3-5 One minimal Root cause
symptoms, possible test per confirmed
reproduce causes + hypothesis, or loop
reliably evidence max 5 lines back
│ │ │ │
└──────────────┴──────────────────┴───────────────┘
write everything to DEBUG.md
Hard rules:
DEBUG.md. Context compaction will eat your
reasoning if it only lives in the conversation.Goal. Collect raw facts. Reproduce the bug. Separate what you know from what you assume.
Steps.
DEBUG.md under ## Observations.Exit criteria.
DEBUG.mdCommon Rationalizations
| Excuse | Reality |
|---|---|
| "I already know what's wrong" | Then write it as a hypothesis and prove it. If you're right, it takes 2 minutes. |
| "Let me just try this quick fix first" | That's how you end up 45 minutes deep with 6 failed attempts. |
| "The error message is clear enough" | Error messages describe symptoms, not causes. NullPointerException tells you what died, not why. |
| "I don't need to reproduce it, I can see the bug in the code" | Can you? Then why hasn't it been fixed yet? |
Goal. Generate 3-5 possible root causes. For each, list supporting and conflicting evidence from Phase 1. Rank by likelihood.
Steps.
DEBUG.md under ## Hypotheses.Example format in DEBUG.md:
## Hypotheses
### H1: Race condition in session middleware (ROOT HYPOTHESIS)
- Supports: only happens under concurrent requests, timing-dependent
- Conflicts: none yet
- Test: add mutex lock around session read, check if bug disappears
### H2: Stale cache returning expired token
- Supports: works after restart (cache cleared)
- Conflicts: cache TTL is 5min, bug appears within 30s
- Test: disable cache, reproduce
### H3: Wrong env variable in CI
- Supports: works locally, fails in CI
- Conflicts: env diff shows identical values
- Test: print actual runtime value in CI logs
Exit criteria.
DEBUG.mdCommon Rationalizations
| Excuse | Reality |
|---|---|
| "I only have one theory" | You have one favorite theory. Think harder. What if it's not that? |
| "Writing this down is slow" | Debugging without writing is slower. You'll forget hypothesis 2 after compaction eats it. |
| "The first hypothesis is obviously right" | Then proving it takes 2 minutes. If you skip proof, you'll spend 30 minutes when it turns out wrong. |
| "I don't have conflicting evidence" | That means you haven't looked hard enough, or it really is the root cause. Either way, test it. |
Goal. Test the ROOT HYPOTHESIS with the smallest possible change. You are a scientist — you are trying to falsify, not confirm.
Steps.
DEBUG.md under ## Experiments.Experiment rules.
Exit criteria.
DEBUG.mdCommon Rationalizations
| Excuse | Reality |
|---|---|
| "Let me just fix it instead of testing" | Fixing without confirming the cause is how you ship a wrong fix that breaks something else. |
| "I'll test two things at once to save time" | When both change and the bug disappears, which one fixed it? Now you have to test again. |
| "5 lines isn't enough" | 5 lines is enough to add a log, an assertion, a hardcoded value, or a short-circuit. If it isn't, your hypothesis is "something is wrong somewhere" — not a hypothesis. |
| "I don't need to revert, the fix is basically the experiment" | The experiment is diagnostic. The fix is production code. They have different quality bars. |
Goal. Confirm root cause, write the real fix, and add a regression test.
Steps.
DEBUG.md.DEBUG.md.DEBUG.md with the final ## Root Cause and ## Fix sections.Exit criteria.
DEBUG.md complete with full investigation trailCommon Rationalizations
| Excuse | Reality |
|---|---|
| "I don't need a regression test, it's a simple fix" | Simple fixes for simple bugs don't need this skill. You're here because it wasn't simple. Add the test. |
| "The DEBUG.md is just for debugging, I'll delete it" | Keep it. Future-you debugging the same area will thank present-you. |
| "All hypotheses failed, I'm stuck" | Go back to Observe. You missed something. The bug exists, therefore a cause exists. |
The #1 failure mode of AI debugging: the agent forms a theory, writes 150 lines of "fix" code, it doesn't work, so it writes another 150 lines going deeper into the same wrong theory.
This skill exists to prevent that. If you catch yourself or the agent:
Write it down. Test it. Prove it. Then fix it.