Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

code-review-loop

A Claude Code skill that runs the /code-review skill's multi-agent review pipeline in a loop over a given code scope until no high-confidence (≥80) issues remain — committing after every productive iteration, running a post-loop Opus review, and finishing with a full test suite.

Renamed from simplify-loop. Previously this skill dispatched three hard-coded review agents (reuse, quality, efficiency). It now uses the verbatim /code-review 5-agent + confidence-scoring pipeline, with a hard 80-score cutoff before fixes are applied — fewer iterations but every fix is backed by a CLAUDE.md citation, a verified bug, or a historical precedent.

What it does

  1. Resolves scope from your argument (file, glob, git range, PR number, natural language, or whole repo)
  2. Per iteration, runs the /code-review-style pipeline (see below)
  3. Filters issues by confidence score >= 80 (verbatim from /code-review); below-threshold findings are dropped
  4. Commits after every productive iteration with a structured message
  5. Exits when 2 consecutive iterations produce no changes (min 3 iterations, hard cap 10)
  6. Opus post-loop review — reviews all loop commits for correctness, safety, regressions, with a built-in hallucination self-check
  7. Runs tests — auto-detects pytest / npm test / go test / etc., fixes failures via subagent (cap 3 attempts)
  8. Final report — iterations, commits, review verdict, test result

Installation

Clone into your Claude Code user skills directory:

git clone https://github.com/Poxagronka/code-review-loop ~/.claude/skills/code-review-loop

Or copy SKILL.md manually:

mkdir -p ~/.claude/skills/code-review-loop
cp SKILL.md ~/.claude/skills/code-review-loop/SKILL.md

Usage

/code-review-loop <scope>

Scope examples

Command What it does
/code-review-loop services/creative_testing.py Single file
/code-review-loop services/*.py Glob
/code-review-loop main..HEAD Git range
/code-review-loop 42 PR #42 (requires gh)
/code-review-loop Current uncommitted changes
/code-review-loop whole repo Entire tracked codebase
/code-review-loop все питон файлы в services/ Natural language

Per-iteration pipeline (verbatim from /code-review)

1. Haiku: collect relevant CLAUDE.md paths for the scope
2. Haiku: produce a short summary of what the scope does
3. Parallel x5 (Sonnet) — return issues, no fixes:
     Agent 1: CLAUDE.md adherence audit
     Agent 2: shallow bug scan
     Agent 3: git blame / history context
     Agent 4: comments on past PRs that touched these files
     Agent 5: code-comment compliance (TODOs, WARNINGs, HACKs)
4. Parallel xN (Haiku) — score each issue 0/25/50/75/100 per verbatim rubric
5. Filter: drop any issue with score < 80
6. Sonnet fix agent — applies only the surviving high-confidence issues

After loop (Opus):
  Reviews all commits, self-checks for hallucinations, fixes verified concerns

Final:
  Auto-detected test runner → fix subagent if red (cap 3 attempts)

Differences from the upstream /code-review skill

The /code-review slash-command is designed for one pass over a single GitHub pull request — it ends by gh pr comment-ing the surviving issues onto the PR. code-review-loop reuses the same agent prompts, scoring rubric, false-positive list, and 80-score cutoff verbatim, with two deliberate omissions:

  • No eligibility check — there's no PR draft/closed/already-reviewed state to gate on; the loop runs against a local scope.
  • No gh pr comment step — surviving issues are fed to a fix agent instead of posted as PR comments.

Everything else — the 5 review-agent prompts, the rubric, the filter threshold, the false-positive list — is preserved exactly as in the upstream skill.

Termination logic

The loop exits when 2 consecutive iterations produce no file changes on disk, with a minimum of 3 iterations. Hard cap at 10. Iterations where every raw issue is filtered out by the 80-score cutoff also count as "no changes" — so a clean scope is detected naturally without needing an LLM-reported "done" signal.

Safety

  • Refuses to run on main/master branch
  • Refuses to run with dirty working tree (unrelated uncommitted files)
  • Never uses git add -A or git add . — only adds specific changed files
  • Never amends commits — always creates new ones
  • Never pushes — user decides when to push
  • Confidence-score cutoff (>= 80) prevents low-confidence findings from triggering edits
  • Post-loop Opus reviewer self-checks every concern against the live file before reporting

Commit format

refactor(code-review-loop): iter N — <summary>

Scope: <scope description>
Files: N modified
Issues fixed: K

Co-Authored-By: Claude Code <noreply@anthropic.com>

Requirements

  • Claude Code
  • Git repository
  • gh CLI (optional — Agent #4 degrades gracefully without it; required only for the #42 PR scope form)
  • Test runner auto-detected: pytest, npm test, go test ./..., cargo test, bundle exec rspec, make test

Models

Phase Model Why
CLAUDE.md path collection Haiku Trivial directory walk
Scope summary Haiku Short text generation
5 review agents Sonnet Pattern-matching across files
Per-issue confidence scorer Haiku One small rubric eval per issue
Fix agent Sonnet Targeted edits
Post-loop code review Opus Safety-critical, hallucination resistance
Test fix Sonnet Debugging

License

MIT

About

Claude Code skill: loop the simplify agent until your codebase is clean

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors