agentleFS
malinskibeniaminmalinskibeniamin/skills/diagnosing-bugs/SKILL.md

diagnosing-bugs

Skill4 starsChanged 11 days agoMITView on GitHub

Diagnosis loop for hard bugs and performance regressions. Use when asked to diagnose or debug, or when a hard bug needs a reproducible feedback loop.

193 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use setup-ts-deep-modules, loop-me and 3 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.
  • liufeng1976Skill

    setup-ts-deep-modules

    Wire dependency-cruiser into a TypeScript repo so each package is a deep module — implementation hidden in subfolders, reachable only through its entry-point files. User-invoked.

    Also in 43 projects that use this

  • RoentekSkill

    loop-me

    Grill me about specs for the workflows I want to build, within this workspace.

    Also in 55 projects that use this

  • ryotaroh180105Skill

    claude-handoff

    Hand the current conversation off to a fresh background agent that picks up the work immediately.

    Also in 41 projects that use this

  • simo97Skill

    migrate-to-shoehorn

    Migrate test files from `as` type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace `as` in tests, or needs partial test data.

    Also in 54 projects that use this

  • FabienDehopreSkill

    decision-mapping

    Turn a loose idea into a sequenced map of investigation tickets, then drive them to resolution one at a time.

    Also in 6 projects that use this

The file

We split this skill into the rules it gives an agent

7 rules. 1 is common, 6 are distinctive, and 0 are very specific to this project.

  • 1

    Common

    Most of the 180 edited versions we read keep these.

  • 6

    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 red-capable command, no Phase 2.

    line 50
  2. Distinctive:

    Run the loop; Call the Skill tool with "dogfood" at the reporter's real entrypoint.

    line 54
  3. Distinctive:

    Prefer debugger/REPL. React: inspection.

    line 74
  4. Common:

    Never log everything and grep.

    line 76
  5. Distinctive:

    Write the regression test before the fix at the correct seam.

    line 83
  6. Distinctive:

    Call the Skill tool with "dogfood" for the identical user journey, then re-run the original unminimised Phase 1 loop.

    line 90
  7. Distinctive:

    All debug instrumentation is removed.

    line 97

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

For defects or failed repairs, read Poteto.

Skip a phase only with reason. Use GLOSSARY.md (follow GLOSSARY-MAP.md when present) and ADRs; for third-party, API, or version drift, Call the Skill tool with "read-the-damn-docs" before ranking hypotheses. Other hosts: dependency loading.

Redact

Replace every secret with <REDACTED>. Keep credentials in environment variables; quote only signal-bearing lines. Artifacts may contain auth headers. If redaction hides evidence, ask for a safer source.

Phase 1 -- Build a feedback loop

The feedback loop is the skill. Build a deterministic, agent-runnable pass/fail loop for the exact bug. Read code to construct it, not invent theories.

Strategies, roughly in order

  1. Failing test at the highest seam that reaches the bug: unit, integration, or E2E.
  2. Curl or HTTP script against the running service.
  3. CLI invocation with fixture input and a known-good stdout diff.
  4. Headless browser script that asserts DOM, console, or network behavior.
  5. Captured trace replay: request, payload, event log, or other real artifact.
  6. Throwaway harness: the smallest system slice that reaches the bug with one call.
  7. Property or fuzz loop for intermittent wrong output.
  8. Bisection harness suitable for git bisect run.
  9. Differential loop comparing old/new versions or configurations on the same input.
  10. HITL script from scripts/hitl-loop.template.sh only when a human must act.

UI content/layout failures: Call the Skill tool with "break-ui" for schema-valid fixtures. Pin the failing fixture through the real component into this loop; retain original input for post-fix replay.

Tighten the loop

  • Cache setup; skip unrelated initialization.
  • Assert the exact symptom, not just "did not crash."
  • Pin time, seeds, filesystem state and network inputs.

For nondeterministic bugs, raise the reproduction rate: repeat under controlled stress, parallelize, and narrow timing windows until the rate distinguishes hypotheses.

Without a loop, stop, list attempts, and request the missing environment, redacted artifact, or safe temporary instrumentation permission.

Completion criterion: a tight loop that goes red

Name one command already run at least once, with redacted invocation and output:

  • Red-capable: drives the actual path and asserts the user's exact symptom.
  • Deterministic: returns the same verdict, or a pinned high reproduction rate.
  • Fast: seconds rather than minutes.
  • Agent-runnable: unattended, except through the structured HITL script.

No red-capable command, no Phase 2.

Phase 2 -- Reproduce + minimise

For stateful bugs, capture the original replay packet before minimization. Run the loop; Call the Skill tool with "dogfood" at the reporter's real entrypoint. Confirm:

  • The loop produces the failure the user described, not a nearby failure.
  • It reproduces across multiple runs, or often enough to debug.
  • It captures the exact symptom Phase 5 must disprove.

Minimise inputs, callers, configuration, data, and steps one at a time; rerun after each cut. Finish when every remaining element is load-bearing: removing any one makes the loop green. Retain this reproduction for the regression test; only then proceed.

Phase 3 -- Hypothesise

Generate 3-5 ranked, falsifiable hypotheses before testing; one hypothesis anchors on the first plausible idea. Each must predict what change makes the symptom disappear or worsen. Show the list so domain knowledge can rerank it, but continue when the user is unavailable. Discard claims without a testable prediction.

Phase 4 -- Instrument

Map each probe to one prediction. Change one variable at a time. Two repairs sharing a premise fail the same gate: return to Phase 3; run Poteto's premise probe before retrying.

  1. Prefer debugger/REPL. React: inspection.
  2. Log only boundaries that distinguish hypotheses.
  3. Never log everything and grep.

Prefix temporary logs, for example [DEBUG-a4f2], so cleanup can grep every match. For performance, establish a measured baseline with a timing harness, profiler, or query plan, then bisect. Measure first, fix second.

Phase 5 -- Fix + regression test

Write the regression test before the fix at the correct seam. It must exercise the real bug pattern and call chain; a nearby shallow unit gives false confidence. If no suitable seam exists, record that architecture gap. Otherwise:

  1. Turn the minimised reproduction into a failing test and observe RED. For forced RED, diff the mutation against a pristine copy; restore before testing the fix.
  2. Apply the smallest root-cause fix and observe GREEN.
  3. Run related checks.
  4. Call the Skill tool with "dogfood" for the identical user journey, then re-run the original unminimised Phase 1 loop.

Phase 6 -- Cleanup

Before declaring done:

  • /dogfood confirms the exact user reproduction no longer fails; the original loop passes.
  • The regression test passes, or the missing seam is documented.
  • All debug instrumentation is removed; grep the unique prefix.
  • Throwaway artifacts are deleted or clearly isolated.
  • The proven root cause is recorded in the commit or PR.

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.