agentleFS
mariomilemariomile/builder-os/skills/bug-diagnosis/SKILL.md

bug-diagnosis

Skill2 starsChanged 49 days agoMITView on GitHub

Diagnoses a bug before anyone fixes it: a red loop that reproduces it, a minimal case, the cause found by elimination. Use when something is broken, throws, regressed, got slower, fails sometimes, or is reported in production.

7 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use session-handoff.

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.
  • wpankSkill

    session-handoff

    WHAT: Create comprehensive handoff documents that enable fresh AI agents to seamlessly continue work with zero ambiguity. Solves long-running agent context exhaustion problem.

    Also in 3 projects that use this

The file

Files
SKILL.md

Bug Diagnosis

A fix proposed before the bug is reproduced is a guess with a commit attached. Diagnosis turns a report into a red loop (a fast, repeatable signal that fails on this bug and passes when it is gone), shrinks it to a minimal case, finds the cause by elimination, and makes the bug impossible to bring back unnoticed.

Mode. Standalone diagnoses, and fixes when authorized, with no lifecycle state. In the lifecycle, phase 5 calls it for a bug found while building, phase 6 for a problem after exposure, phase 7 when a watch breach looks like a defect; the fix follows phase 5's rules. Both per operating modes.

Procedure

  1. Build the red loop. A failing test, a script, a request, a timing with a threshold: whatever fails fastest on this bug alone. Capture it failing (run-check where commands run). For a production-only bug the loop starts as the narrowest log or trace query that shows it, and reproducing it locally is the next move; a flaky failure gets a loop that repeats until it fails and reports the rate. Done when the loop is captured red.
  2. Shrink it. Strip data, steps, configuration and code paths while the loop stays red. Done when removing anything else turns it green: that is the minimal case, and it often names the cause.
  3. List the hypotheses. Up to three, ranked, each with the observation that would kill it. A recent change counts as a hypothesis with its commit named; git bisect against the loop settles it mechanically. Done when each hypothesis has its killing observation written next to it.
  4. Eliminate one at a time. Add the log line, assertion or timing that tests the top hypothesis, run the loop, cross it out or confirm it. Instrumentation observes; behavior stays as it was until the cause is known. Done when one hypothesis is confirmed by an observation and the instrumentation is removed.
  5. Fix where the bad value is created. The fix turns the minimal loop green with the loop untouched; then the full suite runs. Done when both are captured green.
  6. Close the class. The loop becomes a regression test at the module's seam. A mechanical cause (a banned call, a missing await, a forbidden import) gets the check that catches the whole class, per delivery-discipline → Guardrails. The trap goes into TECH.md → Known traps with the commit. Done when the regression test is in the suite and any new check has run once.
  7. Say it in plain words. Four lines the owner can repeat: what broke and for whom, why, what changed, how we know it will stay fixed. In the lifecycle a production bug also goes into the release or outcome artifact of the initiative that shipped it. Done when those four lines are written.

Watch for

DoInstead of
Red loop first, then shrinkA fix read off the stack trace, where it crashed rather than where it broke
One hypothesis per runFive changes at once, none attributable
Narrow the production signal until it reproduces, or record what is missingClosing as "could not reproduce"
Fix where the bad value is bornA guard clause around the symptom
A check that catches the class, then the trap in TECH.mdA rule about the bug in prose only

Capabilities

CapabilityUsed forFloor if absent
shell.execThe loop, the tests, the instrumented buildWrite the exact commands for the person and wait for their output
repo.readThe code path, recent changesAsk for the relevant files
logs.queryProduction errors, traces, timings around the reportAsk for the error text, time and affected account; tag it [doc:user-…]
analytics.replayWhat the user did before it brokeAsk for the steps
db.queryThe rows in the state that triggers itAsk; read the schema from migrations

Output Contract

## BUG DIAGNOSED with the red loop (captured failing and passing), the minimal case, the hypotheses and which one held, the fix, the regression test and any new check, and the plain-words summary.

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.