agentleFS
ByronFinnByronFinn/dev-skills/skills/debug/SKILL.md

debug

Skill4 starsChanged 3 months agoMITView on GitHub

Root cause analysis and systematic fix. Quick root cause location, then 6-phase systematic loop for bug fixes. Use when errors, crashes, regressions, test failures, anomalous behavior, or the user says 'used to work'. Trigger words: debug, 排查, 报错, 崩溃, 不工作, regression, 以前是好的, broken after update.

144 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use add-ollama-tool, 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-ollama-tool

    Add Ollama MCP server so the container agent can call local models and optionally manage the Ollama model library.

    Also in 6 projects that use this

  • MicrosoftSkill

    add-slack

    Add Slack channel integration via Chat SDK.

    Also in 6 projects that use this

  • sskarzSkill

    add-telegram-swarm

    Add Agent Swarm (Teams) support to Telegram. Each subagent gets its own bot identity in the group. Requires Telegram channel to be set up first (use /add-telegram). Triggers on "agent swarm", "agent teams telegram", "telegram swarm", "bot pool".

    Also in 5 projects that use this

  • +9 more from microsoft

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 127 edited versions we read keep these.

  • 0

    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:

    PRD Traceability: If PRD exists, fill Debugged by in its ## Traceability:

    line 67

“Common” is measured: kept by at least 6 in 10 of the 127 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: Root Cause Analysis and Systematic Fix

🥷 Find root cause before fixing.

Terminology note: debug uses Stage (macro: Stage 0 context / Stage 1 quick-locate / Stage 2 systematic-fix) and Phase (micro: the 6-phase loop inside Stage 2) deliberately, to distinguish quick-locate from systematic-fix. Other skills use Step. This is an intentional divergence, not drift.

Outcome Contract

  • Outcome: Bug fixed with regression test, root cause documented, debug artifacts cleaned
  • Done when: Bug no longer reproduces, regression test passes, instrumentation removed, root cause in commit/PR message
  • Evidence: Reproduction loop passes, test fails on old code/passes on new
  • Output: Root cause, fix, confirmation, test location, regression guard

Process Summary

Stage 0 (Context Setup): Apply the Skill Entry Protocol — it locates and reads CONTEXT.md, ADRs, and PRDs for you. Domain vocabulary helps form accurate hypotheses.

Stage 1 (Quick Locate): Root cause analysis — form 1-2 hypotheses, validate, output one-sentence root cause. If quick validation fails (hypotheses refuted or none explains all symptoms), escalate to Stage 2.

Stage 2 (Systematic Fix): 6-phase loop

  • Phase 1: Build feedback loop — construct deterministic repro (the critical skill)
  • Phase 2: Reproduce — run loop, confirm bug appears (or output a HITL repro guide when the loop can't run autonomously)
  • Phase 3: Hypothesize — generate 3-5 ranked falsifiable predictions
  • Phase 4: Instrument — add targeted logging with persistence + ordering for each prediction
  • Phase 5: Fix + regression test — write test first if correct seam exists
  • Phase 6: Cleanup + retrospective — remove debug logs + DEBUG/ artifacts, document proof

See REFERENCE.md for detailed phases, optional modes (bisect, scope scan), and quality gates.

Optional Modes

Bisect mode: Triggered by "used to work", "broke after update", or user recalls specific good commit/version

Scope scan mode: Triggered after root fix, before declaring done, or user says "check similar areas"

Gotchas

What happenedRule
Fix client pane instead of local paneTrace execution path before touching files
Say "try again" or "I'm confident"Write hypothesis; run instrumentation to prove (anti-pattern #32 — fix without instrumentation)
Instrumentation only to stdout, lost after loopPersist probes to DEBUG/<session>-<n>.log with sequence+timestamp so evidence survives and ordering is analysable (race bugs)
Can't reproduce autonomously, skip reproStop and output a HITL repro guide; wait for the user's report before hypothesizing
MCP not loading, switch tools instead of diagnoseCheck server status, API key, config first
Compile passes but UI looks wrongMove up Runtime Evidence Ladder, verify rendered surface
Fix one instance, ignore siblingsAfter fix, grep pattern and fix or report each instance (anti-pattern #21)
Fix needs >5 filesPause and confirm scope with user

Output (Success)

Root cause:    [what broke, file:line]
Fix:           [what changed, file:line]
Confirmation:  [evidence fix works or test]
Test:          [pass/fail count, regression test location]
Regression:    [test file:line] or [none, reason]
Status:        resolved | resolved with caveats | blocked

Regression guard: For recurrence, fix not complete until regression test exists (fails on old, passes on new), lives in project suite, and commit message explains prevention.

PRD Traceability: If PRD exists, fill Debugged by in its ## Traceability:

- **Debugged by**: `/debug` (<YYYY-MM-DD>) — <one-line root cause + fix summary>

Next: Run /review for non-trivial fixes. For simple fixes with clear regression tests, review is optional.

Output (Handoff — after 3 falsified hypotheses in Stage 2)

Emitted from Stage 2 Phase 4 when 3 hypotheses have been falsified without identifying the cause (see REFERENCE.md §Phase 4).

Symptom: [original error]

Tested hypotheses:
1. [h1] → [test] → [result]
2. [h2] → [test] → [result]
3. [h3] → [test] → [result]

Evidence: [logs, stack traces, repro steps, environment]
Excluded: [ruled out root causes]
Unknown:  [what remains unclear]

Suggested next: [next direction, tools needed, context required]
Status: blocked

Share this handoff with a fresh agent session, or provide additional info and re-run /debug.

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.