Skip to content
testing

Coverage Gap

Find untested code paths and rank them by risk — churn × complexity × surface area = what to test next.

/coverage-gap

Install this skill

  1. 1. Copy the SKILL.md content (button above)
  2. 2. Create a folder for the skill:
    # Mac/Linux
    mkdir -p ~/.claude/skills/coverage-gap
    
    # Windows (PowerShell)
    mkdir $env:USERPROFILE\.claude\skills\coverage-gap
  3. 3. Save the content as ~/.claude/skills/coverage-gap/SKILL.md
  4. 4. Restart Claude Code (or open a new session)
  5. 5. Type /coverage-gap to invoke it
coveragetestsrisk

/coverage-gap

What to test next, prioritized by risk.

Usage

/coverage-gap # whole project /coverage-gap src/lib/payments/ # scoped /coverage-gap --threshold 80 # only show files below 80% coverage

What it does

  1. Runs your test command with coverage enabled (auto-detects Jest/Vitest/Pytest config)
  2. Parses the coverage report (lcov/json)
  3. Cross-references with git churn — files changed often + low coverage = highest risk
  4. Identifies the specific functions that lack coverage
  5. Suggests which to test FIRST based on:
    • Risk (touches money, auth, DB writes)
    • Churn (changed in last 30 commits)
    • Complexity (cyclomatic > 10)

Output

Top 5 coverage gaps to address: 1. src/lib/payments/refund.ts → calculateRefund() Coverage: 0% · Churn: 8 commits · Risk: HIGH (handles money) Suggest: test edge cases — partial refund, expired window, currency mismatch 2. src/api/auth/reset.ts → POST handler Coverage: 23% · Risk: HIGH (auth) ...

Rules

  • Don't just report numbers — recommend ACTION (which test to write, why)
  • Skip generated files (.next/, dist/)
  • Adapt the test framework suggestion to whatever the project uses
Coverage Gap | MCPFlix