agentleFS
stjarnstromstjarnstrom/spec-system/skills/debug/SKILL.md

debug

Skill0 starsChanged 45 days agoMITView on GitHub

Diagnose a bug or a regression from a red feedback loop before any theory: reproduce, minimise, rank hypotheses, instrument, fix with a regression test. Use when something is broken, throws, fails a test, flakes, or got slower; when the user says debug, diagnose, or "why does"; or before proposing any fix.

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

We split this skill into the rules it gives an agent

3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 175 edited versions we read keep these.

  • 2

    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. Very specific:

    Check it against the spec: When the repo has specs/, run node specs/registry.mjs owns on the implicated files and read the statements …

    line 40
  2. Distinctive:

    no statement covers it (unowned code, a seam) → an ordinary bug.

    line 48
  3. Distinctive:

    Three failed fixes means the design is the question: Stop fixing symptoms. Say what the three attempts showed and what structural question …

    line 70

“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

Find the cause before touching the code. Everything else in this skill is mechanical once there is a fast signal that goes red on this bug.

Procedure

  1. Build the feedback loop. One command, run at least once, that goes red on this bug: it asserts the user's exact symptom, gives the same answer every run, finishes in seconds, and needs no human. In rough order of preference:

    • a failing test at the seam that reaches the bug;
    • a script against the running thing (an HTTP call, a CLI run with a fixture, a headless browser step);
    • a replay of a captured input or trace;
    • a throwaway harness around the suspect unit;
    • git bisect run <command> when a known-good commit exists;
    • a differential run, old against new;
    • a script that walks a human through the steps, as a last resort.

    Make it tighter until it is sharp, fast, and deterministic. For a flaky bug, raise the reproduction rate (loop it, add load, pin the seed) until the loop fails often enough to learn from. No loop, no theory: if you cannot build one, say what you tried and ask for what would let you — access, a redacted artefact, permission to instrument. Unattended, that request parks the task.

  2. Reproduce and minimise. Confirm the loop shows the user's failure, not a neighbouring one. Then cut inputs, callers, config, and steps one at a time until every remaining element is needed for the failure.
  3. Check it against the spec. When the repo has specs/, run node specs/registry.mjs owns on the implicated files and read the statements covering this behaviour:
    • a statement says X and the code does Y → a code bug under the pin: fix it, and point the statement's verified-by at the regression test if it lacked evidence;
    • the statement itself is wrong → the fix is an amendment (spec-system:spec-amend), not a code change to match a wrong spec;
    • no statement covers it (unowned code, a seam) → an ordinary bug; behaviour you find that nothing justifies goes on the anomaly list.
  4. Hypothesise. Three to five ranked hypotheses before testing any. Each falsifiable: "if X is the cause, changing Y makes it disappear". Show the ranking; do not wait for a reply to start on the first.
  5. Instrument, one variable at a time. A debugger or a targeted log beats logging everything. Tag every temporary log with one unique prefix ([DEBUG-7f3a]) so cleanup is a single grep. In a system with several components, log what enters and leaves each boundary once, and find the boundary where good input becomes bad output; then trace back up the call chain to where the bad value was born (techniques.md).
  6. Fix at the cause. The regression test comes first, at the correct seam (spec-system:tdd): watch it fail, apply one fix, watch it pass, re-run the original loop and the full suite. No correct seam for the test is itself a finding — report it (spec-system:architecture). Once the cause is fixed, consider guarding the path it travelled (techniques.md, defence in depth).
  7. Three failed fixes means the design is the question. Stop fixing symptoms. Say what the three attempts showed and what structural question they raise. Attended, discuss it; unattended, park the task with that question.
  8. Clean up. The [DEBUG- prefix greps to nothing; harnesses and repro scaffolding are gone or committed as tests; the commit message states the cause that turned out to be true.

Rules

  • Reading code to build a theory before the loop exists is guessing.
  • One change at a time. A second fix stacked on an unverified first one hides which one mattered.
  • "It passes now" without the loop's output from this turn is not a 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.