test-coverage · sangrokjung — Claude Code command: close test gaps to 80%
test-coverage runs your suite with coverage, lists files under the 80% mark and writes the unit, integration and E2E tests they are missing.
MIT ★ 880 updated 2026-09-03
.claude/commands/test-coverage.mdWhat test-coverage does
The command runs the suite with coverage turned on (npm test --coverage or pnpm test --coverage), then reads coverage/coverage-summary.json and lists every file below 80%. For each one it inspects the branches nothing reaches and writes tests against them.
Generated tests come at three levels: unit tests for functions, integration tests for API routes, E2E for the flows that matter. Error paths get attention too, along with boundary values and empty or null inputs. New tests are run before the report, and you see coverage before and after.
Its tool list is fixed to Bash, Read, Write, Glob and Grep, so it works through the project files directly. The numbers come from coverage/coverage-summary.json; if your runner never wrote that file with --coverage, there is nothing to analyze.
What it helps with
- see per-file coverage from a single test run
- write unit tests for functions nobody exercises
- cover error handling and empty inputs
- compare coverage numbers before and after new tests
- push overall project coverage to 80%
Example prompts for the agent
/test-coverage— run coverage and show me the files under 80%- Use
/test-coverageto add boundary tests around the billing module /test-coveragefor the whole repo, with integration tests for the API
How to install test-coverage
Manually: put the files in place
.claude/commands/test-coverage.mdCall it with /test-coverage. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/test-coverage.mdCall it with /prompts:test-coverage. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/test-coverage.prompt.mdManually: put the files in place
.gemini/commands/test-coverage.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about test-coverage
How do I install test-coverage in Claude Code?
Place the command file at .claude/commands/test-coverage.md inside your project.
What does test-coverage do?
It runs tests with coverage, finds files below 80%, generates the missing tests and verifies they pass.
Which tools does the command have?
Bash, Read, Write, Glob and Grep — enough to run tests, read the report, search the code and save new test files.
Source text
test-coverage.md · MIT
--- description: Analyze test coverage and generate missing tests to reach 80%+ coverage allowed-tools: Bash, Read, Write, Glob, Grep --- # Test Coverage Analyze test coverage and generate missing tests: 1. Run tests with coverage: npm test --coverage or pnpm test --coverage 2. Analyze coverage report (coverage/coverage-summary.json) 3. Identify files below 80% coverage threshold 4. For each under-covered file: - Analyze untested code paths - Generate unit tests for functions - Generate integration tests for APIs - Generate E2E tests for critical flows 5. Verify new tests pass 6. Show before/after coverage metrics 7. Ensure project reaches 80%+ overall coverage Focus on: - Happy path scenarios - Error handling - Edge cases (null, undefined, empty) - Boundary conditions
© sangrokjung · MIT · sangrokjung/claude-forge
Similar slash commands
All slash commands for Testing and QA →test-coverage by other authors comes first.