Catalogue / coverage-gaps
coverage-gaps
MITSignedRanks the most valuable missing tests from coverage.py's coverage.json. Use when the user asks which tests are missing. Not for non-Python code.--- name: coverage-gaps description: Ranks the most valuable missing tests from coverage.py's coverage.json. Use when the user asks which tests are missing. Not for non-Python code. argument-hint: "--input coverage.json --limit N" user-invocable: true metadata: section: python ---
coverage-gaps
Turns an existing coverage.py report into a ranked list of the tests worth writing next.
CANARY: coverage-gaps-loaded-2026-06-04-ea39c2b5-b32fe2b1b5ae5e96
When to load
Load when the question is which coverage gaps to fill first. This is the cheap, line-level pass; once line coverage is healthy and the question is whether tests assert behaviour, use the mutmut-report skill.
Step 1 — Ensure a JSON report exists
The script reads coverage.py's JSON export, not the .coverage database, and exits 2 without it. Regenerate it after a refactor, since old line numbers drift from the source.
coverage json # after `coverage run -m pytest` pytest --cov=PKG --cov-branch --cov-report=json # or in one shot, with branches
Step 2 — Rank the gaps
python3 "${CLAUDE_SKILL_DIR}/scripts/analyze_coverage.py" --input coverage.json --limit 20The JSON carries total_percent_covered, files_with_gaps, and a ranked gaps list with missing_count, percent_covered, missing_branches (populated only with branch coverage), largest_run and missing_runs (inclusive line ranges).
Step 3 — Propose tests
Open the source at each missing_runs range before recommending, because a long run can be a generated block, a __repr__ or an if TYPE_CHECKING: island; rank by what the code does, not by line count. Then report:
- The 2–3 tests worth writing now: which function, which input, which branch.
- Branch gaps in otherwise well-covered files, from
missing_branches. - Low-value gaps (scattered defensive
raiseor logging lines) that can wait
or take # pragma: no cover.
Covered means executed, not asserted, so treat this ranking as the floor.
| File | Size | SHA-256 |
|---|---|---|
| SKILL.md | 2.0 kB | 40ca891174bf |
| SKILVAULT_SOURCE.json | 1.3 kB | 245b9c610cd3 |
| THIRD_PARTY_NOTICES.md | 1.1 kB | 6139d641c9a6 |
| evals/loading_verification.json | 752 B | 1d4c391c865a |
| scripts/analyze_coverage.py | 4.1 kB | 294cd997bcdc |
Published verbatim from the pinned commit. Nothing is rewritten.
| Version | Pinned commit | Signed | |
|---|---|---|---|
| 0.1.0 Current | 47b135f39834 | 2 Dec 2026 |
Locking a skill to one version needs Pro.