agentleFS
michaelalbermichaelalber/ai-toolkit/skills/evaluate-tests/SKILL.md

evaluate-tests

Skill3 starsChanged 3 months agoMITView on GitHub

Audits existing tests in two modes: (1) test-file quality — grades tests against Beck's behavioral and structure-insensitive criteria, flagging implementation-coupled, fragile, and theater tests with a prioritized rewrite list; (2) TDD compliance — analyzes git history for test-first discipline, producing a 0-25 scorecard with AI anti-pattern findings. Use when auditing inherited suites, checking AI-generated tests before merge, prepping for safe refactoring, or verifying TDD was followed. Not for writing new tests (tdd), or when there are no tests yet.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run this mental test: *if I renamed every private method and field in this class, would this test break?* If yes, it is structure-coupled.

    line 51

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Evaluate Tests

"If tests break when you rename a private method, your tests are describing the solution, not the problem." — Adapted from Kent Beck

Two Modes

ModeInputOutputUse when
1 · Test-file qualitya test file or directoryper-test classification + prioritized rewrite listauditing whether existing tests are behavioral and refactor-safe
2 · TDD compliancegit commit history (+ test/impl files)0–25 compliance scorecard + anti-pattern findingsverifying test-first discipline was actually followed

Pick the mode from the request. Run both for a full audit — Mode 1's findings feed the Behavioral and Coverage categories of Mode 2's scorecard.


Mode 1 — Test-File Quality

What This Skill Evaluates

For each test, assess two properties and one pattern:

1. Behavioral (does the test specify behavior?)

A behavioral test fails when the observable outcome breaks. An implementation-coupled test fails when internals change even if behavior is identical.

SignalBehavioralImplementation-coupled
Assertion targetReturn value, state visible through public API, side effect via public interfaceMock call count (assert_called_with), private field access (_total), internal call order
Refactor sensitivitySurvives extract-method, rename, move-classBreaks on rename even when behavior is unchanged
Failure message"Expected 42, got 0" — points to the what"Expected save() to be called once" — points to the how

2. Structure-insensitive (does the test survive internal refactors?)

Run this mental test: if I renamed every private method and field in this class, would this test break? If yes, it is structure-coupled.

3. Horizontal slice pattern (were tests written without matching implementation?)

Signs in git history: a commit with 3+ test stubs followed by a commit with all implementations. Signs in test file: test methods that assert on code that clearly pre-existed the test (no trace of incremental growth in the test file).

Per-Test Classification

For each test, classify as one of:

ClassDefinitionAction
PASSBehavioral + structure-insensitiveKeep
COUPLEDAsserts on implementation detail (call counts, private state, internal call order)Rewrite: assert on observable outcome instead
FRAGILESurvives behavior changes but breaks on structural refactorsRewrite: remove internal references
THEATERPasses trivially; no assertion or assertion always passesStrengthen or delete

Output Format

## Test Evaluation: [file or suite name]

### Summary
Tests evaluated: N | PASS: N | COUPLED: N | FRAGILE: N | THEATER: N

### Prioritized Rewrite List

| Priority | Test | Class | Reason | Suggested Fix |
|----------|------|-------|--------|---------------|
| 1 | `test_name` | COUPLED | Asserts `repo.save.called` — tests the how, not the what | Assert `repo.find(id) is not None` instead |
| 2 | `test_name` | FRAGILE | Reads `user._email` directly | Assert via `user.get_profile()["email"]` |
| 3 | `test_name` | THEATER | No assertion — only calls the method | Add assertion on return value or observable state |

### Horizontal Slice Signals
[commit evidence or "not detectable from test file alone — run Mode 2 (commit history)"]

Scope (Mode 1)

Pass a single file: evaluate all tests in it. Pass a directory: evaluate the most-changed test files first; ask before evaluating more than 20 tests in one turn.

For concrete rewrite examples by language: see Coupling Patterns.


Mode 2 — TDD Compliance (commit-history audit)

Verifies the discipline was followed, not just that tests exist. Tests written after implementation feel different, test different things, and provide different value than tests written first. This mode detects that from git history and scores it.

Workflow

  1. Gather evidence — chronological git log, test + implementation file contents, coverage report (if available), test-run results.
  2. Analyze commit order — did a failing-test commit precede each implementation commit? Flag commits containing both test and impl ("should be separate") and impl commits with no preceding test.

    CommitTypeTDD compliant?
    abc123TestN/A (first)
    def456ImplYes (test first)
    ghi789BothNo (should be separate)
    jkl012ImplNo (no preceding test)
  3. Analyze test quality — run Mode 1's classification on the changed tests.
  4. Check coverage quality — distinguish real coverage (tests fail when behavior breaks; edge and error paths covered) from theater (passes even with broken behavior; no assertions; happy path only).
  5. Generate the scorecard.

AI Anti-Patterns to Detect

Anti-PatternDetection Signal
Test-After ImplementationBoth test and impl in one commit; no failing-test commit before the impl commit
Over-Mockingassert_called_with(...) on implementation-internal methods
Happy Path OnlyTest inventory missing zero / overflow / invalid-input cases
Assert-Free TestsZero assertion statements in the test body
Implementation Coupling_private_method / _internal_state references in test assertions
Copy-Paste TestsTest names like test_X_1, test_X_2 with only value differences

Compliance Scorecard

## TDD Compliance Scorecard: [repo/branch]
**Period**: [date range] | **Commits analyzed**: N

| Category | Score | Status |
|----------|-------|--------|
| Test-First Development | X/5 | GREEN/YELLOW/RED |
| Behavioral Testing | X/5 | GREEN/YELLOW/RED |
| Minimal Implementation | X/5 | GREEN/YELLOW/RED |
| Refactoring Discipline | X/5 | GREEN/YELLOW/RED |
| Coverage Quality | X/5 | GREEN/YELLOW/RED |
**Overall**: X/25 ([percentage]%)

Anti-patterns: [list or "none"]
Recommendations: Immediate: [...] | Short-term: [...] | Ongoing: [...]

Full scoring methodology: Compliance Scoring. AI-specific anti-pattern catalog: AI Anti-Patterns.

Discipline rules: evidence-based only — never claim compliance without commit-history proof; be constructive (findings drive improvement, not punishment); account for context (legacy code, time pressure, learning curves) before scoring.

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.