Root Cause Debugging
jsmastery-pro/skills
Runs a reproduce, localize, hypothesize, test, fix and verify loop to find a bug's root cause, applies the minimal fix and hands off a regression test.
Replaces trial-and-error fixing with an observe, hypothesize, experiment and conclude loop kept in DEBUG.md, where no fix is allowed before evidence supports a cause.
$ npx skills add LichAmnesia/lich-skills --skill debug-hypothesis -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install LichAmnesia/lich-skills debug-hypothesis --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/LichAmnesia/lich-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/debug-hypothesis .claude/skills/debug-hypothesis && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "debug-hypothesis" agent skill from https://github.com/LichAmnesia/lich-skills/tree/main/skills/debug-hypothesis into .claude/skills/debug-hypothesis/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "debug-hypothesis", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/LichAmnesia/lich-skills/tree/main/skills/debug-hypothesisType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add LichAmnesia/lich-skills --skill debug-hypothesis -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install LichAmnesia/lich-skills debug-hypothesis --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/LichAmnesia/lich-skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/debug-hypothesis .agents/skills/debug-hypothesis && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "debug-hypothesis" agent skill from https://github.com/LichAmnesia/lich-skills/tree/main/skills/debug-hypothesis into .agents/skills/debug-hypothesis/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "debug-hypothesis", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add LichAmnesia/lich-skills --skill debug-hypothesis -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install LichAmnesia/lich-skills debug-hypothesis --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/LichAmnesia/lich-skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/debug-hypothesis .cursor/skills/debug-hypothesis && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "debug-hypothesis" agent skill from https://github.com/LichAmnesia/lich-skills/tree/main/skills/debug-hypothesis into .cursor/skills/debug-hypothesis/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "debug-hypothesis", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/LichAmnesia/lich-skills.git --path skills/debug-hypothesis--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add LichAmnesia/lich-skills --skill debug-hypothesis -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install LichAmnesia/lich-skills debug-hypothesis --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/LichAmnesia/lich-skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/debug-hypothesis .gemini/skills/debug-hypothesis && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "debug-hypothesis" agent skill from https://github.com/LichAmnesia/lich-skills/tree/main/skills/debug-hypothesis into .gemini/skills/debug-hypothesis/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "debug-hypothesis", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install LichAmnesia/lich-skills debug-hypothesisInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add LichAmnesia/lich-skills --skill debug-hypothesis -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/LichAmnesia/lich-skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/debug-hypothesis .github/skills/debug-hypothesis && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "debug-hypothesis" agent skill from https://github.com/LichAmnesia/lich-skills/tree/main/skills/debug-hypothesis into .github/skills/debug-hypothesis/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "debug-hypothesis", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add LichAmnesia/lich-skills --skill debug-hypothesis -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install LichAmnesia/lich-skills debug-hypothesis --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/LichAmnesia/lich-skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/debug-hypothesis .opencode/skills/debug-hypothesis && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "debug-hypothesis" agent skill from https://github.com/LichAmnesia/lich-skills/tree/main/skills/debug-hypothesis into .opencode/skills/debug-hypothesis/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "debug-hypothesis", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
debug-hypothesisReplaces trial-and-error fixing with an observe, hypothesize, experiment and conclude loop kept in DEBUG.md, where no fix is allowed before evidence supports a cause.
Any non-trivial bug goes through a four-phase investigation: wrong output, a crash, a flaky test, a performance regression or a failure that shows up only in CI. The central rule is that no fix code is written until evidence supports a hypothesis. Each phase has a goal, hard rules and a table of the excuses an agent tends to invent for skipping it.
All reasoning is written to a DEBUG.md file so context compaction cannot erase it. Observe means reproducing the bug, finding a minimal reproduction, recording the environment and noting what still works. Even a gut feeling must be written down as a hypothesis and tested, and each experiment may change at most five lines, otherwise the hypothesis is split. It is not meant for typos, missing imports or errors whose cause the compiler already states, and it takes over once a bug survives one fix attempt.
4 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit ebbc355. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are markdown).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Hypothesis-Driven Debugging loads about 2.5k tokens when it runs. Until then it costs about 74 tokens; SKILL.md has 1,280 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from LichAmnesia/lich-skills at commit ebbc355, republished under its MIT licence (© LichAmnesia). 1,280 words, ~2,532 tokens.
.claude/skills/debug-hypothesis/SKILL.md (or your agent's skills folder).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.mdHard 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 logsExit 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.
© LichAmnesia, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skills/debug-hypothesis of LichAmnesia/lich-skills.
Open the folder on GitHubat commit ebbc355
Hypothesis-Driven Debugging next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Hypothesis-Driven Debugging this skillLichAmnesia/lich-skills | 234 | — | ~2.5k | Automated safety check: Pass | MIT | |
| Root Cause Debuggingjsmastery-pro/skills | 1.4k | — | ~1.8k | Automated safety check: Notes | MIT | |
| Superpowers Systematic Debuggingchristopherarter/superpowers-reasonix | 102 | — | ~2k | Automated safety check: Pass | MIT | |
| Minimal Code Fixcobusgreyling/loop-engineering | 11k | 1 repos | ~345 | Automated safety check: Notes | MIT | |
| Failure Diagnosis LoopTotoro-jam/battle-tested-patterns | 343 | — | ~319 | Automated safety check: Pass | MIT | |
| Systematic Debuggingcbrock84/headcount | 2k | — | ~657 | Automated safety check: Pass | MIT |
jsmastery-pro/skills
Runs a reproduce, localize, hypothesize, test, fix and verify loop to find a bug's root cause, applies the minimal fix and hands off a regression test.
christopherarter/superpowers-reasonix
Any bug, failing or flaky test, or surprise behavior?. An agent skill from christopherarter/superpowers-reasonix.
cobusgreyling/loop-engineering
Makes the smallest code change that fixes one well-scoped problem, such as a CI failure, review comment or typo, without refactoring anything unrelated.
Totoro-jam/battle-tested-patterns
Walks the agent through a fixed loop for failing tests and build errors: reproduce, isolate, hypothesize, instrument, fix, verify, then add a regression test.
cbrock84/headcount
Finds the root cause of a bug, test failure, or unexpected behavior before proposing any fix.
ArabelaTso/Skills-4-SE
Analyze failing tests to detect functional bugs in code. An agent skill from ArabelaTso/Skills-4-SE.
LichAmnesia/lich-skills
Pulls Google Analytics 4 data through the Data API with TypeScript scripts and turns it into a daily SEO report or prioritized traffic and bounce-rate recommendations.
LichAmnesia/lich-skills
Generates or edits PNG images with Google's Nano Banana 2 model through a small script, with a choice of 512, 1K, 2K or 4K output.
LichAmnesia/lich-skills
Organizes long-running agent work into a Project, Sprint and Task hierarchy with per-task state files, isolated worktrees, review loops and script-checked rules.
LichAmnesia/lich-skills
Runs headless web searches and single-page extraction through the Tavily API from a Python script, returning cited, summarized results without a browser.
LichAmnesia/lich-skills
Drives a failing build, typecheck, lint or test command to a passing exit code through small, one-fix-at-a-time rounds, stopping at a hard attempt cap instead of looping forever.
LichAmnesia/lich-skills
Runs a gated Spec, Plan, Build, Test, Review, Ship workflow so non-trivial changes are specified, verified and reviewed before they ship, with a named artifact per phase.
Categories
Replaces trial-and-error fixing with an observe, hypothesize, experiment and conclude loop kept in DEBUG.md, where no fix is allowed before evidence supports a cause. Any non-trivial bug goes through a four-phase investigation: wrong output, a crash, a flaky test, a performance regression or a failure that shows up only in CI. The central rule is that no fix code is written until evidence supports a hypothesis.
Hypothesis-Driven Debugging fits situations like: A failing test whose cause is not obvious; A bug that was fixed twice and keeps returning; behavior that differs between local and CI or between dev and prod; an agent stuck applying the same wrong fix again and again.
Run `npx skills add LichAmnesia/lich-skills --skill debug-hypothesis -a claude-code`. Or copy the skill folder (skills/debug-hypothesis in LichAmnesia/lich-skills) into .claude/skills/debug-hypothesis in your project. Claude Code loads it when a task matches its description.
Run `npx skills add LichAmnesia/lich-skills --skill debug-hypothesis -a codex`. Or copy the skill folder (skills/debug-hypothesis in LichAmnesia/lich-skills) into .agents/skills/debug-hypothesis in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add LichAmnesia/lich-skills --skill debug-hypothesis -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/debug-hypothesis, .gemini/skills/debug-hypothesis, .github/skills/debug-hypothesis and .opencode/skills/debug-hypothesis in your project.
SKILL.md names no scripts, command-line tools or credentials: Hypothesis-Driven Debugging is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Hypothesis-Driven Debugging is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.5k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Hypothesis-Driven Debugging: Root Cause Debugging (jsmastery-pro/skills, 1.4k stars), Superpowers Systematic Debugging (christopherarter/superpowers-reasonix, 102 stars), Minimal Code Fix (cobusgreyling/loop-engineering, 11k stars) and Failure Diagnosis Loop (Totoro-jam/battle-tested-patterns, 343 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
LichAmnesia (a GitHub user) maintains it in LichAmnesia/lich-skills, which has 234 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on June 9, 2026.
Source: LichAmnesia/lich-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.