agentleFS
0x2E0x2E/dev-skills/skills/systematic-debugging/SKILL.md

systematic-debugging

Skill1 starsChanged 5 months agoMITView on GitHub

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

191 other projects use a version of this, 82 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use diagnosing-superpowers, building-chatgpt-apps 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.
  • 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 6 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

  • MorningStar0709Skill

    chinese-git-workflow

    Configure Git for domestic platforms and manage branching strategies suitable for Chinese teams. Use when the user asks to configure remotes, set up SSH, or manage Git workflows for Gitee, Coding, Jihu GitLab, or CNB, including requests like "配置国内 Git", "设置 Gitee 远程仓库", "推荐适合小团队的 Git 流程".

    Also in 4 projects that use this

  • +8 more from mjunaidca

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 173 edited versions we read keep these.

  • 8

    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:

    No automatic fixes: Never implement a fix without the user's explicit approval.

    line 12
  2. Distinctive:

    No fixes without root cause investigation first: If you haven't completed Phase 1, you cannot propose fixes.

    line 13
  3. Distinctive:

    Do not implement any fix yet: After root cause is confirmed, present to the user:

    line 43
  4. Distinctive:

    Wait for the user's explicit approval: Only proceed to Phase 5 after the user says "go ahead", "approved", "implement it", or similar.

    line 49
  5. Distinctive:

    If you catch yourself thinking any of these, stop and return to root cause investigation:

    line 62
  6. Distinctive:

    If systematic investigation reveals the issue is truly environmental, timing-dependent, or external:

    line 80
  7. Distinctive:

    Document what you investigated.

    line 81
  8. Distinctive:

    Add monitoring/logging for future investigation.

    line 83

“Common” is measured: kept by at least 6 in 10 of the 173 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

Find root cause before attempting fixes. Symptom fixes are failure.

Iron Law

  1. No automatic fixes. Never implement a fix without the user's explicit approval.
  2. No fixes without root cause investigation first. If you haven't completed Phase 1, you cannot propose fixes.

The Five Phases

Complete each phase before proceeding to the next.

Phase 1: Root Cause Investigation

  1. Read error messages carefully — stack traces, line numbers, error codes. Don't skip past warnings.
  2. Reproduce consistently — exact steps. If not reproducible, gather more data; don't guess.
  3. Check recent changes — git diff, recent commits, new dependencies, config changes.
  4. Trace data flow — where does the bad value originate? Trace backward through the call stack until you find the source. Fix at source, not at symptom.
  5. Multi-component systems — for each component boundary, add diagnostic instrumentation to log what enters and exits, then run once to see where it breaks.

Phase 2: Pattern Analysis

  1. Find working examples — locate similar working code in the same codebase.
  2. Compare against references — if implementing a pattern, read the reference implementation completely.
  3. Identify differences — list every difference between working and broken, however small.
  4. Understand dependencies — what other components, configs, or assumptions does this depend on?

Phase 3: Hypothesis and Testing

  1. Form a single hypothesis — "I think X is the root cause because Y." Be specific.
  2. Test minimally — smallest possible change, one variable at a time.
  3. Verify — did it work? Yes → Phase 4. No → form NEW hypothesis. Don't pile on more fixes.
  4. When you don't know — say "I don't understand X." Don't pretend.

Phase 4: Present Before Acting

Do not implement any fix yet. After root cause is confirmed, present to the user:

  1. Conclusion — What is the root cause, with clear evidence.
  2. Fix plan — What specific changes will be made, where, and why.
  3. Impact assessment — What else might be affected by this change.

Wait for the user's explicit approval. Only proceed to Phase 5 after the user says "go ahead", "approved", "implement it", or similar.

Phase 5: Implementation (only after user approval)

  1. Create a failing test that reproduces the bug (use the test-driven-development skill for the bug-fix TDD flow).
  2. Implement a single fix — address the root cause, one change at a time. No "while I'm here" extras.
  3. Verify — test passes? No other tests broken? Issue resolved?
  4. If fix doesn't work — stop. Count attempts:
    • < 3: Return to Phase 1 with new information.
    • ≥ 3: STOP. Question the architecture. Each fix revealing new problems in different places signals a fundamental architectural issue. Discuss with the user before attempting more fixes.

Red Flags — Return to Phase 1

If you catch yourself thinking any of these, stop and return to root cause investigation:

  • "Quick fix for now, investigate later" — random fixes create new bugs
  • "Just try changing X and see" — guessing is not debugging
  • "It's probably X, let me fix that" — probability is not root cause
  • "Let me just fix it directly" — never implement a fix without presenting the conclusion and fix plan to the user first
  • "One more fix attempt" (after 2+ failures) — 3+ failures signals an architectural problem, not a debugging one

Gotchas

  • Caching masks the real state. Build caches (Vite/Webpack), module caches (node_modules, __pycache__, .gradle), Docker layers, and browser caches can serve stale code — making a fix look ineffective or a bug appear intermittent. After a fix that "didn't work," rule out a stale cache before forming a new hypothesis.
  • Flaky locally, consistent in CI (or vice versa) usually means a race or an environment delta. Suspect: timing/ordering between tests, different dependency versions, missing env vars, or a test polluter that runs earlier in the CI shard.
  • A green test does not prove the code works. Over-mocked tests assert the mock's behavior, not the system's. A bug can hide behind a passing test — check that the test exercises real behavior.
  • Silent failures are worse than loud ones. Swallowed exceptions, caught-and-ignored promises, and || defaultValue fallthroughs erase the evidence. Re-surface them temporarily to find the source.
  • Log to stderr, not the app logger, when debugging in tests. Application loggers are often muted in test runs; use console.error/stderr so output appears. When a call chain can't be traced by reading code, capture new Error().stack before the operation to name the triggering caller.

When Process Reveals No Root Cause

If systematic investigation reveals the issue is truly environmental, timing-dependent, or external:

  1. Document what you investigated.
  2. Implement appropriate handling (retry, timeout, error message).
  3. Add monitoring/logging for future investigation.

After Debugging

Once the root cause is identified and the fix is verified, return to the workflow step that was interrupted. If debugging was triggered by a subagent failure in executing-plans, re-dispatch the implementer with the root cause analysis to apply the fix. If debugging was triggered by a user directly asking about a bug, report the findings and fix.

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.