beyond-test-coverage
A Claude Code skill that hardens test quality, not coverage — packaged
with the cross-language benchmark that built and validated it. The skill
(test-quality) audits, hardens, or generates
unit tests against a multi-axis quality scorecard. Everything else in this repo
is the experiment that derived that scorecard and proved the approach beats
human-written suites across nine libraries in three languages.
Install it →
Are LLM-generated tests better than human-written tests?
We need to put numbers to it. Code
coverage is a vanity metric. 100%-covered suites are
routinely brittle, over-mocked, and noisy; coverage tells you a line
ran, not that a test would catch the regression that breaks it.
beyond-test-coverage measures the thing coverage can't: test
quality. Point it at a repository and it regenerates the test suite
from the source through a read → build → evaluate loop, optimizing
for the qualities that make a suite actually load-bearing:
- Anti-fragility — tests that survive a benign refactor. No
asserting on error-message substrings, no recomputing the expected
value with the same code under test, no reaching into private
internals, no
||-joined "passes if any of these" assertions.
- Rigor — assert against known-good fixed values (precomputed
vectors, inline snapshots), cover the boundaries, and exercise real
behavior end-to-end rather than re-deriving it.
- Mocking discipline — zero hand-rolled mocks of the unit under
test. Drive the real thing through framework primitives (supertest,
httptest, fake timers) or real objects; mock only true external
boundaries.
- Reuse & efficiency — fold repetition into table-driven /
parametrized cases instead of copy-paste; fewer lines per test.
- Correctness — every test passes, and every non-obvious assumption
is verified against the real library, not guessed.
- Coverage as a floor, not a target — never regress it, never chase
it.
An evaluate function (the test-quality
scorer) measures each of these axes on the generated suite and on the
original, and reports a win/loss/tie per axis. If the suite hasn't beaten
the baseline — or isn't green — the loop reads, rebuilds, and re-evaluates.
Through that loop the suite improves not just in coverage but in
quality: the result is a test suite that is stronger, more robust,
and less noisy than the surface it replaced.
Does it actually work?
To find out, we took a set of widely-used open-source libraries with
exceptional, maintainer-written test suites, measured their baseline
on every axis, deleted every test, and regenerated the suite from the
source under increasing iteration budgets (a single pass, up to
iterate-until-it-stops-improving) — scoring each generated suite against
the human original. Every round's findings fed back into the prompts and
the scorer, hardening the tool with each pass.
Nine libraries, three languages, the strongest test suites we could find:
| Library | Lang | What it is | Beat the human baseline? |
|---|
pallets/itsdangerous | Python | signing / serialization | ✅ |
encode/httpx | Python | HTTP client | ✅ |
psf/requests | Python | HTTP client | ✅ |
expressjs/express | JS | web framework | ✅ |
auth0/node-jsonwebtoken | JS | JWT | ✅ |
colinhacks/zod | TS | schema validation | ✅ |
go-chi/chi | Go | HTTP router | ✅ |
tidwall/gjson | Go | JSON query | ✅ |
golang-jwt/jwt | Go | JWT | ✅ |
Results
The headline is the gap between chasing coverage and chasing quality.
When the loop was pointed at coverage, the regenerated suites beat the
human baseline on only 2 of 9 runs — they hit coverage parity and
stopped. Re-aimed at the quality scorecard, they won every run:
Regenerated suites that beat the human-written test suite
──────────────────────────────────────────────────────────
Coverage-driven (Python) ██░░░░░░░░ 2 / 9 22%
Quality-driven (Python) ██████████ 9 / 9 100%
Quality-driven (JS / TS) ██████████ 9 / 9 100%
Quality-driven (Go) ██████████ 9 / 9 100%
Across 27 quality-driven runs (9 libraries × 3 iteration budgets),
every one beat its human-written baseline on the auto-countable axes —
9/9 on Python, 18/18 across JS/TS and Go. The wins are consistent and
structural: the generated suites are dramatically more LOC-efficient
than every baseline, carry zero substring-match assertions and no
hand mocks of the code under test, cut private-symbol access sharply
(the coverage-driven arms' 185 total fell to 59 under quality-driven
across the Python matrix — though not to zero), and are more
parametrized than most baselines.
Three honest caveats the numbers also surfaced: