agentleFS
DeevsDeevsDeevsDeevs/agent-system/skills/diagnose/SKILL.md

diagnose

Skill41 starsChanged 7 days agoApache-2.0View on GitHub

Disciplined debugging loop for broken behaviour, failing builds, flaky commands, hung processes or regressions. Use when asked to debug or find a root cause.

193 other projects use a version of this.

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 61 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 56 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 53 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

  • 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 44 projects that use this

  • AnasX7Skill

    setup-pre-commit

    Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.

    Also in 27 projects that use this

  • +4 more from simo97

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 174 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use when correctness is uncertain.

    line 8
  2. Distinctive:

    If the report is vague, ask for the missing observable (exact command, stack trace, id, log path, repro steps).

    line 18
  3. Distinctive:

    Do not proceed until the loop reproduces the bug or proves more evidence is needed.

    line 32
  4. Very specific:

    Remove [DEBUG-...] probes and throwaway harnesses, stop unneeded background processes, reference useful artifacts by id/path.

    line 62
  5. Distinctive:

    No patching before reproducing unless the user explicitly accepts a speculative fix.

    line 66
  6. Distinctive:

    No whole-workspace runs when a package-level loop proves the symptom.

    line 67

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

Use when correctness is uncertain. Do not patch from vibes: make the bug observable, prove the cause, fix the smallest thing, verify against the original symptom. Use the target repo's native build/test/runtime commands as the evidence loop.

1. Define the symptom

Expected: ...
Actual: ...
Observed in: command/log/file/process id/agent id/artifact id

If the report is vague, ask for the missing observable (exact command, stack trace, id, log path, repro steps). Do not chase unrelated warnings until they connect to this symptom.

2. Orient just enough

Identify only the smallest relevant area: repo root/cwd, package/crate/service, entrypoint triggering the symptom, closest test/fixture/log source, and expensive commands to avoid. Never map the whole codebase.

3. Build the feedback loop

Find the fastest deterministic loop that reaches the bug, e.g. cargo test -p <crate> <filter> -- --nocapture, a focused unit test, a CLI run on fixture input, a request script against a dev server, a replay of a captured event, or a small throwaway harness when no seam exists.

  • Slow repro loops and servers: run them in hc (hc run --bg, then hc wait or hc wait --output <ready line>; see the hc skill) — never &, nohup, disown, setsid.
  • Subagents only for independent investigation, tightly scoped with cwd and exact files; continue other runnable probes while it runs; its report arrives by itself.
  • For long diagnoses, save a chain link (chains skill) with the symptom, repro command, hypotheses tested, files touched, ids, and next step.

Do not proceed until the loop reproduces the bug or proves more evidence is needed.

4. Reproduce and minimize

Confirm the loop matches the user's symptom, not a nearby failure. Then reduce to the smallest file set, command, input, and package, and the shortest log excerpt that proves the problem. For flaky bugs, raise the reproduction rate: repeat, isolate shared state, pin cwd, tune concurrency/stress, record pass/fail counts.

5. Hypothesize before probing

Non-obvious bugs: 3–5 ranked hypotheses before changing code. Obvious ones: state the single likely cause and its confirming check.

Hypothesis: [cause]
Prediction: if true, [specific check] shows [specific result].
Probe: [command/read/log inspection]

"The retry budget is shared across requests; two concurrent fixture calls will exhaust the same counter" is a hypothesis. "State bug" is not.

6. Probe narrowly

One hypothesis, one variable per probe. Prefer existing logs/tests/traces before adding instrumentation; tag any added debug output with a unique marker like [DEBUG-7f3a]; probe decision boundaries, never "log everything". Keep notes: hypothesis → probe → result → next.

Rust probes: RUST_BACKTRACE=1, targeted RUST_LOG=<module>=debug, focused assertions, trait impl/feature-flag/cfg inspection, shared state through Arc/locks/caches/globals, behavior with/without concurrency/retries/timeouts. For performance regressions, measure a baseline (command, input, sample size, variance) before fixing; then bisect or profile.

7. Fix with a regression guard

State the minimal fix and what will prove it. After editing: rerun the minimized loop, the original loop, and the narrowest relevant package checks; add a durable regression check when a good test seam exists — if none does, say so and recommend the smallest future validation improvement.

8. Cleanup and report

Remove [DEBUG-...] probes and throwaway harnesses, stop unneeded background processes, reference useful artifacts by id/path. Report: root cause, fix, verified-by, remaining risk / follow-up.

Pitfalls

  • No patching before reproducing unless the user explicitly accepts a speculative fix.
  • No whole-workspace runs when a package-level loop proves the symptom.
  • A passing narrow check counts only after the original repro also passes.
  • Broad subagent sweeps are not "diagnosis"; bound cwd, files, and tool count.

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.