From decaf-review
Walk through coverage review findings interactively, writing tests for gaps
How this skill is triggered — by the user, by Claude, or both
Slash command
/decaf-review:handle-coverageThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Iterate through coverage gap findings one by one, presenting each grouped issue and waiting for user input before proceeding.
Iterate through coverage gap findings one by one, presenting each grouped issue and waiting for user input before proceeding.
YOU MUST FOLLOW THESE RULES:
MANDATORY STOP: You MUST use AskUserQuestion to present each group and wait for the user's choice BEFORE taking ANY action. Do NOT write tests autonomously.
ONE AT A TIME: Process groups ONE AT A TIME. Never batch multiple groups together. Never present more than one group per response.
NO AUTONOMOUS TESTS: Never write tests without explicit user approval via AskUserQuestion response.
STATE TRACKING: After presenting the summary, write progress state to .code-reviews/.handle-coverage-state.json. Update this file after each group is processed. This enables recovery after context compaction.
Parse $ARGUMENTS to determine severity filter and coverage review file:
Severity filter (first positional argument, optional):
high — only Critical + High findingsmedium — Critical + High + Medium findingsall (default) — all findingsFile (remaining argument, optional):
.code-reviews/COVERAGE_REVIEW_*.md fileIf $ARGUMENTS specifies a file:
Otherwise, find the latest review:
ls .code-reviews/COVERAGE_REVIEW_*.md 2>/dev/null | sort -r | head -1
If no coverage review file exists, inform the user:
No coverage review found. Run
/decaf-review:coverage-reviewfirst to generate one.
Read the coverage review file and extract all findings. Findings are identified by headers matching the pattern:
### #N Severity: Title
Where severity is one of: Critical, High, Medium, Low.
Build a list of findings with:
Filter by severity: Apply the severity filter from arguments. Remove findings below the threshold:
high: Keep only Critical and Highmedium: Keep Critical, High, and Mediumall: Keep everythingCoverage findings are often granular (per-line or per-branch). Walking through each individually would be tedious. After parsing, group findings into logical units:
This means the user answers once per class (or per method cluster in a large class), not once per uncovered line.
Check if .code-reviews/.handle-coverage-state.json exists:
Show the user the overall summary:
## Coverage Review: [filename]
| Severity | Count |
|----------|-------|
| 🔴 Critical | X |
| 🟠 High | X |
| 🟡 Medium | X |
| 🟢 Low | X |
**Total findings:** N (grouped into M logical units)
I'll walk you through each group ONE AT A TIME. For each one, choose an action:
- **Write Tests** — implement suggested test cases
- **Skip**, Dismiss (false positive), Defer (create work item)
Write initial state to .code-reviews/.handle-coverage-state.json:
{
"reviewFile": ".code-reviews/COVERAGE_REVIEW_xxx.md",
"totalFindings": N,
"totalGroups": M,
"currentGroupIndex": 0,
"processed": [],
"actions": { "testsWritten": 0, "skipped": 0, "dismissed": 0, "deferred": 0 },
"deferSystem": null
}
For each group, starting with the highest severity:
5a. Present the group:
## Group #N of M: [Severity Icon] [Title — e.g. "PaymentProcessor error paths"]
**File:** `src/PaymentProcessor.cs`
**Coverage:** 45% line, 30% branch
**Gaps:** 3 findings (lines 45-62, 78-85, 102-110)
**Categories:** error-handling-gap, logic-gap
### Why it matters
[Combined severity assessments from all findings in group]
### Suggested Tests
1. Should_ReturnError_When_PaymentGateway_TimesOut (lines 45-62)
2. Should_RollbackTransaction_On_PartialFailure (lines 78-85)
3. Should_RetryOnTransientError (lines 102-110)
5b. MANDATORY: Present options and wait for user choice.
Always present exactly 4 options in a single flat AskUserQuestion (1 fix + 3 skip):
AskUserQuestion with:
- question: "How would you like to handle this coverage gap?"
- header: "Action"
- options:
- label: "Write Tests", description: "Implement all suggested test cases for this group"
- label: "Skip", description: "Move to next group, no tracking"
- label: "Dismiss", description: "Mark as false positive"
- label: "Defer", description: "Create a work item for later"
5c. Handle the response:
"dismissed".deferSystem is null in state file, ask the user which system to use via AskUserQuestion. Store the choice in state file under "deferSystem".deferSystem from state file.5d. Update state file after each action:
{
"currentGroupIndex": N,
"processed": [..., { "group": N, "findingIds": [1, 3, 5], "action": "testsWritten|skipped|dismissed|deferred|other" }],
"actions": { "testsWritten": X, "skipped": W, "dismissed": D, "deferred": F }
}
For dismissed groups, include reason: { "group": N, "findingIds": [...], "action": "dismissed", "reason": "..." }
For deferred groups, include work item reference: { "group": N, "findingIds": [...], "action": "deferred", "workItem": "..." }
5e. Show progress:
✅ Group #N addressed. (X of M remaining)
5f. Return to 5a for next group. Do NOT batch - present one group, wait, process, repeat.
When all groups are processed or the user stops:
## Coverage Session Complete
| Action | Count |
|--------|-------|
| Tests Written | X |
| Skipped | X |
| Dismissed | X |
| Deferred | X |
### Tests Created
- [List of test files created/modified and what was covered]
### Remaining Gaps
- [List of skipped or unprocessed groups, if any]
- [Deferred items with their work item references]
### Dismissed Findings
- [List of false positives with reasons, if any]
Delete .code-reviews/.handle-coverage-state.json when complete.
If any tests were written during the session:
AskUserQuestion with:
- question: "Run a coverage review on the modified files to verify improved coverage?"
- header: "Re-review"
- options:
- label: "Yes", description: "Run /decaf-review:coverage-review diff on modified files"
- label: "No", description: "Done for now"
If the user chooses "Yes", invoke /decaf-review:coverage-review diff.
Ask whether to delete the coverage review file:
AskUserQuestion with:
- question: "Delete the coverage review file ([filename])?"
- header: "Clean up"
- options:
- label: "Yes", description: "Delete the review file"
- label: "No", description: "Keep the review file"
If the user chooses "Yes", delete the coverage review file.
.code-reviews/.handle-coverage-state.json to resume:shortcode: syntax like :yellow_circle:npx claudepluginhub alphaleonis/decaf-claude-config --plugin decaf-reviewCompute code coverage for active track or module. Targets 95%+ coverage with report and justification for uncovered lines. Complements TDD workflow.
Scouts test coverage gaps, creates test files, continues incomplete suites, tracks persistent coverage using project test config and git analysis.
Surveys test suites across five phases: unit, integration, E2E (browser), fuzz coverage gaps, and test quality. Produces findings and proposes tickets for remediation.