agentleFS
Mingz6Mingz6/copilot-dev-os/skills/diagnose/SKILL.md

diagnose

Skill1 starsChanged 35 days agoMITView on GitHub

Structured debugging loop for hard bugs: feedback loop → reproduce → hypothesize → instrument → fix → regression test. Use when: '/diagnose', 'debug this', 'why is this broken', 'this is failing', 'this throws', 'performance regression', 'flaky test', or any bug that isn't immediately obvious.

195 other projects use a version of this, 97 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use zoom-out, to-prd 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.
  • victorgarciaesgiSkill

    zoom-out

    Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.

    Also in 66 projects that use this

  • GoogleSkill

    to-prd

    Turn the current conversation into a PRD and publish it to the project issue tracker — no interview, just synthesis of what you've already discussed.

    Also in 63 projects that use this

  • GoogleSkill

    to-issues

    Break a plan, spec, or PRD into independently-grabbable issues on the project issue tracker using tracer-bullet vertical slices.

    Also in 56 projects that use this

  • simo97Skill

    write-a-skill

    Create new agent skills with proper structure, progressive disclosure, and bundled resources. Use when user wants to create, write, or build a new skill.

    Also in 49 projects that use this

  • simo97Skill

    edit-article

    The user will invoke this skill to help them edit an article.

    Also in 17 projects that use this

  • kennethkeimSkill

    ubiquitous-language

    Extract a DDD-style ubiquitous language glossary from the current conversation, flagging ambiguities and proposing canonical terms. Saves to UBIQUITOUS_LANGUAGE.md. Use when user wants to define domain terms, build a glossary, harden terminology, create a ubiquitous language, or mentions "domain model" or "DDD".

    Also in 17 projects that use this

  • +4 more from simo97
  • +1 more from google

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 178 edited versions we read keep these.

  • 5

    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:

    When exploring the codebase, use the project's domain glossary (CONTEXT.md) to get a clear mental model of the relevant modules.

    line 10
  2. Distinctive:

    Stop and say so. List what you tried.

    line 42
  3. Distinctive:

    Run the loop. Watch the bug appear.

    line 48
  4. Distinctive:

    If you cannot state the prediction, the hypothesis is a vibe — discard or sharpen.

    line 64
  5. Distinctive:

    Never "log everything and grep"

    line 75
  6. Distinctive:

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

    line 83

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

Diagnose

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

When exploring the codebase, use the project's domain glossary (CONTEXT.md) to get a clear mental model of the relevant modules.

Phase 1 — Build a Feedback Loop

This is the skill. Everything else is mechanical. If you have a fast, deterministic, agent-runnable pass/fail signal for the bug, you will find the cause. If you don't have one, no amount of staring at code will save you.

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

Ways to construct one (try in this order):

  1. Failing test at whatever seam reaches the bug — unit, integration, e2e
  2. HTTP script (curl/httpx) against a running dev server
  3. CLI invocation with fixture input, diffing stdout against known-good
  4. Headless browser (Playwright) — drives UI, asserts on DOM/console/network
  5. Replay captured trace — save a real request/payload, replay through code path
  6. Throwaway harness — minimal subset of system exercising the bug path
  7. Property/fuzz loop — for "sometimes wrong output", run 1000 random inputs
  8. Bisection harness — automate git bisect run between known-good and bad states
  9. Differential loop — same input through old vs new version, diff outputs

Iterate on the loop:

  • Can I make it faster? (Cache setup, skip unrelated init, narrow scope)
  • Can I make the signal sharper? (Assert on the specific symptom, not "didn't crash")
  • Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem)

Non-deterministic bugs:

Loop the trigger 100×, parallelize, add stress, narrow timing windows. A 50%-flake is debuggable; 1% is not — keep raising the rate.

When you cannot build a loop:

Stop and say so. List what you tried. Ask the user for: (a) access to the reproducing environment, (b) a captured artifact (HAR, log dump, screen recording), or (c) permission to add temporary instrumentation.

Do not proceed to Phase 2 until you have a loop you believe in.

Phase 2 — Reproduce

Run the loop. Watch the bug appear. Confirm:

  • The loop produces the failure mode the user described — not a different nearby failure
  • The failure is reproducible across multiple runs
  • You captured the exact symptom (error message, wrong output, timing)

Do not proceed until you reproduce.

Phase 3 — Hypothesize

Generate 3–5 ranked hypotheses before testing any of them. Single-hypothesis generation anchors on the first plausible idea.

Each hypothesis must be falsifiable:

Format: "If {X} is the cause, then {action Y} will make the bug disappear / make it worse."

If you cannot state the prediction, the hypothesis is a vibe — discard or sharpen.

Show the ranked list to the user before testing (they often have domain knowledge that re-ranks instantly). Don't block on it — proceed with your ranking if user is AFK.

Phase 4 — Instrument

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

Tool preference:

  1. Debugger / REPL inspection (one breakpoint beats ten logs)
  2. Targeted logs at boundaries that distinguish hypotheses
  3. Never "log everything and grep"

Tag every debug log with a unique prefix: [DEBUG-xxxx]. Cleanup = single grep.

For performance regressions: logs are usually wrong. Establish baseline measurement (timing harness, profiler, query plan), then bisect. Measure first, fix second.

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 feedback loop against the original scenario

Correct seam = test exercises the real bug pattern as it occurs at the call site. If no correct seam exists, note it — the codebase architecture is preventing lockdown. Flag for /flywheel or architecture review.

Phase 6 — Cleanup + Post-mortem

Before declaring done:

  • Original repro no longer reproduces (re-run Phase 1 loop)
  • Regression test passes (or absence of seam documented)
  • All [DEBUG-...] instrumentation removed
  • Throwaway prototypes deleted
  • Hypothesis that was correct is stated in commit message

Then ask: what would have prevented this bug? If the answer involves architectural change, hand off to /flywheel with specifics. Make the recommendation after the fix, not before — you have more information now.

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.