From decaf-review
Run code coverage analysis and review gaps for severity and test suggestions
How this skill is triggered — by the user, by Claude, or both
Slash command
/decaf-review:coverage-reviewThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Run code coverage tools, parse results, and launch a reviewer agent to assess which gaps matter and suggest test improvements.
Run code coverage tools, parse results, and launch a reviewer agent to assess which gaps matter and suggest test improvements.
Parse $ARGUMENTS to determine:
diff (default) or full| Mode | Scope | Use Case |
|---|---|---|
diff (default) | Changed/new code only (git diff HEAD) | PR review, incremental work |
full | All project files | Baseline assessment, release readiness |
Look for a ## Coverage section in the project's CLAUDE.md. Expected format is documented in:
@../../../conventions/coverage-config.md
If no ## Coverage section is found, inform the user with the setup template from the convention file and exit:
No coverage configuration found in CLAUDE.md.
Add a ## Coverage section to your project's CLAUDE.md. See conventions/coverage-config.md for format and examples.
diff mode: Get changed files from git diff HEAD --name-only. These files are the review scope. If no uncommitted changes, fall back to git diff HEAD~1..HEAD --name-only.full mode: All project source files are in scope.path argument is provided, further restrict scope to that path.If scope is empty (no changed files in diff mode), inform the user and exit.
Execute the configured coverage command via Bash. Wait for completion.
# Example: run the command from CLAUDE.md ## Coverage section
<configured command>
If the command fails (non-zero exit), show the error output and exit:
Coverage command failed (exit code N):
<stderr/stdout>
Check that the command in your CLAUDE.md ## Coverage section is correct.
Find the report file(s) at the configured report path using Glob. Read and parse based on format:
Extract <package> -> <class> -> <line> elements. Per-file: line-rate, branch-rate, uncovered line numbers.
Parse SF:, DA:, BRDA:, BRF:, BRH: records. Per-file: line hits, branch hits, uncovered lines.
Extract <file> -> <line> elements. Per-file: covered/uncovered statements and branches.
For diff mode: Filter parsed data to only include files from the changed file list (Step 2). Match by file path suffix since coverage tools may use absolute or project-relative paths.
Extract per-file:
For each file with coverage gaps (below threshold, or with significant uncovered ranges):
Cap at top ~15 files to keep agent context manageable. Summarize the rest as a table:
## Additional Files Below Threshold (not sent to reviewer)
| File | Line % | Branch % | Status |
|------|--------|----------|--------|
| ... | ... | ... | ... |
Launch decaf-review:coverage-reviewer via the Task tool with the following prompt structure:
Review these code coverage gaps for severity and suggest test improvements.
## Project Coverage Summary
- Overall line coverage: XX% (threshold: YY%) — STATUS
- Overall branch coverage: XX% (threshold: YY%) — STATUS
- Files analyzed: N total, M below threshold
## Coverage Gaps (by priority)
### File: `path/to/file.cs` — 45% line, 30% branch
**Uncovered lines 45-62:**
```<language>
<source code of uncovered lines with surrounding context>
Classification: Error handling for payment failures
path/to/other.cs — 70% line, 55% branchUncovered lines 23-30:
<source code>
Classification: Business logic — order state transition
...
<any user-provided instructions from $ARGUMENTS>
**For `full` mode with many gaps** (more than 8 files below threshold): Consider launching 2 `decaf-review:coverage-reviewer` agents in parallel, splitting the file list roughly in half by priority rank. Merge the results.
### Step 7: Generate Report
Create a timestamped report file in `.code-reviews/` at the repo root. Never overwrite existing reviews.
```bash
mkdir -p .code-reviews
FILENAME=".code-reviews/COVERAGE_REVIEW_$(date '+%Y-%m-%d_%H-%M-%S').md"
Report format:
# Coverage Review
**Mode**: diff | **Date**: YYYY-MM-DD
**Scope**: N files analyzed, M below threshold
**Overall**: XX% line (threshold: YY%), XX% branch (threshold: YY%)
## Summary
| Metric | Value | Threshold | Status |
|--------|-------|-----------|--------|
| Line coverage | 72% | 80% | Below |
| Branch coverage | 65% | 70% | Below |
| Changed lines covered | 45/60 (75%) | — | — |
**Verdict**: NEEDS_COVERAGE | ADEQUATE
- **NEEDS_COVERAGE**: Any metric below configured thresholds
- **ADEQUATE**: All metrics at or above thresholds
---
## Gap Findings
### #1 Critical: Uncovered error handling in PaymentProcessor.cs
| | |
|---|---|
| **File** | `src/PaymentProcessor.cs:45-62` |
| **Coverage** | 0% (18 lines) |
| **Category** | error-handling-gap |
**Why it matters:** <agent's severity assessment>
**Suggested tests:**
- <specific test case suggestions from agent>
---
### #2 High: ...
...
---
## Coverage by File
| File | Line % | Branch % | Status | Uncovered Lines |
|------|--------|----------|--------|-----------------|
| `src/PaymentProcessor.cs` | 45% | 30% | Below | 45-62, 78-85 |
| `src/UserAuth.cs` | 70% | 55% | Below | 23-30 |
| `src/Utils.cs` | 95% | 90% | OK | — |
After creating the report file, inform the user:
Coverage review complete: .code-reviews/COVERAGE_REVIEW_2026-02-27_14-30-45.md
/decaf-review:coverage-review # diff mode, changed files
/decaf-review:coverage-review full # Full project coverage
/decaf-review:coverage-review diff src/Payments/ # diff mode, specific path
/decaf-review:coverage-review full focus on error paths # Full mode with instructions
npx claudepluginhub alphaleonis/decaf-claude-config --plugin decaf-reviewAnalyzes coverage reports from Jest/nyc, pytest, Go test, JaCoCo to find untested paths, branch gaps, low-coverage files, and suggest targeted tests.
Queries test coverage in Python, Node.js, Rust, Go projects. Identifies uncovered areas/files, analyzes trends, and generates reports before changes or PRs.
Analyzes Istanbul, c8, lcov coverage reports to identify uncovered lines, branches, functions with risk-weighted gap detection. Use for gap analysis, branch comparisons, test prioritization.