Loop Prompts: 10 Copy-Paste Examples for Self-Correcting AI

10 min read · Updated 2026-09-28

A loop prompt tells the AI to repeat a cycle — attempt the task, check the attempt against explicit success criteria, fix whatever failed — until every criterion passes or a round limit is reached. It is the difference between "write a cold email" and "write a cold email, test it against these five checks, and keep fixing it until all five pass".

Why a loop beats a single prompt

A single prompt gets one attempt. Whatever the model produced first is what you receive, and the checking is left to you. For simple requests that is fine. For anything with several requirements — a word limit, a tone, facts that must be right, code that must handle edge cases — the first attempt usually misses one of them.

A loop moves the checking into the prompt. You state what "done" looks like as a list of checks, and the model runs them against its own draft before you ever see it. Most of the value comes from writing the checks down: once a requirement is a pass/fail test instead of a hope, the model can act on it.

A loop is not the same as a prompt chain. A chain runs different steps in order — research, then outline, then draft. A loop repeats the same cycle on one piece of work until it meets the bar. The two combine well: a chain whose drafting step is a loop.

The five parts every loop prompt needs

  • The goal — one sentence describing the finished result.
  • Success criteria — three to six checks that are pass/fail, not matters of taste. "Under 120 words" is a check; "engaging" is not.
  • The cycle — the steps of one round, for example: draft, check each criterion with evidence, revise only what failed.
  • A stop rule — stop when every check passes, or after a fixed number of rounds (three is a good default), whichever comes first.
  • A report format — what you want back, for example the final version plus one line per round saying what changed.

Writing loops (examples 1-4)

  • 1. Cold email: "Write a cold email to [ROLE] at [COMPANY] about [OFFER]. Success criteria: under 120 words; the first line is about them, not us; exactly one question as the call to action; no phrases like 'I hope this finds you well'; a subject line under 6 words. Loop: draft, check every criterion and quote the line that passes or fails it, rewrite only the failing parts. Stop when all pass or after 3 rounds. Return the final email and a one-line log per round."
  • 2. Product description: "Write a product description for [PRODUCT] for [AUDIENCE]. Criteria: opens with the main benefit, not the product name; includes the 3 specs I list below; no superlatives without a number behind them; under 90 words. After each draft, list each criterion as PASS or FAIL with the evidence, then revise. Maximum 3 rounds. Specs: [SPECS]"
  • 3. Plain-language rewrite: "Rewrite the text below for a reader aged 12. Criteria: no sentence over 20 words; every technical term explained or replaced; meaning unchanged — list any fact you had to drop and put it back. Loop until all criteria pass (max 3 rounds). Text: [PASTE]"
  • 4. De-cliché pass: "Edit the draft below. Criteria: none of these words: delve, tapestry, seamless, leverage, unlock, elevate; no sentence starting with 'In today's'; every paragraph contains one concrete detail — a number, a name or an example. Scan, fix, rescan until clean. Return the edited draft and the list of changes. Draft: [PASTE]"

Code and data loops (examples 5-7)

  • 5. Function with edge cases: "Write a [LANGUAGE] function that [TASK]. Before answering, list 6 test inputs including empty input, very large input and invalid input. Loop: write the function, trace each test input through it step by step, fix any failure. Stop when all 6 traces pass. Return the function, the tests and the traces."
  • 6. SQL query: "Write a SQL query for [QUESTION] against this schema: [SCHEMA]. Criteria: runs on [DATABASE]; handles NULLs in [COLUMN]; no SELECT *; results ordered by [FIELD]. After each attempt, check every criterion and explain how the query satisfies it. Revise until all pass, max 3 rounds."
  • 7. Data cleanup rules: "Propose rules to clean this sample data: [PASTE]. Loop: write the rules, apply them to every sample row and show the output, list rows that are still wrong, refine the rules. Stop when every sample row comes out correct."

Research and planning loops (examples 8-10)

  • 8. Answer with sources: "Answer [QUESTION]. Criteria: every factual claim is followed by its source; anything you cannot source is labelled as unverified; no claim goes beyond what the source supports. Loop: draft, audit each sentence against the criteria, remove or label what fails. Return the audited answer."
  • 9. Plan with constraints: "Make a [LENGTH] plan for [GOAL] with these constraints: [BUDGET], [TIME PER WEEK], [TOOLS]. Criteria: every week fits the time limit; total cost within budget; each week ends with something checkable. Loop: draft the plan, total the time and cost, fix any week that breaks a constraint. Max 3 rounds."
  • 10. Decision memo: "Recommend between [OPTION A] and [OPTION B] for [CONTEXT]. Criteria: states the decision in the first sentence; lists the two strongest arguments against the recommendation and answers each; names what evidence would change the decision. Draft, critique it as a sceptical reviewer, revise. Stop when the critique finds nothing new."

The mistakes that break loops

  • Criteria that are really opinions. "Make it better" gives the model nothing to test, so every round passes. Rewrite each criterion until a stranger could check it.
  • Grading without evidence. A model grading its own work is generous. Require it to quote the line that satisfies each criterion; a missing quote exposes a fake pass.
  • No round limit. Without one, a loop that cannot converge keeps rewriting and drifting. Three rounds is enough for most tasks; if it is still failing, a criterion is probably impossible or contradictory.
  • Conflicting criteria. "Under 50 words" plus "cover all six features" can never pass together. When a loop hits the limit, check the criteria before blaming the model.
  • Asking for the whole transcript. You usually want the final result and a short log, not every draft. Say so in the report format.

When not to use a loop

Skip the loop when you cannot say what "done" means — the loop will just rephrase the same draft. Skip it for simple lookups and one-line answers, where the checking costs more than it saves. And skip it when speed matters more than polish: every round is more generated text, which means more time and, on paid APIs, more cost.

Build one in under a minute

PromptVibe's free Loop Prompt Generator turns a goal into a loop prompt: it suggests success criteria from your goal, lets you pick a loop pattern (generate-critique-refine, reason-act-observe, or build-test-fix) and sets the round limit and report format for you. Paste the result into ChatGPT, Claude or Gemini.

Frequently Asked Questions

What is a loop prompt?

A prompt that makes the AI repeat a cycle — attempt, check against explicit success criteria, fix what failed — until every criterion passes or a round limit is reached, instead of returning its first attempt.

How many rounds should a loop prompt allow?

Three is a good default. Most improvements happen in the first two rounds; if the work still fails after three, a criterion is usually vague, impossible or in conflict with another one.

Do loop prompts work in ChatGPT, Claude and Gemini?

Yes. A loop prompt is ordinary text, so any capable chat model can follow it. Models differ in how strictly they grade themselves, which is why the prompt should require evidence for each check.

What is the difference between a loop prompt and prompt chaining?

A chain runs different steps in sequence, each feeding the next. A loop repeats the same cycle on one piece of work until it meets the success criteria. A chain can contain a loop as one of its steps.

Put this into practice

Generate a structured prompt or turn your workflow into a reusable Agent Skill — both free.

Prompt Generator →Skill Generator →

Related articles

→ What Is Loop Engineering? Designing AI Loops That Reach the Goal→ Prompt Chaining: How to Build Multi-Step AI Workflows→ How to Test AI Prompts: The Method That Replaces Guessing→ Chain of Thought Prompting: What It Is and When It Still Helps