Skip to content
Development
Command

/test-coverage

Analyze test coverage gaps and generate tests for uncovered code paths.

From plugin
rohitg00-claude-code-toolkit
2.5k199 skills138 agents199 commands
Install
$ npx -y skills add rohitg00/awesome-claude-code-toolkit --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/test-coverage

Context preview

What this command does when you run it.

Analyze test coverage gaps and generate tests for uncovered code paths.

Command definition

test-coverage.md

Analyze test coverage gaps and generate tests for uncovered code paths.

Steps

1. Run Coverage Analysis

  • Detect the test framework and run coverage:
  • **JS/TS**: `npx vitest run --coverage` or `npx jest --coverage`
  • **Python**: `pytest --cov=src --cov-report=term-missing`
  • **Go**: `go test -coverprofile=cover.out ./... && go tool cover -func=cover.out`
  • **Rust**: `cargo tarpaulin --out Stdout`

2. Identify Gaps

  • List files below 80% line coverage.
  • For each low-coverage file, identify:
  • Uncovered branches (if/else, switch cases, error paths).
  • Uncovered functions or methods.
  • Edge cases not exercised (null inputs, empty collections, boundary values).

3. Prioritize

  • Rank gaps by risk: business logic > data access > utilities > configuration.
  • Focus on branches where bugs are most likely to hide: error handling, boundary conditions, type coercion.

4. Generate Tests

  • Write tests for the highest-priority uncovered paths.
  • Each test targets a specific uncovered branch or function.
  • Use existing test patterns and conventions from the codebase.
  • Follow the Arrange-Act-Assert structure.

5. Verify

  • Re-run coverage to confirm the gaps are filled.
  • Ensure no existing tests broke.

Rules

  • Do not write tests purely to increase numbers. Every test must assert meaningful behavior.
  • Exclude generated code, type definitions, and configuration from coverage targets.
  • Target 80% line coverage and 75% branch coverage as minimums.
  • If a function is genuinely untestable (e.g., thin wrappers), document why rather than writing a meaningless test.
Read more
Ships withrohitg00-claude-code-toolkit

The most comprehensive toolkit for Claude Code -- 135 agents, 35 curated skills (+400,000 via SkillKit), 42 commands, 176+ plugins, 20 hooks, 15 rules, 7 templates, 15 MCP configs, 26 companion apps, 53 ecosystem entries, and more.

Get the whole plugin