Skip to content
/coverageStable

Identifies untested code paths, generates targeted tests for uncovered branches, and tracks coverage toward project goals.

TestingQualityΒ· 2 min read

Quick import: Download the .md file and save it to .claude/commands/ (Claude Code), .cursorrules (Cursor), or paste as a system prompt in ChatGPT, Gemini, or any LLM API.

#What it does

The /coverage skill finds the gaps in your test suite. It identifies untested functions, uncovered branches, and missing edge cases -- then generates targeted tests to close those gaps. It focuses on the code that matters most: business logic, error handling, and security-critical paths.

#How to use

bash
/coverage

Run at the project root for a full analysis. Target a specific file to focus coverage efforts.

bash
/coverage src/lib/billing.ts

#What it checks

  • Function coverage -- Functions and methods that have zero tests
  • Branch coverage -- if/else, switch, and ternary branches that only one side is tested
  • Error paths -- catch blocks and error handlers that are never exercised
  • Edge cases -- Boundary values, empty inputs, null cases, and overflow conditions
  • Critical paths -- Authentication, payment processing, and data validation that require 100% coverage

#Workflow

  1. Measure -- Runs your test suite with coverage instrumentation (Jest, Vitest, c8)
  2. Analyze -- Maps uncovered lines to their logical purpose (business logic vs. boilerplate)
  3. Prioritize -- Ranks uncovered code by risk: security-critical and financial logic first, UI glue last
  4. Generate -- Writes test files targeting the highest-priority gaps
  5. Verify -- Runs the new tests and reports the coverage improvement

#Example

bash
> /coverage src/lib/billing.ts
 
## Coverage Report: billing.ts
 
Current: 64% lines, 45% branches
Target: 100% (financial-critical path)
 
### Uncovered paths
 
| Lines     | Description                    | Priority |
|-----------|-------------------------------|----------|
| 45-52     | Proration calculation          | Critical |
| 78-85     | Currency conversion fallback   | Critical |
| 102-108   | Subscription downgrade logic   | High     |
| 134-136   | Logging helper                 | Low      |
 
### Generated: billing.test.ts (4 new tests)
 
- should calculate proration for mid-cycle upgrade
- should fall back to USD when currency API fails
- should adjust billing date on downgrade
- should handle zero-amount invoices
 
New coverage: 94% lines, 88% branches
Orel OhayonΒ·
View all skills