#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
/coverageRun 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 --
catchblocks 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
- Measure -- Runs your test suite with coverage instrumentation (Jest, Vitest, c8)
- Analyze -- Maps uncovered lines to their logical purpose (business logic vs. boilerplate)
- Prioritize -- Ranks uncovered code by risk: security-critical and financial logic first, UI glue last
- Generate -- Writes test files targeting the highest-priority gaps
- 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