AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Loop Engineering

skill-haidrrrry-loop-engineering-skills-loop-engineering · by haidrrrry

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 unl…

No reviews yet
0 installs
23 views
0.0% view→install

Install

$ agentstack add skill-haidrrrry-loop-engineering-skills-loop-engineering

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-haidrrrry-loop-engineering-skills-loop-engineering)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
1mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Loop Engineering? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

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)

  1. 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.

  1. Generate the answer.
  2. Run the checks. Actually execute code/tests if an environment exists.

For non-executable work, walk each check explicitly: "Check 3: input [] → expected 0, answer produces… "

  1. Fix only what a failed check identifies. Do not touch parts that pass.
  2. 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.

  1. Generate the draft.
  2. 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.

  1. 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.

  1. Revise only the named problems.
  2. 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.

  1. Extract a spec: list every explicit requirement in the prompt, plus

implicit ones (audience, constraints, format, edge cases). Number them.

  1. Generate against the spec.
  2. 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.

  1. 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)

  1. 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.

  1. Generate.
  2. Grade honestly against each criterion with a one-line justification.
  3. Revise anything scoring ≤3. Leave 4s and 5s alone.
  4. Re-grade revised criteria once. Stop.

5. Red Team Loop (decisions, plans, arguments)

  1. Generate the plan/recommendation.
  2. 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.

  1. Triage: for each attack, decide — mitigate (change the plan), accept

(note the risk explicitly), or rebut (explain why the attack fails).

  1. 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.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.