← Back to videos

Builder + Checker Agent Loop That Self-Fixes Until All Tests Pass

@raycfuCapturedAgents & MCP
See more in Agents & MCP

Exact instruction

  1. Set up a Builder + Checker agent loop in Claude Code:
  2. Create a Builder agent: its only job is to write and fix code.
  3. Create a Checker agent: its only job is to run tests, type checks, and linting, then report exactly what failed.
  4. Keep them separate — the same agent that writes code cannot reliably check its own work.
  5. Create an orchestrator command that chains them: Builder implements → Checker runs → if all green, stop; if failures, send back to Builder → repeat.
  6. Add stop rules: (a) max 5 cycles — if not fixed after 5, a human must intervene; (b) stop immediately if a fix breaks something previously passing (regression detected).
  7. Without stop rules, agents will start weakening tests to fake a pass.

Suggested prompt

Set up a Builder + Checker agent loop for this project: create a Builder agent for writing/fixing code and a Checker agent for running tests/linting. Add an orchestrator that loops them with a max 5-cycle stop rule and an immediate stop on regression. Show me the exact commands.

Adopt?

Yes: The Builder + Checker loop with stop rules is directly applicable to this project and any Claude Code workflow. General Claude Code update — implement this pattern for any feature development cycle.

Find the resource

Creator @raycfu offers a step-by-step guide with exact agent and orchestration commands when you comment "loop". Search: "raycfu Claude Code builder checker agent loop" for any published version.

show original caption

How to build a Claude Agent team that runs in loops #ai #tech