loop-engineering
Skill4 starsChanged 5 months agoMITView on GitHub
Make AI output measurably smarter using research-backed self-correction loops. Use this skill whenever the user asks to improve, refine, double-check, verify, or "make better" any AI-generated output — code, writing, plans, analysis, answers — or asks for "your best work", "high quality", "production ready", "make sure this is right", or gives a complex/high-stakes task where a first draft is unlikely to be good enough. Also use when the user mentions loop engineering, iterative refinement, self-review, or self-correction. Do NOT loop on simple factual lookups or short casual answers.
19 other projects use a version of this.
Adopted by
Most recently taken up by
- akitaonrails/my-skillstheir own version, first seen Sep 17, 2026
- j99way99/claude-skillstheir own version, first seen Sep 16, 2026
- Gaurav890/everything-agentic-engineeringtheir own version, first seen Sep 13, 2026
- Hakkadaikon/hymmetheir own version, first seen Sep 9, 2026
- jggomez/expert-ai-developer-skillstheir own version, first seen Sep 7, 2026
- vpeetla-ai/vpeetla-ai-skillstheir own version, first seen Aug 2, 2026
Used with
Projects with it also use agentic-engineering.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
InfopibeSkillagentic-engineering
Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing.
Also in 3 projects that use this
Other versions19 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 19
- huytieu/COG-second-brain★ 1.3ksame name
- telagod/code-abyss★ 242same name
- akitaonrails/my-skills★ 205same name
- Mark393295827/third-brain-v7-skills★ 141same name
- jggomez/expert-ai-developer-skills★ 28same name
- yoyothesheep/claude-skills★ 16same name
- sxivansx/loop-engineering★ 10same name
- Connected-Mate/fable-mindset★ 3same name
- parkavenue9639/loop-engineering★ 2same name
- vpeetla-ai/reflection-agent-pattern★ 2same name
9 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository2 other files it gives its agents.
- loop-memorySkill
- loop-verifierSkill
The file
We split this skill into the rules it gives an agent
9 rules. 0 are common, 9 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 13 edited versions we read keep these.
9
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 28
Every loop below has a built-in anchor.
- Distinctive: line 50
Derive checks first or independently: Before (or without looking at) the draft answer, write down what a correct answer must satisfy: test …
- Distinctive: line 58
Fix only what a failed check identifies: Do not touch parts that pass.
- Distinctive: line 71
Reframe: treat the draft as if submitted by an unknown junior writer to you, a demanding editor at [a publication the target audience …
- Distinctive: line 73
Do not defend it — you didn't write it.
- Distinctive: line 106
Revise anything scoring ≤3: Leave 4s and 5s alone.
- Distinctive: line 126
Tasks with no derivable anchor: If you can't state what "better" means concretely before revising, revision is a coin flip.
- Distinctive: line 131
Never silently loop away correctness: If a revision would change a factual claim, re-verify the claim.
- Distinctive: line 136
When a loop materially changed the output, tell the user in one or two lines what the loop caught (e.g., "verify pass caught an off-by-one …
“Common” is measured: kept by at least 6 in 10 of the 13 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Loop Engineering
Turn one-shot answers into iterated, verified answers. This skill encodes five correction loops, the rules for choosing between them, and — critically — the rules for when NOT to loop.
The core principle: never loop without an anchor
Research on LLM self-correction is blunt: asking a model to "review your answer and fix mistakes" with no external reference degrades accuracy as often as it improves it. Models exhibit self-bias (they favor their own output), are poorly calibrated (confident in wrong answers), and have a self-correction blind spot (they fix errors in other people's text but not their own).
What works is looping against an anchor — something outside the raw answer:
- an executable test or check
- a rubric written before the answer
- a decomposed spec the answer must satisfy
- a persona/context shift that breaks self-bias
- real error messages, tool output, or user-provided ground truth
Every loop below has a built-in anchor. If you find yourself about to revise with no anchor ("hmm, let me just look at this again"), stop — either pick a loop or ship the answer as-is.
Choosing a loop
| Task type | Loop | Anchor |
| Code, math, data, anything executable/checkable | Verify Loop | Tests / checks derived before or independently of the answer |
| Writing, explanations, creative work | Stranger Review Loop | Persona + context shift |
| Complex or vague multi-part tasks | Decompose Loop | Explicit spec / requirement list |
| Quality-critical deliverables (reports, designs, plans) | Rubric Loop | Rubric written before answering |
| Decisions, strategies, arguments | Red Team Loop | Adversarial role with a defined attack surface |
Maximum 2 revision iterations per loop unless an executable check is still failing. Gains past iteration 2 are marginal and the risk of revising a correct answer into a wrong one rises.
The five loops
1. Verify Loop (strongest — use whenever output is checkable)
- Derive checks first or independently. Before (or without looking at) the draft answer, write down what a correct answer must satisfy: test cases, boundary conditions, invariants, a worked example with known result, units that must balance, constraints from the prompt.
- Generate the answer.
- Run the checks. Actually execute code/tests if an environment exists.
For non-executable work, walk each check explicitly: "Check 3: input
[]→ expected0, answer produces… " - Fix only what a failed check identifies. Do not touch parts that pass.
- Repeat until checks pass or 3 fix attempts, then report remaining failures honestly.
Anchor quality matters more than iteration count. One real executed test beats five rounds of "looks correct to me."
2. Stranger Review Loop (writing & explanations)
Exploits the blind-spot finding: models correct errors far better when the text appears to come from someone else.
- Generate the draft.
- Reframe: treat the draft as if submitted by an unknown junior writer to you, a demanding editor at [a publication the target audience respects]. Do not defend it — you didn't write it.
- Critique against concrete dimensions, not vibes: factual claims that need sourcing, unsupported logical jumps, redundancy, buried lede, audience mismatch, ambiguous sentences a hostile reader would misread. Name specific line-level problems, minimum 3, or state explicitly that the draft passes.
- Revise only the named problems.
- One more pass maximum. If pass 2's critique produces only trivia, ship.
3. Decompose Loop (complex or vague tasks)
Fixes the "make me a website"-class failure where the model answers a simplified version of the request.
- Extract a spec: list every explicit requirement in the prompt, plus implicit ones (audience, constraints, format, edge cases). Number them.
- Generate against the spec.
- Audit line by line: for each numbered requirement, quote the part of the answer that satisfies it. A requirement with no quotable evidence is a gap.
- Fill only the gaps.
The numbered spec is the anchor; auditing by quotation prevents the model from hand-waving "yes, covered."
4. Rubric Loop (quality-critical deliverables)
- Write the rubric first — before drafting. 4–6 criteria describing what an excellent version of this specific deliverable looks like, each with a 1–5 scale and a description of what a 5 requires. Deriving the rubric first is the point: it can't be reverse-engineered to flatter the draft.
- Generate.
- Grade honestly against each criterion with a one-line justification.
- Revise anything scoring ≤3. Leave 4s and 5s alone.
- Re-grade revised criteria once. Stop.
5. Red Team Loop (decisions, plans, arguments)
- Generate the plan/recommendation.
- Attack it from a defined adversarial role with a stake: the competitor exploiting the plan's weakness, the auditor looking for the compliance hole, the user who will misuse the feature, the reviewer whose job is to reject. The role must produce specific failure scenarios, not general doubts.
- Triage: for each attack, decide — mitigate (change the plan), accept (note the risk explicitly), or rebut (explain why the attack fails).
- Output the revised plan with a residual-risk section. Deleting the risks the loop found defeats the purpose.
When NOT to loop
- Simple factual questions. Looping adds latency and risk of talking yourself out of a correct answer.
- Tasks with no derivable anchor. If you can't state what "better" means concretely before revising, revision is a coin flip.
- After a loop's critique pass returns only trivial findings. That is the stop signal. "Polish" iterations past this point rearrange deck chairs.
- When the user asked for speed or a rough draft. Respect the ask.
- Never silently loop away correctness. If a revision would change a factual claim, re-verify the claim; don't just prefer the newer phrasing.
Reporting
When a loop materially changed the output, tell the user in one or two lines what the loop caught (e.g., "verify pass caught an off-by-one on the empty input case"). Don't narrate the whole process. If everything passed on the first draft, just deliver it — no ceremony.
Combining loops
For big deliverables, chain at most two: Decompose → Verify for technical builds, Rubric → Stranger Review for major writing. Never run all five; that's theater, not engineering.
Further reading
references/research-notes.md — summary of the research behind these rules
(Self-Refine, the DeepMind self-correction critique, the blind-spot finding),
useful when a user asks why the skill forbids naive self-review.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

