agentleFS
khuynh22khuynh22/agent-dev-team/skills/systematic-debugging/SKILL.md

systematic-debugging

Skill9 starsChanged 2 months agoMITView on GitHub

Finds the actual cause of a defect by reproducing it, narrowing the search space by bisection, and proving the diagnosis before changing code. Use for a crash, a stack trace, a flaky or intermittently failing suite, or behaviour that differs from expectation and resists an obvious fix. Refuses to change code before the cause is proven.

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

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

  • 0

    Common

    Most of the 177 edited versions we read keep these.

  • 4

    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:

    If it is intermittent, make it deterministic: pin the seed, freeze the clock, force the interleaving, inject the fault, shrink the data.

    line 26
  2. Distinctive:

    If you truly cannot reproduce it, say so explicitly and switch to adding observability so the next occurrence is diagnosable.

    line 30
  3. Distinctive:

    In time: when did it last work? git bisect on a reliable reproduction is the fastest tool available and is chronically underused.

    line 50
  4. Distinctive:

    Every one of these means the bug is still there, in a form that will return later and be harder to find.

    line 85

“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

The expensive failure mode is changing code before understanding the bug. It sometimes makes the symptom go away, which is worse than not fixing it, because now nobody will look again.

No code changes until you can state the cause and predict the fix's effect.

Process

1. Reproduce

A bug you cannot reproduce is a bug you cannot prove you fixed. Get to a single command, or a written sequence of steps, that produces the failure reliably.

If it is intermittent, make it deterministic: pin the seed, freeze the clock, force the interleaving, inject the fault, shrink the data. The work to make it reproducible is almost always less than the work of debugging it while it flickers.

If you truly cannot reproduce it, say so explicitly and switch to adding observability so the next occurrence is diagnosable. That is a legitimate outcome; a speculative fix is not.

2. Read the evidence you already have

The stack trace, the assertion message, the log line, the error text. Read all of it, in order, including the parts that look like boilerplate. The cause chain of an error names the real failure more often than the top message does.

Quote the decisive line. Do not paraphrase an error.

3. State what you expected and what happened

In one sentence each. The gap between them is the search space. Most of the time this step alone reveals a wrong assumption.

4. Narrow

Bisect the space, do not sweep it.

  • In time: when did it last work? git bisect on a reliable reproduction is the fastest tool available and is chronically underused.
  • In the stack: is the input to this layer correct? Check the middle first, then halve again. Three checks beat twenty guesses.
  • In the data: which input triggers it? Shrink the failing case to the smallest one that still fails.
  • In the environment: does it fail in a clean checkout, another machine, another version?

Change one thing at a time. Two changes and you have learned nothing about either.

5. Form a hypothesis that predicts something

A useful hypothesis says: "if this is the cause, then X will be true." Then check X. A hypothesis that explains the failure but predicts nothing new cannot be tested, only believed.

6. Prove it

Confirm the cause before fixing: add a temporary assertion, log the value, break at the line, or construct the input that must fail if you are right.

7. Fix the cause

Then re-run the reproduction. Then run the full suite. Then write the regression test that would have caught this, named after the bug.

Signals you have not found it

  • The fix is a retry, a sleep, a lock added because it helped, or a try/catch around the symptom.
  • You cannot explain why the bug appeared when it did.
  • The fix works but you do not know why.
  • You changed three things and it started working.

Every one of these means the bug is still there, in a form that will return later and be harder to find.

Output

## Diagnosis: <symptom>
- **Reproduction:** <the command or steps>
- **Expected / actual:** <one sentence each>
- **Narrowed by:** <what you bisected and how>
- **Cause:** `path:line` — <the mechanism, not the symptom>
- **Proof:** <what you observed that confirms it>
- **Fix:** <the change>
- **Regression test:** <path, and the run>
- **Why it was not caught:** <the gap>

Red flags

ThoughtReality
"I'll try changing this and see"That is guessing. Narrow first.
"It works now"Why? If you cannot say, it will return.
"It is probably a race"Probably is not a diagnosis. Name the two operations and the order.
"I cannot reproduce it, but I know the fix"You know a fix for a bug you have not seen.
"Adding a delay fixed it"You moved the timing. The race is still there.
"The stack trace is just framework noise"Read it. The cause chain is usually below the noise.
"I'll add a try/catch for now"You have hidden the evidence for the next person, who is you.

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.