CClaude Code Catalog
All Patterns

Code Review Feedback Loop

WorkflowIntermediate

Instead of a single-pass review, this pattern creates a feedback loop: Claude Code reviews a diff, generates fix suggestions, applies them, runs tests, and reviews again until quality gates pass. Configurable exit conditions (max iterations, zero warnings, test coverage threshold) prevent infinite loops while ensuring thorough review.

reviewfeedback-loopqualitytesting

Pattern Code

# Code Review Feedback Loop Pattern ## CLAUDE.md Configuration ```markdown # Review Loop Rules ## Quality Gates (all must pass to exit loop) - Zero ESLint errors (warnings allowed up to 3) - Test coverage >= 80% for changed files - No TODO/FIXME without linked issue - Type-check passes with strict mode ## Review Loop Settings - Max iterations: 3 - On max iterations: stop and summarize remaining issues ``` ## Review Loop Script ```bash #!/bin/bash # review-loop.sh — iterative review until quality gates pass MAX_ITER=3 ITER=0 while [ $ITER -lt $MAX_ITER ]; do ((ITER++)) echo "=== Review iteration $ITER/$MAX_ITER ===" # Step 1: Run quality checks LINT_ERRORS=$(npx eslint src/ --format json | jq '[.[] | .errorCount] | add') COVERAGE=$(npx vitest --coverage --reporter=json | jq '.total.lines.pct') TYPE_CHECK=$(npx tsc --noEmit 2>&1) # Step 2: If all gates pass, exit if [ "$LINT_ERRORS" -eq 0 ] && \ [ "$(echo "$COVERAGE >= 80" | bc)" -eq 1 ] && \ [ -z "$TYPE_CHECK" ]; then echo "All quality gates passed on iteration $ITER" exit 0 fi # Step 3: Ask Claude to fix issues claude -p "Fix these issues: Lint errors: $LINT_ERRORS Coverage: $COVERAGE% (need 80%) Type errors: $TYPE_CHECK Apply minimal fixes. Do not refactor unrelated code." done echo "Max iterations reached. Review remaining issues manually." ```

Copy this pattern into your project configuration to implement.

Terminal Preview

Code Review Feedback Loop

About Code Review Feedback Loop

Claude Code patterns are proven architectural designs and workflow structures that help you tackle complex development scenarios. Code Review Feedback Loop is a Workflow pattern at the Intermediate level that provides a tested, repeatable approach you can adapt to your projects for more efficient and consistent results.

Related Patterns