# Loops for Claude Code

> Loops for Claude Code - Doutor AI library.

- Source: https://doutorai.pt/en/claude-code/loops
- Site: Doutor AI (https://doutorai.pt/en) - AI tools for small businesses

## Explore loops

- [adversarial-review-loop](https://doutorai.pt/en/components/loops__adversarial-review-loop): Has a second, independent model review every change before merge so two different reviewers must agree - code only lands when both clear the bar.
- [anti-spin-build-loop](https://doutorai.pt/en/components/loops__anti-spin-build-loop): Builds toward a machine-checkable contract with explicit anti-spin guardrails - stops on no progress, repeated approaches, flip-flopping, or a spend budget.
- [build-test-fix-loop](https://doutorai.pt/en/components/loops__build-test-fix-loop): Builds the next item on the plan, then runs tests, typecheck and lint, feeding every failure back as the next instruction until the build is green.
- [builder-reviewer-loop](https://doutorai.pt/en/components/loops__builder-reviewer-loop): Passes code between a builder and an independent reviewer subagent until the review has no blocking findings and tests pass.
- [completion-contract-loop](https://doutorai.pt/en/components/loops__completion-contract-loop): Writes a contract of what "done" means and what evidence proves each requirement before any work starts, then refuses to claim success without that evidence.
- [docs-sweep-loop](https://doutorai.pt/en/components/loops__docs-sweep-loop): Keeps documentation aligned with the current codebase and opens a reviewable pull request on every pass.
- [five-minute-maintainer-loop](https://doutorai.pt/en/components/loops__five-minute-maintainer-loop): Every few minutes while you work, makes one small verified repository improvement - a flaky test, a stale comment, a missing type - one change, one commit.
- [goal-refiner-loop](https://doutorai.pt/en/components/loops__goal-refiner-loop): Rewrites a vague request into a precise goal - exact end state, how to verify it, what not to touch, and the stop condition - then executes against it.
- [perf-budget-loop](https://doutorai.pt/en/components/loops__perf-budget-loop): Profiles and optimizes the app pass after pass until it consistently meets a defined performance budget.
- [production-error-sweep-loop](https://doutorai.pt/en/components/loops__production-error-sweep-loop): Triages production errors, finds the root cause, ships a verified fix, and repeats until the error budget is clean.
- [repo-cleanup-loop](https://doutorai.pt/en/components/loops__repo-cleanup-loop): Recovers valuable unmerged work and prunes stale branches and PRs until the repository is tidy.
- [test-coverage-loop](https://doutorai.pt/en/components/loops__test-coverage-loop): Adds meaningful tests pass after pass until the suite reaches a target coverage threshold and stays green.
- [ticket-to-pr-loop](https://doutorai.pt/en/components/loops__ticket-to-pr-loop): Converts open bug reports and issues into verified, reviewer-ready pull requests, one ticket per pass.
- [devils-advocate-loop](https://doutorai.pt/en/components/loops__devils-advocate-loop): Adversarially challenges a design or decision until every serious objection is resolved or explicitly accepted.
- [human-approval-loop](https://doutorai.pt/en/components/loops__human-approval-loop): Runs the task, then pauses and sends you approve / revise / skip before anything ships - human review as a first-class queue where the stop condition is your ap
- [quality-streak-loop](https://doutorai.pt/en/components/loops__quality-streak-loop): Runs realistic scenarios and fixes failures until the suite passes N times in a row with no regressions.
- [nightly-changelog-loop](https://doutorai.pt/en/components/loops__nightly-changelog-loop): Updates the changelog every night with user-relevant changes and notifies the team when it ships.
- [overnight-pr-routine-loop](https://doutorai.pt/en/components/loops__overnight-pr-routine-loop): A nightly routine that watches your open PRs, auto-fixes build failures, answers review comments in a fresh worktree, and rebases stale branches while you sleep

## Save hours every week with AI, no hassle

**Doutor AI** gives you 1,859 ready-to-copy AI prompts, by industry and in plain English - plus a complete technical library for those who want to go further. [See plans →](https://doutorai.pt/en/pricing)

---
Content by Doutor AI (https://doutorai.pt/en). When quoting, please cite the source: https://doutorai.pt/en/claude-code/loops
