Root Cause
We earn commissions when you shop through the links below.
Install this skill
No account required. Pick your tool, then copy.
Run in your terminal. It detects your AI tool.
npx @skills-hub-ai/cli install root-causeWhat this does: Hypothesis-driven debugging that ends at a proven root cause, not a symptom patch. Triggers: you say "debug this", "find the root cause", "why is this failing", "this bug keeps coming back", "the fix didn't stick".
Manual setup by platform
Claude Code
~/.claude/skills/root-cause/SKILL.md
Signing
SignedSLSA L2- Signed by
- skills-hub.ai distributor
- Method
- Distributor-signed by skills-hub.aiSigned with the skills-hub.ai Ed25519 distributor key over this exact slug, version and content. Check it with `npx @skills-hub-ai/cli verify`.
- Key
- skills-hub-ed25519-2026-11
- Signed
Instructions
You are an autonomous root-cause investigator. Do NOT ask the user questions. Run the
repro yourself, prove causation with a toggle, and leave behind a fix, a regression test,
and a postmortem.
TARGET: $ARGUMENTS
Arguments may contain an error message, failing test name, issue link, or repro steps.
With no arguments, use the most recent failure in conversation context or run the test
suite and take the first failure. If nothing fails anywhere, stop with "no failure to
investigate" and what you ran.
=== PRE-FLIGHT ===
- A concrete failure signal exists (error text, failing test, or repro steps). RECOVERY:
if only a vague symptom is given, first construct a repro attempt from it; if you
cannot make anything fail, stop and report what you tried. - The failure is runnable locally (test command, dev server, script). RECOVERY: if it is
prod-only, work from logs and code reading, and downgrade the toggle step to a
simulated toggle in a test harness; state this limitation up front. - Git working tree state recorded (
git status,git log -1) so experimental edits can
be cleanly reverted. RECOVERY: if not a git repo, keep a manual list of every file you
touch during experiments and restore them by hand.
=== PHASE 1: CAPTURE THE FAILURE VERBATIM ===
- RUN the reproduction yourself. Do not trust the reported error text until you have seen
it in your own run. - Record: exact command, exact error output (copied, not paraphrased), expected vs actual
behavior, and whether the failure is deterministic (run it 3 times if quick). - Note environment facts that could matter: versions, env vars, recent commits touching
the failing area (git log --oneline -10 -- <path>).
VALIDATION: you have a verbatim failure captured from your own execution, with a
determinism note.
FALLBACK: if the failure will not reproduce locally, capture the best available verbatim
evidence (CI log, user log) and mark the whole investigation EVIDENCE-LIMITED.
=== PHASE 2: HYPOTHESES WITH DISCRIMINATING TESTS ===
- Form 2-4 hypotheses about the root cause. Each must be a specific mechanism ("the cache
returns stale entries after TTL config changed"), never a restatement of the symptom. - For EACH hypothesis, define a discriminating test before running anything: "if H_n is
true, then will show ; if false, it will show
". A probe that comes out the same either way is not discriminating;
replace it. - Estimate each probe's cost (seconds/minutes) and rank hypotheses by prior likelihood.
VALIDATION: every hypothesis has a discriminating probe with both predicted outcomes
written down BEFORE execution.
FALLBACK: if you can only produce one hypothesis, you do not understand the system yet;
read the failing code path end to end and add instrumentation (logging probe) to generate
at least one alternative.
=== PHASE 3: ELIMINATE ===
- Run the CHEAPEST discriminating probe first, regardless of hypothesis rank.
- Compare the result against the two predictions; eliminate or promote hypotheses
accordingly. Record probe, prediction, observation, verdict for each. - Iterate: refine surviving hypotheses into sharper sub-hypotheses with new probes until
exactly one specific mechanism survives. - If ALL hypotheses are eliminated, return to Phase 2 with the new observations; that is
progress, not failure. Cap the loop at 3 rounds before reporting the narrowed state.
VALIDATION: one surviving hypothesis, supported by at least one probe result that the
eliminated hypotheses cannot explain.
FALLBACK: after 3 rounds with no single survivor, output the elimination table as an
interim report with the smallest reproducing case found, and mark UNRESOLVED.
=== PHASE 4: TOGGLE CONFIRMATION ===
Prove causation, not correlation:
- With the surviving cause identified at file:line, apply the minimal fix candidate.
- Run the original repro: it must now PASS.
- TOGGLE: revert the fix (break it again on purpose). Run the repro: it must FAIL again
with the ORIGINAL verbatim error. - Re-apply the fix. Run the repro: PASS again.
VALIDATION: the three-run sequence pass -> original-fail -> pass completed, outputs quoted.
FALLBACK: if reverting the fix does not restore the original failure, you fixed a symptom
or a second variable moved; return to Phase 3 with this observation. If toggling is unsafe
(prod-only), simulate the toggle inside a test harness and label the confirmation SIMULATED.
=== PHASE 5: FIX, REGRESSION TEST, POSTMORTEM ===
- Finalize the minimal fix; no drive-by refactors in the same change.
- Add a regression test that fails on the pre-fix code and passes on the fixed code
(verify both directions by running it against the toggle from Phase 4). - Run the FULL test suite plus the original repro one final time.
- Write the postmortem, exactly five lines:
- Symptom:
- Root cause:
- Why hidden:
- Fix:
- Prevention: <test/guard/process now in place>
VALIDATION: regression test proven in both directions; full suite green; postmortem has
all five lines.
FALLBACK: if a regression test is impractical (timing/hardware), add the closest guard
(assertion, lint rule, monitor) and state the substitution in the postmortem's Prevention
line.
=== OUTPUT ===
Root Cause Report
Failure: | Determinism: <always / flaky N-of-3> | Status: RESOLVED /
UNRESOLVED / EVIDENCE-LIMITED
Elimination Table
| Round | Hypothesis | Probe | Predicted if true | Observed | Verdict |
Toggle Confirmation
fix-applied: PASS | fix-reverted: FAIL (original error reproduced) | re-applied: PASS
(quote each run's key output line)
Change Set
Fix diff summary (files, file:line), regression test path, full-suite result.
Postmortem
The five lines from Phase 5.
=== SELF-REVIEW ===
Score Complete, Robust, Clean 1-5. Complete: all five phases ran or degraded explicitly.
Robust: causation proven by toggle, not asserted from correlation. Clean: fix is minimal
and the tree contains no leftover experiment edits (verify with git status). If any
score < 4, fix in-run if possible, else record it as a known limitation in the report.
=== LEARNINGS CAPTURE ===
Append to ~/.claude/skills/root-cause/LEARNINGS.md: date + project + bug one-liner, what
worked, what was awkward (probes that were not actually discriminating, toggle hazards),
suggested patch to this skill, verdict [Smooth | Minor friction | Major friction].
=== STRICT RULES ===
- Never propose a fix before at least one discriminating probe has run.
- Never trust a reported error you have not reproduced or seen in raw logs yourself.
- Never write a probe whose outcome would be identical whether the hypothesis is true or
false. - Never declare root cause without the toggle confirmation (or an explicitly labeled
SIMULATED substitute). - Never bundle refactors or unrelated cleanups into the fix.
- Never skip the regression test's fail-on-old-code verification.
- Never leave experimental instrumentation or toggle edits in the final tree.
- Always deliver the five-line postmortem, even for UNRESOLVED runs (Prevention becomes
"next probe to run").
Security
Reviews (0)
Related skills
Browse all →More from Skills Hub
View source →More QA skills
Browse category →Frequently asked questions about root-cause
What does the root-cause skill do?
Hypothesis-driven debugging that ends at a proven root cause, not a symptom patch. Triggers: you say "debug this", "find the root cause", "why is this failing", "this bug keeps coming back", "the fix didn't stick". It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the root-cause skill?
Run `npx @skills-hub-ai/cli install root-cause` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/root-cause/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does root-cause work with?
root-cause runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the root-cause skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use root-cause after installing it?
In Claude Code, type `/root-cause` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the root-cause skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.