agents/skills/rereview-loop/SKILL.md
Iteratively run /rereview, fix the findings, and loop until reviewers approve clean. Use for iterative automated review, when you want /rereview to loop until clean, or for a paranoid pre-merge review that auto-addresses every blocker.
npx skillsauth add drn/dots rereview-loopInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Run /rereview repeatedly: review → fix the findings → re-review → repeat. Stop when all three reviewers approve with zero BLOCKING and zero WARNING findings, when the iteration cap is hit, or when an iteration makes no progress.
$ARGUMENTS - Optional. Forms:
<branch-or-range> - passed through to /rereview as its scopemax=<N> - cap the number of review→fix iterations (default 5)severity=blocking - only auto-fix BLOCKING findings (default fixes BLOCKING + WARNING)severity=all - auto-fix BLOCKING + WARNING + INFO/rereview-loop max=3 severity=blockinggit branch --show-currentgit branch -r 2>/dev/null | grep -oE 'origin/(main|master)' | head -1git status --shortgit log origin/main..HEAD --oneline 2>/dev/null | head -20git log origin/master..HEAD --oneline 2>/dev/null | head -20You are the lead coordinator for an iterative re-review loop. Your job is to drive findings to zero by alternating between review (delegated to /rereview) and fixes (applied here).
Core principle: trust the reviewers. Fix what they flag, do not argue with the verdict to escape the loop. The loop exits when reviewers say it's clean -- not when you decide it's clean.
Hard rules:
Parse $ARGUMENTS:
max_iterations = 5 (override with max=<N>)
severity_filter = "blocking+warning" (override with severity=blocking | severity=all)
rereview_scope = "" (any non-key=value token; passed to /rereview verbatim)
iteration = 0
prior_blocking_count = -1 (B count from previous iteration; -1 = no prior)
prior_warning_count = -1 (W count from previous iteration; -1 = no prior)
prior_info_count = -1 (I count from previous iteration; -1 = no prior)
last_iteration_committed = false (did the previous iteration produce a commit?)
total_pushbacks = 0 (cumulative pushbacks across all iterations)
total_findings_addressed = 0 (cumulative findings touched, for the pushback rate)
stashed = false (set true if Phase 0 stashes unrelated work)
Preflight:
Detached HEAD guard. Run git symbolic-ref --short HEAD (or git branch --show-current). If empty, exit immediately: "Cannot run /rereview-loop in detached HEAD state -- check out a named branch first." Do not proceed.
No-changes guard. If there are no commits ahead of the base branch and no uncommitted changes, tell the user "Nothing to re-review -- branch has no changes vs base." and stop.
Stash unrelated work. If git status --short shows uncommitted changes that are NOT part of the work being reviewed (i.e., the user has unrelated dirty files), run git stash push -u -m "rereview-loop pre-loop" and set stashed = true. Tell the user you stashed. The stash MUST be popped on every exit path -- see Phase 4 and the failure-handling table.
Announce the run:
## Re-review loop starting
**Scope:** {rereview_scope or "current branch vs default"}
**Max iterations:** {max_iterations}
**Auto-fix severity:** {severity_filter}
Invoke the /rereview skill via the Skill tool, passing rereview_scope as its argument (empty string if no scope was given). Wait for it to complete and capture the full final report.
/rereview will:
You will receive a markdown report with: a final verdict, a per-reviewer agreement table, and consolidated lists of Blocking Issues, Warnings, Suggestions, Disagreements, and Missing Test Coverage.
If /rereview reports "no changes to review," the loop is trivially clean -- exit with the success summary in Phase 4.
Read the final verdict and the agreement table. Record this iteration's B (blocking), W (warning), and I (info) counts from the consolidated report.
The exit condition depends on severity_filter:
| severity_filter | "Clean" means |
|-----------------------|------------------------|
| blocking | B == 0 |
| blocking+warning | B == 0 AND W == 0 |
| all | B == 0 AND W == 0 AND I == 0 |
IF this iteration's counts meet the "clean" condition for severity_filter:
→ EXIT. Go to Phase 4 with status = CLEAN.
(If severity_filter == "blocking" and W > 0, status = APPROVED_WITH_WARNINGS_IGNORED.)
IF iteration >= max_iterations:
→ EXIT (cap hit). Go to Phase 4 with status = MAX_ITERATIONS.
OTHERWISE:
→ Continue to Phase 3 to address findings.
After Phase 3 commits the iteration's fixes, the next iteration's Phase 2 must check whether progress was actually made. Use a hard counter, not a paraphrased-text signature:
IF iteration > 0 AND last_iteration_committed == true AND
B >= prior_blocking_count AND
W >= prior_warning_count AND
I >= prior_info_count:
→ Apparent no-progress. The fix did not reduce the finding counts.
Re-read the report carefully:
- If the SAME items are flagged at the SAME file:line, try a
different approach to those specific findings in this iteration.
- If this is the second consecutive iteration with no progress,
EXIT with status = STUCK after applying best-effort fixes once more.
IF iteration > 0 AND last_iteration_committed == false:
→ The previous iteration applied no fixes (everything was pushed back
or deferred). Counts may legitimately be unchanged. Do NOT treat as
stuck on this basis alone -- continue with the loop.
Save the current B/W/I counts as prior_blocking_count, prior_warning_count, prior_info_count for the next iteration's comparison. Reset last_iteration_committed to false -- Phase 3 sets it back to true if a commit lands.
Build the worklist from the consolidated report based on severity_filter:
| severity_filter | Includes |
|-----------------------|-----------------------------------|
| blocking | BLOCKING only |
| blocking+warning | BLOCKING + WARNING (default) |
| all | BLOCKING + WARNING + INFO |
Always include items in this order: BLOCKING first, then WARNING, then INFO. Within a tier, group by file so related fixes can share a single read of that file.
For each finding:
Read the cited file fully (and any caller/dependent the reviewers referenced). Do not work from the snippet alone.
Classify the finding into one of three buckets:
(a) Apply the fix. The reviewer is correct. Make the minimal code change that resolves the issue. If the fix changes behavior, add or update a test that covers the new behavior. If the finding is "missing test coverage," add the test.
(b) Push back with a recorded justification. The reviewer is wrong, or the change conflicts with intentional design. This is a high bar. Document:
Track pushbacks at two levels:
total_pushbacks and total_findings_addressed after each finding is processed. If total_pushbacks / total_findings_addressed > 0.25 once at least 4 findings have been processed total, STOP and ask the user. Per-iteration framing alone allows systematic 1-of-4 pushbacks to compound to 100% across iterations without ever tripping a single-iteration ceiling.Pushing back on a quarter of an independent panel's findings -- in any single iteration or cumulatively -- usually means you're rationalizing rather than reviewing.
(c) Defer to user. The finding requires a product decision, scope expansion, or knowledge you don't have (e.g., "the new SLA isn't documented"). Do NOT silently skip. Surface it in the iteration summary and continue. The loop will likely re-flag it next iteration; that is correct behavior.
After all findings in this iteration are processed:
/rereview detected).Commit the iteration's fixes as a single commit per iteration. List the changed paths explicitly -- never use git add -A (the Phase 0 stash already moved unrelated work aside, but explicit paths are still the safe default):
git add path/to/changed-file-1 path/to/changed-file-2 ...
git commit -m "rereview-loop iter {N}: address {M} findings
{bulleted list of finding summaries with file:line, prefixed by [BLOCKING] / [WARNING] / [INFO]}"
Set last_iteration_committed = true once the commit succeeds. If no findings led to code changes in this iteration (everything was pushed back or deferred), do NOT create an empty commit -- leave last_iteration_committed = false.
Heartbeat. Output the per-iteration summary defined below before looping back.
Increment iteration. Loop back to Phase 1.
## Iteration {N} complete
**Verdict from /rereview:** {verdict}
**Findings this iteration:** {B} blocking, {W} warning, {I} info
**Applied fixes:** {count}
**Pushed back:** {count} this iteration, {total_pushbacks} cumulative ({rate}% of {total_findings_addressed})
**Deferred:** {count}
**Tests after fixes:** {PASS / FAIL}
**Lint after fixes:** {CLEAN / WARNINGS / ERRORS}
Next: running /rereview again (iteration {N+1} of {max_iterations}).
If there are pushback or deferred items, list them under the heartbeat with file:line + one-sentence reason.
Stash pop guard. Every exit path (CLEAN, APPROVED_WITH_WARNINGS_IGNORED, MAX_ITERATIONS, STUCK, ERROR, and any early exit from Phase 0 after the stash was pushed) MUST run git stash pop if stashed == true before printing the final report. The user's unrelated work-in-progress is not the loop's to discard.
If the stash pop reports conflicts, surface them to the user verbatim and stop -- do NOT attempt to resolve unrelated conflicts.
When the loop exits, output:
# Re-review loop finished
**Status:** {CLEAN / APPROVED_WITH_WARNINGS_IGNORED / MAX_ITERATIONS / STUCK}
**Iterations run:** {N} of {max_iterations}
**Total findings addressed:** {count} (B: {x}, W: {y}, I: {z})
**Total findings pushed back:** {count}
**Total findings deferred:** {count}
**Final verdict from /rereview:** {verdict}
**Final regression risk:** {LOW / MEDIUM / HIGH}
## Commits added by this loop
{git log --oneline of commits made during the loop}
## Outstanding items (deferred or pushed back)
{numbered list, or "None."}
## Recommendation
{One of:
- "Clean — safe to push and merge."
- "Warnings remain (ignored per `severity=blocking`). Review the warnings list before merging."
- "Iteration cap hit with findings still open. Re-run /rereview-loop, raise max=, or address remaining items manually."
- "Loop is stuck — reviewers re-flagged the same findings after a fix attempt. Manual investigation needed."}
Do NOT push the branch. Do NOT open or update a PR. The loop's job is to drive findings to zero locally; merging is the user's decision.
| Failure | Action |
|---------|--------|
| /rereview errors out or returns no report | Retry once. If still failing, exit with status = ERROR and surface the message. |
| Test suite breaks mid-loop and you can't fix it | Stop. Do NOT commit broken tests. Report the failing test and last attempted fix. |
| A finding is unclear or contradictory across reviewers | Apply the most conservative interpretation. Note the ambiguity in the iteration heartbeat. |
| Same findings re-appear after a fix attempt (stuck) | One more attempt with a different approach, then exit with status = STUCK and surface the diff of the failed fix. |
| Reviewers disagree sharply (e.g., one APPROVE, one REJECT) | Trust the strictest. Address the REJECT findings in this iteration. |
| User has uncommitted unrelated changes | Stash them up front in Phase 0 (git stash push -u -m "rereview-loop pre-loop") and pop on every exit path -- see Phase 4's stash-pop guard. |
git log shows exactly what the loop changed and why./pr after a clean exit.development
Walk every unresolved review thread on a PR, triage each one, reply with a rationale of whether or not the comment will be acted upon, make the code change if warranted, and mark the thread resolved. Use when the user asks to address only the open PR comments without re-running CI, respond to review feedback, resolve review threads, or clear bot comments on a PR.
development
Generate self-contained HTML visualizations with Plannotator theming. Use for implementation plans, PR explainers, architecture diagrams, data tables, slide decks, and any visual explanation of technical concepts. Plans and PR explainers follow Plannotator's prescriptive approach; all other visual content delegates to nicobailon/visual-explainer.
development
Create reviewed Codex goal setup packages for long-running /goal work. Use when the user wants to turn an idea, backlog, project mission, or vague objective into durable goal files under a project goals slug folder, with Plannotator review gates for brief, narrative plan with acceptance criteria, verification, blockers, and the final /goal prompt.
development
Open Plannotator's browser-based code review UI for the current worktree or a pull request URL, then act on the feedback that comes back.