agentleFS
TyrannicAweTyrannicAwe/claude-skills-pack/skills/test-doctor/SKILL.md

test-doctor

Skill0 starsChanged 3 months agoMITView on GitHub

Diagnose failing tests systematically — classify the failure mode, find the true cause with evidence, and fix the code or the test with confidence

3 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions3 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 3

    1. jongio/skills★ 18same name
    2. zerob13/skills★ 7same name
    3. liangmiQwQ/skills★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository2 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 8 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 8

    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:

    Run ONLY the failing test: pytest tests/test_foo.py::test_bar -x -v (or the project's equivalent).

    line 21
  2. Distinctive:

    Run it again in isolation — flaky vs deterministic changes the whole diagnosis.

    line 23
  3. Distinctive:

    Run the whole file — state leakage between tests is a top cause.

    line 24
  4. Distinctive:

    For assertion failures: read the actual value, then read the code path that produced it.

    line 27
  5. Distinctive:

    For exceptions: follow the traceback to the FIRST frame where the error originates, not where it surfaces.

    line 28
  6. Distinctive:

    For timeouts: check for unbounded loops, missing mocks on network calls, or synchronous waits.

    line 29
  7. Distinctive:

    If the test was wrong (stale expectation), update it deliberately and state why.

    line 34
  8. Distinctive:

    If the failure was real: add a regression test that would catch it again.

    line 36
  9. Distinctive:

    Never "fix" a test by disabling it — investigate first, always.

    line 39

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

Test Doctor

Diagnose failing tests like a clinician: classify the failure, gather evidence, find the root cause, fix it, and prove the fix.

Step 1 — Classify the failure mode

ModeSignatureLikely cause
Assertionassertion fails with actual vs expectedlogic bug, changed behavior, wrong expectation
Error/exceptiontest crashes with tracebackunhandled error path, missing import, type mismatch
Timeouttest hangs or exceeds limitblocking call, infinite loop, missing mock, slow I/O
Flakypasses alone, fails in suiteshared state, ordering, timing, random data
Setup/teardownfails before first assertionfixtures, DB state, env vars

Step 2 — Reproduce with evidence

  1. Run ONLY the failing test: pytest tests/test_foo.py::test_bar -x -v (or the project's equivalent).
  2. Capture the full traceback and the diff between actual and expected.
  3. Run it again in isolation — flaky vs deterministic changes the whole diagnosis.
  4. Run the whole file — state leakage between tests is a top cause.

Step 3 — Find the root cause

  • For assertion failures: read the actual value, then read the code path that produced it. The test is usually right — the code is wrong.
  • For exceptions: follow the traceback to the FIRST frame where the error originates, not where it surfaces.
  • For timeouts: check for unbounded loops, missing mocks on network calls, or synchronous waits.
  • For flaky tests: hunt shared mutable state: module-level globals, class-level fixtures, environment variables, DB records, time/random without seeding.

Step 4 — Fix and prove

  1. Fix the root cause, not the symptom — do not delete, skip, or loosen a failing assertion without an explicit reason.
  2. If the test was wrong (stale expectation), update it deliberately and state why.
  3. Re-run the single test, then the full file, then the whole suite.
  4. If the failure was real: add a regression test that would catch it again.

Rules

  • Never "fix" a test by disabling it — investigate first, always.
  • One failing test in a suite is usually a symptom; three in a row usually share one cause — find the shared cause first.

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.