agentleFS
theishandubeytheishandubey/dotclaude/skills/diagnose/SKILL.md

diagnose

Skill2 starsChanged 16 days agoMITView on GitHub

Use when a bug's cause is not obvious, a failure is intermittent, a test is flaky, or something regressed or got slow.

195 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 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

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. 0 are common, 15 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 178 edited versions we read keep these.

  • 15

    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. Distinctive:

    Run it once and keep the command and its output.

    line 24
  2. Distinctive:

    If no check can be built, stop, list what you tried, and ask for access, a captured artifact or permission to add temporary logging.

    line 25
  3. Distinctive:

    Remove inputs, callers, config and steps one at a time, rerunning after each cut.

    line 29
  4. Distinctive:

    Stop when removing anything else makes the check pass.

    line 30
  5. Distinctive:

    Write three to five candidate causes before testing any.

    line 34
  6. Distinctive:

    Test the one that splits the remaining space most, change one thing per run, and read real state through a debugger or a targeted log.

    line 37
  7. Distinctive:

    Ask "why" until the answer is a wrong decision in the code, not a consequence of an earlier one.

    line 44
  8. Distinctive:

    If it is, the code that broke on it is the cause and handling it there is the fix.

    line 46
  9. Distinctive:

    If it is not, a guard at the crash site hides the bug: find what produced the state.

    line 47
  10. Distinctive:

    Search for the same fault elsewhere and fix every instance.

    line 49
  11. Distinctive:

    When two fixes resting on the same belief have both failed, stop writing fixes.

    line 51
  12. Distinctive:

    Write that belief down in one sentence, find an observation that would differ if it were false, and make it.

    line 52
  13. Distinctive:

    Commit the failing check as a test, when there is a level that exercises the real pattern.

    line 56
  14. Distinctive:

    Delete the tagged logs and any harness.

    line 59
  15. Distinctive:

    Never fix one with a retry, a sleep, a longer timeout or a skip.

    line 70
  16. Very specific:

    Keep one line per step, each with the command and the number it produced: the rate before, each cause and how it was shown, the fix, the …

    line 76

“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

One loop finds most bugs: a command that fails because of this bug, evidence gathered against it, and a fix at the first place things went wrong. Reading code to build a theory before that command exists is the failure this skill prevents.

1. Build a failing check

Find one command that goes red on this bug and will go green once it is fixed. Try these in order and stop at the first that reaches the bug:

  1. A failing test at whatever level reaches it.
  2. A script against the running thing: an HTTP call, a CLI run with a fixture, a headless browser.
  3. A replay of a captured request, payload or log through the code path.
  4. A small harness that calls the suspect code with its dependencies stubbed.
  5. Two runs of the same input (old and new version, two configs) with the outputs diffed, or git bisect run when a good state is known.

The check must assert the symptom the user reported, not "it did not crash". Make it fast and deterministic: narrow the scope, pin the clock, seed randomness, isolate files and network. Run it once and keep the command and its output. If no check can be built, stop, list what you tried, and ask for access, a captured artifact or permission to add temporary logging.

2. Shrink it

Remove inputs, callers, config and steps one at a time, rerunning after each cut. Stop when removing anything else makes the check pass.

3. Rank hypotheses, then test them

Write three to five candidate causes before testing any. Each one states what it predicts: "if X is the cause, changing Y makes the failure disappear". A candidate with no prediction is dropped. Test the one that splits the remaining space most, change one thing per run, and read real state through a debugger or a targeted log. Tag every temporary log line with one unique prefix so a single search removes them all. For a slowdown, measure a baseline and bisect; logs rarely find it.

4. Fix where it first went wrong

The symptom is where a bad state became visible. Ask "why" until the answer is a wrong decision in the code, not a consequence of an earlier one. Then ask whether the state that broke things is allowed to exist. If it is, the code that broke on it is the cause and handling it there is the fix. If it is not, a guard at the crash site hides the bug: find what produced the state. Guards, retries, swallowed errors, clamped values and discarded state are the usual ways a bug gets hidden. Search for the same fault elsewhere and fix every instance.

When two fixes resting on the same belief have both failed, stop writing fixes. Write that belief down in one sentence, find an observation that would differ if it were false, and make it.

5. Land it in order

  1. Commit the failing check as a test, when there is a level that exercises the real pattern; if there is none, say so, because that gap is a finding.
  2. Apply the smallest fix the evidence justifies. Anything added because it "might help" does not ship.
  3. Rerun the test, then the original unshrunk check.
  4. Delete the tagged logs and any harness.
  5. State the cause in the commit message.

Flaky tests

A flake is a real bug in the test, the code or the environment.

  • Measure the failure rate first: run it 50 times alone, then inside the suite, then in parallel, and record failures out of runs.
  • Fails only in the suite: order or shared state. Rerun with the failing order and halve the list of earlier tests until one remains.
  • Fails only in parallel: a shared port, file or database.
  • Fails alone: time, randomness or a race. Vary the timezone, the clock (midnight, month end, DST), CPU load and the temp dir, and see which one moves the rate.
  • Never fix one with a retry, a sleep, a longer timeout or a skip. Waiting is fine only when it waits for the actual condition.
  • Fix one cause, measure again, and look for a second.
  • To claim the rate is below X you need about 3/X clean runs in a row. Ten green runs say little about a 5% flake.

Evidence log

Keep one line per step, each with the command and the number it produced: the rate before, each cause and how it was shown, the fix, the rate after. Replace secrets with <REDACTED> in anything you show. The reply states what was broken, the cause, the fix, and the failing-then-passing output.

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.