Skip to main content
Goal: Have the AI review its own work holistically before the human reviews it.

Closing the Loop

Before you review the code, the AI must perform a holistic self-review of the entire generated snapshot. Why this works: AI is better at reviewing a finished file than it is at writing it line-by-line.

The Self-Review Prompt

Ask the AI to identify gaps, assign priority scores, and provide quality assessments.

Example Prompt

What You’re Looking For

🚨 Critical Issues (9-10 priority)
  • Incorrect API paths or endpoints
  • Missing error boundaries
  • Security vulnerabilities
  • Data integrity risks
  • Breaking changes to existing APIs
⚠️ Important Issues (6-8 priority)
  • Missing input validation
  • Incomplete error handling
  • Performance concerns
  • Missing edge case handling
✨ Nice to Have (3-5 priority)
  • Code style improvements
  • Better variable names
  • Additional comments
  • Optimization opportunities

Batching Fixes

High-priority issues identified by the AI are addressed in a mini “plan-and-approve” loop.

Fix Protocol

For each critical/important issue:
  1. Acknowledge: “I see the issue with [X]”
  2. Plan: “Here’s how I’ll fix it: [approach]”
  3. Approve: You review the plan
  4. Implement: AI makes the fix
  5. Verify: Confirm the fix works
Don’t batch-fix everything at once: Review plan for each high-priority issue individually.

Automated Cleanup

Once the structure is sound, direct the AI to run a dedicated pass for low-level cleanup.

Two-Phase Polish Approach

Phase 1: Structural Fixes (High-level)
  • Fix logic errors
  • Add missing error handling
  • Address architectural issues
  • Handle edge cases
Phase 2: Automated Cleanup (Low-level)
  • Run linting
  • Fix type errors
  • Clean up imports
  • Format code

Why Separate These?

Mixing them confuses the model:
  • Structural changes require reasoning
  • Linting is mechanical pattern-matching
  • Trying to do both simultaneously degrades quality

Cleanup Prompt

Quality Score Interpretation

90-100: Excellent

Ready for human review, minimal issues expected

75-89: Good

Some issues identified, addressable quickly

60-74: Needs Work

Significant gaps, requires attention before human review

Below 60: Major Problems

Stop, reassess the plan, likely need to restart Pro tip: If the AI gives itself 100%, that’s a red flag—it’s being overconfident.
Key Principle: Separate high-level structural fixes from low-level linting to avoid confusing the model. Review holistically, then polish systematically.