agentleFS
hybridindiehybridindie/comfyui_mcp/.claude/skills/test-hygiene-scanner/SKILL.md

test-hygiene-scanner

Skill2 starsChanged 7 days agoMITView on GitHub

Triage hardcoded dates, AsyncMock misuse, cross-tier truncates, envelope assertions, and singleton leaks in tests.

The file

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 11 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    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 a fixed set of searches over test files, then use judgment only to triage the hits.

    line 19
  2. Distinctive:

    Read: only the file:line hits and enough surrounding lines to classify them.

    line 26
  3. Distinctive:

    Do not read: production source, migrations, or unrelated repositories.

    line 27
  4. Distinctive:

    Emit the report: Do not edit tests unless the caller explicitly asks.

    line 41
  5. Distinctive:

    Use judgment only for:

    line 45
  6. Distinctive:

    Do not add new categories or scan production code.

    line 51
  7. Very specific:

    Use No <category> found. when a search is empty.

    line 77
  8. Distinctive:

    Stop if neither test root exists.

    line 81
  9. Distinctive:

    Do not report production code or non-test files.

    line 82
  10. Distinctive:

    Do not apply fixes without an explicit request.

    line 83
  11. Distinctive:

    Run the five searches exactly once.

    line 87
  12. Distinctive:

    Default: open at most 20 surrounding-line windows.

    line 88

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “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 Hygiene Scanner

<!-- contract: .claude/rules/doctrine/skill-execution.md version: 2.0.0, owner: John D -->

Run a fixed set of searches over test files, then use judgment only to triage the hits. The searches are deterministic; do not invent categories or scan production code.

Inputs

  • Required: the test roots (tests).
  • Read: only the file:line hits and enough surrounding lines to classify them.
  • Do not read: production source, migrations, or unrelated repositories.

Deterministic Steps

  1. Scan once.
    python3 .claude/skills/test-hygiene-scanner/scripts/scan.py \
      tests
    The script owns the categories and regexes; do not run alternate searches.
  2. Triage every hit. For each, open only the surrounding lines and assign:
    • ERROR — definitely wrong for this project.
    • WARNING — may cause flakes or false confidence.
    • CLEAN — the hit is a legitimate fixture or already patched.
  3. Emit the report. Do not edit tests unless the caller explicitly asks.

LLM Judgment

Use judgment only for:

  • distinguishing a real violation from a legitimate fixture;
  • writing a concrete replacement;
  • deciding whether a hit is ERROR vs WARNING.

Do not add new categories or scan production code. If a test hit reveals a production defect, add a one-line out-of-scope note; do not expand the scan.

Output

## Test Hygiene Report

### Hardcoded Dates
- ERROR|WARNING `<file>:<line>` — <why> — fix: <replacement>

### AsyncMock Misuse
- …

### Cross-Tier Truncates
- …

### Envelope Assertions
- …

### Singleton Leaks
- …

**Clean categories:** <list>

Use No <category> found. when a search is empty.

Stop Conditions

  • Stop if neither test root exists; report the missing path.
  • Do not report production code or non-test files.
  • Do not apply fixes without an explicit request.

Token Budget

  • Run the five searches exactly once; do not re-scan with variations.
  • Default: open at most 20 surrounding-line windows. If there are more hits, triage the highest-severity 20 and report the remaining count as untriaged.
  • Target ≤ 700 words; cite file:line, not full files. Summarize repeated hits.

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.