Skip to main content
command CX Codex

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

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/commands/test-coverage.md
Open on GitHub

What 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-coverage to add boundary tests around the billing module
  • /test-coverage for the whole repo, with integration tests for the API

How to install test-coverage

Manually: put the files in place

.claude/commands/test-coverage.md

Call it with /test-coverage. For all projects use ~/.claude/commands/

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.

test-coverage davila7 test-coverage — a Claude Code command that measures code coverage and identifies untested paths. Run it manually with flags like --line, --branch, --function or --report. CX Codex +1 637installs test-coverage-improver OneWave-AI test-coverage-improver — a skill that identifies coverage gaps and generates missing tests for critical code paths. CX Codex +1 312installs svelte-test-coverage davila7 svelte-test-coverage analyzes test coverage in Svelte and SvelteKit projects, flags untested code paths, and builds a prioritized testing plan. CX Codex +1 124installs bun-test-coverage secondsky bun-test-coverage — a skill for Claude Code, Codex, Cursor and other platforms that wires up Bun's built-in coverage reporting: thresholds, reporters, and CI upload steps. Generates coverage/lcov.info ready for Codecov via GitHub Actions. CX Codex +1 424installs test SuperClaude-Org Execute unit, integration, and e2e tests with code coverage analysis and quality reporting. Auto-detects test frameworks and supports watch mode for continuous testing during development. CX Codex +1 ★ 23,950repo stars test-writer rohitg00 test-writer generates unit and integration tests to ensure code coverage. Runs when setting up test suites or filling testing gaps across a project. ★ 2,858repo stars test-architect CloudAI-X test-architect — a Claude Code subagent for test planning, test writing, coverage checks, and flaky-test analysis. Use it when changing features or fixing bugs. CX Codex ★ 1,424repo stars

From the same set44

The whole set →

Project sponsors

Companies that keep this analytics open