Claude
Skills
Sign in
Back

remediation-loop

Included with Lifetime
$97 forever

Structured remediation loop for code review findings. After a reviewer agent returns HIGH+ severity findings, dispatch a targeted fix agent, then re-review. Bounded to 2 cycles to prevent infinite loops. Use when code review or verification surfaces issues that need fixing before completion.

AI Agents

What this skill does


# Remediation Loop

When a code review or verification step surfaces findings with severity >= HIGH, run a bounded fix-then-re-review cycle instead of leaving the findings unresolved or asking the user to fix manually.

## When to Use

- A code-reviewer agent returned HIGH or CRITICAL findings
- A verification step found failing tests or integration issues
- A silent-failure scan identified error-handling gaps
- Any quality gate failed with actionable findings

## Protocol

### Step 1 — Assess Findings

Classify each finding:
- **Actionable**: has a clear fix (wrong logic, missing check, broken import)
- **Judgment call**: requires user input (architecture change, scope decision)

If ALL findings are judgment calls, present them to the user. Do not enter remediation.

### Step 2 — Fix (Bounded)

Dispatch a fix agent (or fix directly) scoped to ONLY the actionable findings:

```
Agent: Fix the following review findings. Do not refactor beyond what is needed.

Findings:
1. [file:line] — description from reviewer
2. [file:line] — description from reviewer

Constraints:
- Fix only what is listed. No drive-by improvements.
- Run existing tests after fixing to verify no regressions.
- Report what you changed and test results.
```

### Step 3 — Re-Review

After the fix, dispatch a fresh reviewer (or re-run verification) scoped to the same areas:

```
Agent (read-only): Review ONLY the files touched by the fix.
Confirm whether each original finding is resolved.
Report any new issues introduced by the fix.
```

### Step 4 — Decide

| Re-review result | Action |
|-----------------|--------|
| All findings resolved, no new issues | Exit loop — mark complete |
| New issues found (cycle 1) | Run one more fix + re-review cycle (Step 2-3) |
| New issues found (cycle 2) | **Stop.** Present remaining issues to user. Do not loop further. |
| Original findings NOT resolved | **Stop.** Present to user with evidence of what was tried. |

### Hard Limits

- **Maximum 2 remediation cycles.** Never exceed this. If 2 cycles don't resolve it, the user needs to decide.
- **No scope creep.** Each fix agent is scoped to specific findings. Do not expand scope across cycles.
- **Track what was tried.** When presenting remaining issues to the user, include: original finding, what fix was attempted, why it didn't resolve.

## Anti-Patterns

- Running remediation on LOW/INFO findings (not worth the cost)
- Expanding fix scope beyond the original findings
- Looping more than twice ("if 2 passes didn't fix it, a 3rd won't either")
- Remediating judgment calls without user input
- Skipping the re-review step ("I'm sure the fix is correct")

Related in AI Agents