agentleFS
slowernetslowernet/dietpowers/skills/find-root-cause/SKILL.md

find-root-cause

Skill0 starsChanged 39 days agoMITView on GitHub

Finds a bug's root cause and fixes it once, at the source, with a regression test. Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When you find something worth doing later that this work does not include, add it as an item to .dietpowers/trackers/open-items.md, …

    line 13
  2. Distinctive:

    Read the error and the full stack trace.

    line 19
  3. Distinctive:

    Check what changed — recent commits, new dependencies, config, environment.

    line 21
  4. Distinctive:

    If you are applying a pattern, read the reference implementation completely.

    line 28
  5. Distinctive:

    If it did not work, form a new hypothesis.

    line 35
  6. Very specific:

    Write a failing test that reproduces the bug, before fixing anything.

    line 40
  7. Distinctive:

    Verify: the test passes, nothing else broke, the original symptom is gone.

    line 42
  8. Distinctive:

    If investigation shows the cause is genuinely environmental, timing-dependent, or external, document what you ruled out, add appropriate …

    line 45

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Find Root Cause

Fixes made before the cause is known tend to move a bug rather than remove it, and each one makes the next harder to find. Find the cause, prove it with a failing test, then fix it once, at the source.

Ask your partner one question at a time, in plain text; do not use the AskUserQuestion tool, because some clients show only the tool's question and drop the text around it. Put what your partner needs to answer in the same message: the problem and why it matters, then the options, recommended first, each with a short bold label in words (never numbers or letters) and a one-line reason. End with a line naming those labels in the same order, such as Reply with **new PR**, **straight to main**, or **drop it**., and make the question the last thing in the message, after any tool use. Your partner may answer with an option, their own alternative, a question or an aside. Keep messages short: lead with the decision, then only the detail needed to answer it. Before a stretch of work that takes more than a moment, such as dispatching a reviewer, writing a spec or plan, or fixing findings, say in one line what you are about to do; after your partner answers, say what comes next before starting it.

When you find something worth doing later that this work does not include, add it as an item to .dietpowers/trackers/open-items.md, following ## Open items in ${CLAUDE_PLUGIN_ROOT}/shared/trackers.md, and say so in one line.

Commit your work on the feature branch as you go: the spec and plan may be held back, code never is. If you are on main, master or the plan's Base: branch, first ask once: "I'll create branch <name> for this work. Reply with yes or no." If your partner declines, do no code work until a branch is agreed. Nothing is pushed or merged without asking.

Find the root cause

  1. Read the error and the full stack trace. Note line numbers, paths, and codes. The answer is often already in there.
  2. Reproduce it. Establish the exact steps and whether it happens every time. Not reproducible means gather more data, not guess.
  3. Check what changed — recent commits, new dependencies, config, environment.
  4. In a system with multiple components, instrument every boundary before proposing anything: log what enters each component, what leaves it, and whether config and environment propagated. Run once, then read the evidence to find which layer breaks.
  5. Trace the bad value backward — where it originated, what passed it in — until you reach the source. Fix there, not at the symptom.

Compare against what works

  1. Find similar working code in this codebase.
  2. If you are applying a pattern, read the reference implementation completely. Skimming it produces bugs.
  3. List every difference between the working case and the broken one, however small.

Test one hypothesis

  1. State it plainly: X is the root cause because Y.
  2. Make the smallest change that tests it. One variable at a time.
  3. If it did not work, form a new hypothesis. Do not stack another fix on top of the last one.
  4. Say plainly when you do not understand something rather than proceeding as if you do.

Fix at the source

  1. Write a failing test that reproduces the bug, before fixing anything. If the bug is in the spec rather than the code, invoke the dietpowers:update-spec skill first.
  2. Make one change, at the root cause. No bundled refactoring, no while-I-am-here improvements.
  3. Verify: the test passes, nothing else broke, the original symptom is gone.
  4. Count your failed fixes. At three, stop fixing and question the architecture with your partner. Fixes that each surface a new problem somewhere else mean the design is wrong, not the hypothesis.

If investigation shows the cause is genuinely environmental, timing-dependent, or external, document what you ruled out, add appropriate handling and monitoring, and say so explicitly.

Terminal state: if you are working within another dietpowers skill's steps (dietpowers:execute-plan, dietpowers:adversarial-review, dietpowers:handle-feedback, dietpowers:prove-done), or the plan for this branch still has unticked tasks, return to that skill and continue where it stopped. Otherwise, commit the change and its tests, then invoke the dietpowers:adversarial-review skill on the code.

Depth: root-cause-tracing.md, guards-after-a-fix.md, ${CLAUDE_PLUGIN_ROOT}/shared/condition-based-waiting.md. To find which test creates unwanted files, run ${CLAUDE_SKILL_DIR}/find-polluter.sh from the project root.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.