From decaf-review
Automated review-fix-recheck loop. Runs code review, triages findings, fixes autonomously via subagent, and re-reviews if substantial changes were made. Iterates until code stabilizes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/decaf-review:auto-reviewThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Automated loop: **review → triage → fix → re-review** until stable.
Automated loop: review → triage → fix → re-review until stable.
/decaf-review:code-review via subagent (context isolation)Parse $ARGUMENTS:
quick, max, or std (default) — passed to /code-review for the first iteration--max-iterations N (default: 3) — hard cap on review-fix cycles--spec <path> — passed through to /code-review/code-reviewiteration = 1, maxIterations from args (default 3)reviewMode from args (default std)codeReviewArgs — the full argument string to pass to /code-review (mode + spec + scope + instructions)*.test.*, *.spec.*, *_test.*, *Tests.*, directories tests, __tests__, testjest.config.*, pytest.ini, *.csproj (test SDK), go.mod, Cargo.toml, etc.dotnet test, go test ./..., npm test, pytest, cargo test)testInfra = { available: true/false, framework: "...", testCommand: "..." }deferSystem## Auto Review Starting
**Mode**: {reviewMode} | **Max iterations**: {maxIterations} | **Test infra**: {Yes (framework) | No}
**Scope**: {scope description}
Starting review-fix loop...
Launch a general-purpose subagent using the Agent tool:
First iteration — use the user's specified mode and scope:
Run the
/decaf-review:code-review {codeReviewArgs}skill using the Skill tool. When complete, report:
- The path of the generated review file
- The verdict (APPROVED or NEEDS_CHANGES)
- The count of findings by severity
Subsequent iterations (iteration > 1) — use quick mode, scoped to modified files:
Run the
/decaf-review:code-review quick {modifiedFileList}skill using the Skill tool. Focus the review on regressions and new issues introduced by the previous round of fixes. When complete, report:
- The path of the generated review file
- The verdict (APPROVED or NEEDS_CHANGES)
- The count of findings by severity
Wait for the subagent to complete.
Report to the user:
### Iteration {N} — Review Complete
**Review file**: {path}
**Findings**: {Critical} 🔴 | {High} 🟠 | {Medium} 🟡 | {Low} 🟢
Triaging findings...
Read the review file produced in Step 2 and build the action plan. This is the planning half of handle-cr auto — lightweight in context since it only reads the review file and applies decision criteria.
3a. Parse findings using the heading pattern:
### #N 🔴|🟠|🟡|🟢 Severity: Title
Extract for each finding:
3b. Identify similar findings — group findings that share the same underlying pattern (e.g., "missing null check", "missing empty collection guard"). Track these groups for batch fixing.
3c. Build action plan — for each finding, determine the planned action:
| Condition | Action |
|---|---|
| Test infra available + behavioral bug + not test file + not cosmetic + confidence ≥ 60 | fixTdd |
| Critical or High severity | fix |
| Medium + confidence ≥ 70 + clear single fix | fix |
| Security finding | fix |
| Multiple findings share same pattern + fix applies uniformly | fixBatch |
| Requires design decisions, spans subsystems, multiple conflicting options | defer |
| Low severity (unless trivially fixable like unused imports) | skip |
| Medium + confidence < 70, or cosmetic/subjective/doc-only | skip |
| Confidence < 50, contradicts conventions, clearly incorrect | dismiss |
Severity thresholds:
| Severity | Default Action | Override |
|---|---|---|
| 🔴 Critical | Always fix | — |
| 🟠 High | Always fix | Skip if confidence < 50 |
| 🟡 Medium | Fix if confidence ≥ 70 | Skip if cosmetic/subjective |
| 🟢 Low | Skip | Fix if trivial (unused imports, etc.) |
3d. Handle deferred findings immediately (in main context, before launching fix subagent):
defer: create a work item now using deferSystemdeferSystem was not detected in Step 1 and this is the first defer: ask the user once which system to use, then reuse for all subsequent defers3e. Decide whether to ask the user:
AskUserQuestion. If all findings resolve cleanly → skip questions and proceed.3f. Present the plan (always, for visibility):
### Iteration {N} — Action Plan
| # | Sev | Title | File | Action | Reason |
|---|-----|-------|------|--------|--------|
| 1 | 🔴 | ... | Foo.cs:42 | Fix (TDD) | Behavioral bug, tests available |
| 2 | 🟠 | ... | Bar.cs:17 | Fix | Security |
| 3 | 🟡 | ... | Baz.cs:99 | Defer | Needs design decision |
| 4 | 🟢 | ... | Qux.cs:12 | Skip | Cosmetic |
**Fix**: X | **Skip**: X | **Defer**: X | **Dismiss**: X
If asking the user (3e), use AskUserQuestion:
question: "Review the plan above. Proceed, or adjust? (e.g., '#3 fix instead of defer', 'skip all Low')"
Wait for response. Apply adjustments if any, then proceed.
If no findings have a fix action → skip Step 4, go to Step 6.
Launch a general-purpose subagent to execute the confirmed plan. Build the subagent prompt with:
Subagent prompt template:
You are executing planned fixes for code review findings.
Review file:
{reviewFilePath}— read this for full finding details (issue description, suggested fix, file/line).Test command:
{testCommand}(or "none — verify compilation only" if unavailable)Planned actions:
# Severity Title File Action {for each finding with a fix action} {If similar groups exist: "Similar groups: Findings #{X}, #{Y}, #{Z} share the same pattern — fix as a batch when processing the first one, then skip the rest."}
Execution rules — process findings in severity order (Critical → Low):
For each finding:
- Read the finding details from the review file
- Execute based on action:
- fixTdd: Write a failing test that exposes the issue → run
{testCommand}→ verify the test FAILS (RED) → implement the fix → run tests → verify all pass (GREEN) → refactor if needed → verify still GREEN- fix: Apply the suggested fix → run
{testCommand}to verify (or verify compilation if no test command)- fixBatch: Apply the fix pattern to all findings in the similar group → verify
- Verify: Run
{testCommand}after each fix. If verification fails:
- Revert the affected files:
git checkout -- <files>- Record as skipped with reason
- Continue to the next finding — do NOT stop
- Report one line per finding:
✅ #N [Title] — fixedor✅ #N [Title] — fixed (TDD)or✅ #N [Title] — fixed (batch, N files)❌ #N [Title] — skipped: {reason}When all findings are processed, report:
- Summary: counts of fixed, fixed (TDD), fixed (batch), skipped (with reasons)
- List of all files modified
Wait for the subagent to complete. Record results.
Report to the user:
### Iteration {N} — Fixes Complete
✅ Fixed: {X} ({Y} TDD) | ⏭️ Skipped: {X} | 📋 Deferred: {X} | 🗑️ Dismissed: {X}
After the fix subagent completes:
git diff --stat to measure total change magnitudeRe-review is warranted if ANY of these are true:
AND iteration < maxIterations.
If re-review is not warranted → go to Step 6.
Otherwise:
iterationmodifiedFileList to the files modified by fixesSubstantial changes detected ({X} fixes, {Y} lines changed). Re-reviewing modified files...## Auto Review Complete
**Iterations**: {N} | **Total findings**: {sum across all iterations}
### Per-Iteration Summary
| Iter | Mode | Findings | Fixed | Skipped | Deferred | Dismissed |
|------|------|----------|-------|---------|----------|-----------|
| 1 | {mode} | {n} | {n} | {n} | {n} | {n} |
| 2 | quick | {n} | {n} | {n} | {n} | {n} |
### Totals
**Fixed**: {X} ({Y} via TDD) | **Skipped**: {X} | **Deferred**: {X} | **Dismissed**: {X}
### Deferred Items
{List deferred findings with work item references, or "None"}
### Remaining (Skipped)
{List skipped findings with reasons, or "None"}
{If maxIterations reached AND last review had fixable findings:
"⚠️ Reached iteration limit ({N}). Consider running another review."}
Clean up: delete any .auto-review-state.json if used.
:shortcode: syntaxquicknpx claudepluginhub alphaleonis/decaf-claude-config --plugin decaf-reviewIterative code review loop that runs multiple rounds of review and auto-fixes, using /deep-review for safe inline fixes and /big-plan for larger changes. Deferred findings can become GitHub issues.
Iteratively reviews code for critical issues with code-reviewer, auto-fixes via fixer agent, verifies tests pass, repeats up to 5 cycles until clean.
Reviews implementation code for bugs, security issues, and quality problems. Creates FIX tasks for blocking issues before merge.