agentleFS
oopsla5xxoopsla5xx/oops-skills/.claude/skills/debug/SKILL.md

debug

Skill4 starsChanged 3 months agoMITView on GitHub

Systematic bug investigation workflow. Tool-agnostic but MCP-aware — test cases and MCP tools are evidence sources, not prerequisites. Applies to any stack (frontend, backend, CLI, mobile, distributed systems).

192 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use add-discord, add-slack 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.
  • MicrosoftSkill

    add-discord

    Add Discord bot channel integration via Chat SDK.

    Also in 11 projects that use this

  • MicrosoftSkill

    add-slack

    Add Slack channel integration via Chat SDK.

    Also in 11 projects that use this

  • +10 more from microsoft

The file

Show its rules and text

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 175 edited versions we read keep these.

  • 13

    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 a use case / test case already exists → run it and confirm it fails

    line 51
  2. Distinctive:

    If no test exists → create a minimal reproduction first, then proceed

    line 52
  3. Distinctive:

    If the bug is intermittent → reproduce it at least 3 times before continuing

    line 53
  4. Distinctive:

    Remove unrelated inputs, routes, or modules one by one

    line 62
  5. Distinctive:

    Do not commit to a hypothesis during this step.

    line 90
  6. Distinctive:

    Start with the layer closest to the symptom, then work outward

    line 105
  7. Distinctive:

    Do not move to Fix until all alternatives are eliminated and one hypothesis stands alone.

    line 118
  8. Distinctive:

    If you cannot fill in all three fields, you have not found the root cause yet — return to Observe or Experiment.

    line 131
  9. Distinctive:

    Goal: remove the root cause with the smallest possible change.

    line 135
  10. Distinctive:

    If the fix touches > 3 files, question whether you have correctly identified the root cause

    line 139
  11. Distinctive:

    If there was no test covering this case → add one now (the reproduction from Step 1 becomes the regression test)

    line 140
  12. Distinctive:

    Do not change unrelated behavior

    line 141
  13. Distinctive:

    Only after all checks pass: declare the bug fixed.

    line 156

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

Debug

Debugging is an investigation, not a guessing game. Every step produces evidence that either confirms or eliminates a hypothesis. Do not write a single line of fix code until the root cause is confirmed.


Workflow

Bug report
    │
    ▼
1. REPRODUCE   →  establish ground truth
    │
    ▼
2. REDUCE      →  isolate the minimal case
    │
    ▼
3. OBSERVE     →  collect evidence
    │
    ▼
4. HYPOTHESIZE →  form ranked candidates
    │
    ▼
5. EXPERIMENT  →  eliminate candidates one by one
    │
    ▼
6. ROOT CAUSE  →  confirm with evidence, not intuition
    │
    ▼
7. FIX         →  smallest change that removes the root cause
    │
    ▼
8. VERIFY      →  rerun the original reproduction, confirm clean

Step-by-step

1. Reproduce

Goal: establish a reliable way to trigger the bug before touching any code.

Priority order:

  1. If a use case / test case already exists → run it and confirm it fails
  2. If no test exists → create a minimal reproduction first, then proceed
  3. If the bug is intermittent → reproduce it at least 3 times before continuing

A bug you cannot reproduce reliably is a bug you cannot verify you fixed.

2. Reduce

Goal: strip the reproduction down to the smallest input / fewest steps that still triggers the bug.

Techniques:

  • Remove unrelated inputs, routes, or modules one by one
  • Isolate a single HTTP request, function call, or UI interaction
  • Comment out surrounding code until the bug disappears, then add back the minimum
  • Binary-search the commit history (git bisect) if the regression is recent

A reduced case makes the root cause obvious and the fix precise.

3. Observe

Goal: collect raw evidence without interpretation yet.

Collect what is relevant to the bug's layer:

LayerEvidence sources
UI / browserconsole errors, network tab, DOM state, screenshots, layout
API / HTTPrequest/response payload, status codes, headers, timing
Server / backendapplication logs, stack traces, slow query logs
Datadatabase state before/after, cache contents
Systemmemory usage, CPU, file descriptors, environment variables

Tool-agnostic collection — use whatever is available in the current environment:

  • Playwright MCP, Chrome DevTools MCP, or browser devtools → UI/network evidence
  • Server log tailing, curl, httpie → API evidence
  • Database client, ORM query logging → data evidence
  • console.log / structured logging → runtime state

Do not commit to a hypothesis during this step. Collect first, interpret later.

4. Hypothesize

Goal: form a ranked list of candidate root causes based on the evidence.

Format:

H1 (most likely): [cause] — because [evidence that points here]
H2: [cause] — because [evidence]
H3: [cause] — because [evidence]

Rules:

  • Each hypothesis must be falsifiable (you can design an experiment to disprove it)
  • Start with the layer closest to the symptom, then work outward
  • A hypothesis that cannot be tested is not a hypothesis — it is a guess

5. Experiment

Goal: eliminate hypotheses one by one, starting from H1.

For each hypothesis:

  1. Design the smallest possible experiment that would disprove it
  2. Run it
  3. Record the result — confirmed or eliminated
  4. Move to the next hypothesis

Do not move to Fix until all alternatives are eliminated and one hypothesis stands alone.

6. Root Cause

Goal: state the root cause with supporting evidence, not intuition.

Required format before writing any fix:

Root cause: [precise statement]
Evidence: [the specific observation that confirms it]
Layer: [where in the stack the defect lives]

If you cannot fill in all three fields, you have not found the root cause yet — return to Observe or Experiment.

7. Fix

Goal: remove the root cause with the smallest possible change.

Rules:

  • Fix only the root cause — do not refactor surrounding code unless it is part of the cause
  • If the fix touches > 3 files, question whether you have correctly identified the root cause
  • If there was no test covering this case → add one now (the reproduction from Step 1 becomes the regression test)
  • Do not change unrelated behavior

8. Verify

Goal: confirm the bug is gone and nothing else broke.

Checklist:

[ ] Original reproduction: now passes (or no longer triggers the bug)
[ ] Regression test (if added): green
[ ] Full test suite: green
[ ] Adjacent behavior: manually spot-checked for side effects
[ ] Evidence collected in Step 3: all anomalies are now explained or resolved

Only after all checks pass: declare the bug fixed.


Anti-patterns

Anti-patternWhy it fails
Fix before reproducingYou cannot verify a fix for a bug you cannot trigger
Skip ReduceLarge reproduction hides the real cause; fix is often wrong
Skip HypothesizeRandom code changes waste time and may introduce new bugs
"I think it's probably X" without evidenceIntuition without evidence is noise
Fix symptoms instead of root causeBug comes back
Declare done before verifyingBug ship rate increases

Quick reference

Can I reproduce it?          → No: find reproduction first
Can I reduce it further?     → Yes: keep reducing
Do I have a hypothesis?      → No: observe more
Is my hypothesis falsifiable? → No: rephrase or discard it
Is the root cause confirmed?  → No: experiment more
Is my fix minimal?           → No: trim it
Is the original repro green? → No: you are not done

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.