Code prompts
Code prompt

Close test coverage gaps from the report

You have a coverage report and want tests written for the files that need them most.

Works best in: Claude

Read {{report: e.g. coverage/coverage-summary.json}} and add tests for the lowest-covered files until each is above {{target}}%.

Process:
1. **Rank** — list the files below the target, sorted by (lines uncovered × import-frequency). Skip generated files, vendored code, and config.
2. **For each file** —
   - Identify the uncovered branches (not just lines)
   - Write tests that exercise actual behavior, not just call coverage. A test that imports a function and asserts nothing doesn't count.
   - Match the project's existing test style (runner, assertion library, fixture conventions)
3. **Don't game the metric** — if a function genuinely shouldn't be tested in isolation (thin wrappers, type-only modules), say so and skip it instead of writing a placeholder.
4. **Run** the suite after each file and report which numbers actually moved.

Hard rule: never add `/* istanbul ignore */` or equivalent just to lift the number.
·Open in·Share
testingcoverageai-agents

More code prompts

All code prompts

Go deeper