agentleFS
lynchypinlynchypin/project-onboard/skills/diagnosing-bugs/SKILL.md

diagnosing-bugs

Skill0 starsChanged 3 months agoMITView on GitHub

Diagnosis loop for hard bugs and performance regressions. Use when a wayfinder ticket is typed as 'bug', or the user says 'diagnose'/'debug this', or reports something broken/throwing/failing/slow.

193 other projects use a version of this, 146 of them edited.

Adopted by

Most recently taken up by

Used with

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

  • LesaniSkill

    writing-beats

    Shape an article as a journey of beats, choose-your-own-adventure style. The user picks a starting beat from the raw material, you write only that beat, then offer options for where to pivot next, beat by beat, until the article reaches a natural end. Use when the user has raw material and wants to assemble it as a narrative rather than an argument.

    Also in 58 projects that use this

  • AWSSkill

    to-questionnaire

    Turn a decision you can't fully answer into a questionnaire for someone else to fill in.

    Also in 88 projects that use this

  • LesaniSkill

    writing-shape

    Take a markdown file of raw material and shape it into an article through a conversational session — drafting candidate openings, growing the piece paragraph by paragraph, arguing about format (lists, tables, callouts, quotes) at each step. Use when the user has a pile of notes, fragments, or a rough draft and wants help turning it into something publishable.

    Also in 56 projects that use this

  • AWSSkill

    wizard

    Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.

    Also in 122 projects that use this

  • +1 more from Lesani
  • +2 more from aws

The file

We split this skill into the rules it gives an agent

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

  • 1

    Common

    Most of the 181 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run the loop, confirm it produces the user's exact failure mode.

    line 47
  2. Common:

    Never "log everything and grep"

    line 71
  3. Distinctive:

    Write the regression test before the fix (if a correct seam exists)

    line 81
  4. Distinctive:

    If no correct seam exists for a regression test, that itself is the finding — flag it for architecture improvement (Phase 6).

    line 87
  5. Very specific:

    If the answer is architectural (no good seam, coupling, shallow module), create a new wayfinder ticket pointing to …

    line 101
  6. Distinctive:

    Never skip Phase 1 (the feedback loop) — reading code without a repro is guessing

    line 107
  7. Distinctive:

    Never test multiple hypotheses simultaneously

    line 109
  8. Distinctive:

    Never leave debug instrumentation in committed code

    line 110
  9. Distinctive:

    Never declare "fixed" without re-running the original repro command

    line 111

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

Diagnosing Bugs

A discipline for hard bugs. Skip phases only when explicitly justified.

Phase 1 — Build a feedback loop

This is the skill. If you have a tight pass/fail signal that goes red on the bug, you will find the cause. Without one, no amount of staring at code helps.

Spend disproportionate effort here. Be aggressive. Be creative. Refuse to give up.

Ways to construct a feedback loop (roughly in order of preference):

  1. Failing test (unit, integration, e2e)
  2. Curl / HTTP script against a running dev server
  3. CLI invocation with a fixture input, diffing stdout against known-good
  4. Headless browser script (Playwright/Puppeteer)
  5. Replay a captured trace (network request replayed in isolation)
  6. Throwaway harness (minimal subset of system, mocked deps)
  7. Property / fuzz loop (1000 random inputs for "sometimes wrong" bugs)
  8. Bisection harness (automate git bisect run)
  9. Differential loop (old-version vs new-version, diff outputs)
  10. HITL bash script (last resort — human watches, confirms pass/fail)

Then tighten the loop: make it faster, make the signal sharper (assert the specific symptom), make it more deterministic.

For non-deterministic bugs: raise the reproduction rate (loop 100x, parallelise, add stress). A 50%-flake is debuggable; 1% is not.

Completion criterion: one command that is red-capable, deterministic, fast (seconds), and agent-runnable. You must have already run it at least once and pasted the output.

If you catch yourself reading code to build a theory before this command exists, STOP.

Phase 2 — Reproduce + minimise

Run the loop, confirm it produces the user's exact failure mode. Then shrink the repro to the smallest scenario that still goes red — cut inputs, callers, config, steps one at a time, re-running after each cut.

Done when every remaining element is load-bearing.

Phase 3 — Hypothesise (PAUSE FOR USER)

Generate 3–5 ranked hypotheses before testing any. Each must be falsifiable: "If [X] is the cause, then [action] will make the bug disappear / worse."

Show the ranked list to the user before testing. This is the HITL pause point in the wayfinder flow — the user confirms which hypotheses to test first, or adds their own.

Phase 4 — Instrument

Each probe maps to a specific prediction from Phase 3. Change one variable at a time.

Tool preference:

  1. Debugger / REPL
  2. Targeted logs
  3. Never "log everything and grep"

Tag every debug log with a unique prefix: [DEBUG-a4f2]. This makes cleanup in Phase 6 trivial.

For performance regressions: measure first (baseline timing / profiler / query plan), then bisect.

Phase 5 — Fix + regression test

  1. Write the regression test before the fix (if a correct seam exists)
  2. Watch it fail
  3. Apply the fix
  4. Watch it pass
  5. Re-run the Phase 1 loop to confirm the original repro is green

If no correct seam exists for a regression test, that itself is the finding — flag it for architecture improvement (Phase 6).

Phase 6 — Cleanup + post-mortem

Required:

  • Original repro no longer reproduces
  • Regression test passes (or absence of seam documented)
  • All [DEBUG-...] instrumentation removed (grep the prefix)
  • Throwaway prototypes/harnesses deleted
  • Hypothesis that was correct stated in commit/PR message

Then ask: "What would have prevented this bug?"

If the answer is architectural (no good seam, coupling, shallow module), create a new wayfinder ticket pointing to improve-codebase-architecture for a deepening review.

What this skill must never do

  • Never skip Phase 1 (the feedback loop) — reading code without a repro is guessing
  • Never test multiple hypotheses simultaneously
  • Never leave debug instrumentation in committed code
  • Never declare "fixed" without re-running the original repro command

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.