agentleFS
benyoskovitzbenyoskovitz/claude-code-workflow/skills/systematic-debugging/SKILL.md

systematic-debugging

Skill8 starsChanged 49 days agoMITView on GitHub

Use when a bug, test failure, or unexpected behavior resists the first obvious fix, before proposing another one. Enforces root-cause investigation, one hypothesis at a time, and a hard stop after 3 failed fix attempts.

190 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use chinese-code-review, chinese-commit-conventions and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Leodorareluctant259Skill

    chinese-code-review

    中文代码审查规范——在保持专业严谨的同时,用符合国内团队文化的方式给出有效反馈

    Also in 8 projects that use this

  • Leodorareluctant259Skill

    chinese-commit-conventions

    中文 Git 提交规范 — 适配国内团队的 commit message 规范和 changelog 自动化

    Also in 8 projects that use this

  • obraSkill

    diagnosing-superpowers

    Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.

    Also in 20 projects that use this

  • mjunaidcaSkill

    building-chatgpt-apps

    Guides creation of ChatGPT Apps with interactive widgets using OpenAI Apps SDK and MCP servers. Use when building ChatGPT custom apps with visual UI components, embedded widgets, or rich interactive experiences. Covers widget architecture, MCP server setup with FastMCP, response metadata, and Developer Mode configuration. NOT when building standard MCP servers without widgets (use building-mcp-servers skill instead).

    Also in 4 projects that use this

  • mjunaidcaSkill

    building-chat-interfaces

    Build AI chat interfaces with custom backends, authentication, and context injection. Use when integrating chat UI with AI agents, adding auth to chat, injecting user/page context, or implementing httpOnly cookie proxies. Covers ChatKitServer, useChatKit, and MCP auth patterns. NOT when building simple chatbots without persistence or custom agent integration.

    Also in 4 projects that use this

  • +2 more from Leodorareluctant259
  • +5 more from mjunaidca

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 177 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    The rule: no fixes without root-cause investigation first: If you can't explain *why* the bug happens, you're not ready to propose a fix.

    line 14
  2. Distinctive:

    Before proposing ANY fix:

    line 20
  3. Distinctive:

    If a test framework exists, write a failing test that reproduces the bug first (or a one-off repro script if not).

    line 38

“Common” is measured: kept by at least 6 in 10 of the 177 edited versions of this file we could read. “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

/systematic-debugging: root cause before fixes

Random fixes waste time and create new bugs. A quick patch that "seems to work" usually masks the real problem, which comes back later wearing a different symptom.

The rule: no fixes without root-cause investigation first. If you can't explain why the bug happens, you're not ready to propose a fix.

This applies MOST when it's tempting to skip: under time pressure, when the fix "seems obvious," and especially when a previous fix didn't work.

Phase 1: find the root cause

Before proposing ANY fix:

  1. Read the whole error. Full message, full stack trace, exact line numbers. Errors often contain the answer; skimming past them is the #1 source of wasted cycles.
  2. Reproduce it reliably. What exact steps trigger it? Every time, or sometimes? If you can't reproduce it, gather more data. Don't guess.
  3. Check what changed. Recent commits, new dependencies, config edits, environment differences. Most bugs are recent changes wearing a disguise.
  4. Trace the bad value to its source. Where does the wrong data originate? What called this with the bad value? Keep walking up until you find where it first goes wrong. Fix there, not where the error surfaced.

For multi-part systems (hook → script → API, or CI → build → deploy): before proposing anything, add one round of logging at each boundary showing what goes in and what comes out. Run once. The logs tell you which layer breaks; then investigate that layer only. This is faster than guessing at layers.

Phase 2: one hypothesis at a time

  1. State it explicitly: "I think X is the root cause, because Y." Specific, written down, before touching code.
  2. Test it with the smallest possible change. One variable at a time. Never bundle multiple fixes: if it works you won't know which one did it, and if it fails you've added noise.
  3. Verify before stacking. Fix worked? Confirm the original symptom is gone, then move on. Didn't work? Form a NEW hypothesis. Do not pile another fix on top of the failed one.
  4. If you don't understand something, say so. "I don't understand why X happens" followed by more investigation beats a confident guess every time.

Phase 3: fix it properly

  1. If a test framework exists, write a failing test that reproduces the bug first (or a one-off repro script if not). It proves you understand the cause and stops the bug from coming back.
  2. Fix the root cause. One change. No "while I'm here" improvements bundled in.
  3. Confirm: repro now passes, nothing else broke, and the original symptom is actually gone (fresh run, not memory of an earlier run).

The 3-strikes rule

After 3 failed fix attempts, STOP. Do not attempt fix #4.

Three failures means this is probably not a bug hunt anymore. It's a sign the approach or architecture is wrong. Telltales: each fix reveals a new problem somewhere else, or every fix seems to need a big refactor to work.

At that point, step back and raise it with the user: here's what was tried, here's what each attempt revealed, here's why the underlying design (not the code) looks like the problem. That conversation is cheaper than fixes #4 through #9.

Red flags: if you catch yourself thinking any of these, return to Phase 1

  • "Just try changing X and see if it works"
  • "It's probably X, let me fix that" (without evidence)
  • "Quick fix for now, investigate later"
  • "Let me change several things at once and re-run"
  • "One more fix attempt" (when 2+ have already failed)
  • Listing fixes before having traced the data flow

Simple-looking bugs have root causes too, and the process is fast for simple bugs: Phase 1 for a typo-level bug takes a minute. Skipping it only ever saves time on bugs you'd have fixed anyway.

When there's genuinely no root cause

If investigation shows the issue is truly environmental or timing-dependent (flaky network, a race in a third-party service): document what you ruled out, add appropriate handling (retry, timeout, clear error), and add logging so the next occurrence carries evidence. But be honest: most "no root cause" conclusions are incomplete investigation.


Adapted from the systematic-debugging skill in obra/superpowers (MIT, Jesse Vincent), trimmed to about a third of its length and rewritten. This is the one file in this repo that's a derivative work rather than an original implementation of a borrowed idea.

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.