Skip to content
Back to skills

Find Root Cause

ASecurity

Use when something is broken: a bug, a failing test, a build error, \"it doesn't work\", or a fix that didn't hold. Reproduces the failure, traces it to the line where it starts, proves one cause with one change, fixes every copy, and stops with a report after two failed fixes. Not for checking finished work before saying done (verify-work-done).

  • 145 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added December 1, 2026
ai-agentsgogitapidatabase

Works with

  • api

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Heyvhuang/copybook-skills --skill find-root-cause --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Find Root Cause?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Find Root Cause
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/heyvhuang-find-root-cause/badge)](https://www.skillsdirectory.com/skills/heyvhuang-find-root-cause)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: find-root-cause
description: "Use when something is broken: a bug, a failing test, a build error, \"it doesn't work\", or a fix that didn't hold. Reproduces the failure, traces it to the line where it starts, proves one cause with one change, fixes every copy, and stops with a report after two failed fixes. Not for checking finished work before saying done (verify-work-done)."
license: MIT (see LICENSE)
---

# Find the cause before you fix

A fix you cannot explain is a guess. Work through these steps in order; skip none because the bug looks simple.

## 1. Reproduce it

- Run the user's exact steps, or the failing command, and watch it fail yourself. Save the command.
- Read the whole error: message, stack trace, file and line, exit code. The answer is often there.
- Can't reproduce it? Stop and say what you need (input, environment, logs). Don't fix what you haven't seen fail.
- Fails only sometimes? Run it 10 times and count. Look for timing, order or shared state, not luck.

## 2. Find where it starts

- Check what changed: `git log --oneline -10`, `git diff`, new dependencies, config, environment. If an older commit worked, `git bisect` finds the first bad one.
- Trace backwards from the symptom: which value is wrong here, who passed it, who passed it to them. Keep going until you reach the line that first made it wrong. Fix there, not where it surfaced.
- Several layers (CI to build script to deploy, API to service to database)? Log what enters and leaves each boundary, run once, and read where the data turns bad before you open any one layer.
- Find similar code in the same repo that works and list every difference, however small.

## 3. Prove one cause

- Write it down: "X causes this because Y."
- Test it with the smallest change or a log line, one variable at a time.
- Wrong? Undo that change before you form the next idea. Never stack guesses.
- Don't know? Say "I don't understand X yet" and gather more evidence. Don't dress a guess as a finding.

## 4. Fix it once, everywhere

- First a failing test or a one-off script that shows the bug. Run it and see it fail.
- Fix the cause in one change. Search the repo for the same pattern and fix every copy now, not one per round.
- Touch only code tied to this bug. List other problems you saw; don't fix them.
- Never silence the error (empty catch, skipped test, a looser assertion, a longer timeout) to make it go away.
- Flaky test that waited a fixed time? Wait for the condition itself (the event, the file, the state), not a longer sleep.
- Rerun the failing test, the original steps and the nearby tests. Before saying it's fixed, follow the verify-work-done skill.

## 5. Two failed fixes: stop

If the same bug survives two fixes, stop editing. Undo the failed attempts and report:

- what you tried and what each attempt changed
- what still fails, with the output
- whether the design itself looks wrong (each fix breaks something elsewhere, the fix needs a large rewrite)
- what the user needs to decide

A second model or a fresh session is a good next step here; a third fix in the same session is not.

## When there is no bug in the code

Timeouts from a slow external service, a full disk, a revoked key: say what you checked, handle it in the code (a clear error, a retry with a limit), and log enough to catch it next time.

## Report

Three lines: the cause (file and line), what you changed, and the command that now passes with its output.

Based on obra/superpowers (MIT), rewritten by Copybook.

Files in this skill

  • CHANGES.md619 B
  • LICENSE1 KB
  • SKILL.md3.4 KB
  • example.md1.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.