loop-engineering

loop-engineering is a skill for Claude Code, Codex from haidrrrry/loop-engineering-skills. It costs 131 tokens per session (1,731 once invoked), scanned A, original, MIT.

A method for improving AI-generated work through repeated checks against an external reference, such as tests, a rubric, a specification, or an error message. It also helps decide when another review is useful and when to stop.

In plain words
What is it for?
Use it to verify and refine code, writing, plans, analysis, or answers when you have tests, requirements, feedback, or other evidence to check against.
Why use it?
It reduces the risk of making unsupported revisions based only on the agent's own opinion. The checks give each revision a concrete basis.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to verify and refine code, writing, plans, analysis, or answers when you have tests, requirements, feedback, or other evidence to check against.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/haidrrrry/loop-engineering-skills/loop-engineering
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add haidrrrry/loop-engineering-skills --skill loop-engineering
Clone the repo
git clone --depth 1 https://github.com/haidrrrry/loop-engineering-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for loop-engineering

README.md
[![agentmods](https://agentmods.dev/badge/skills/haidrrrry/loop-engineering-skills/loop-engineering/github.svg)](https://agentmods.dev/skills/haidrrrry/loop-engineering-skills/loop-engineering)
Your own site
<a href="https://agentmods.dev/skills/haidrrrry/loop-engineering-skills/loop-engineering"><img src="https://agentmods.dev/badge/skills/haidrrrry/loop-engineering-skills/loop-engineering/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for loop-engineering

Your own site · 80×15
<a href="https://agentmods.dev/skills/haidrrrry/loop-engineering-skills/loop-engineering"><img src="https://agentmods.dev/badge/skills/haidrrrry/loop-engineering-skills/loop-engineering.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 131 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,731 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00131 $0.01731
Opus 5.5 $0.00052 $0.00692
Sonnet 5.5 $0.00026 $0.00346
Haiku 4.5 $0.00013 $0.00173

Measured 1mo ago against content hash e4c5beb9b00d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

loop-engineering scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/loop-engineering/SKILL.md · 152 lines

How it starts

The opening of the file, as written. The whole thing — 152 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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)

Read the full file on GitHub · 152 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 152 lines · 131 tokens per session scan A e4c5beb9b00d

Subscribe to this mod's changes

loop-engineering is a skill published in the GitHub repository haidrrrry/loop-engineering-skills (4 stars, last pushed 3mo ago), licensed MIT. It adds 131 tokens to every session and 1,731 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

istio-traffic-management

Configure Istio traffic management including routing, load balancing, circuit breakers, and canary deployments. Use when implementing service mesh traffic policies, progressive delivery, or resilience patterns.

wshobson/agents · 40 tokens

postgresql-table-design

Use this skill when designing or reviewing a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features.

wshobson/agents · 37 tokens

event-store-design

Design and implement event stores for event-sourced systems. Use when building event sourcing infrastructure, choosing event store technologies, or implementing event persistence patterns.

wshobson/agents · 33 tokens

workflow-orchestration-patterns

Design durable workflows with Temporal for distributed systems. Covers workflow vs activity separation, saga patterns, state management, and determinism constraints. Use when building long-running processes, distributed transactions, or microservice orchestration.

wshobson/agents · 49 tokens

make-pr-easy-to-review

Prepare PRs for review by cleaning noisy history, improving PR descriptions, and adding reviewer guidance without changing code behavior. Use for "make this easy to review", "tidy this PR", "clean up commits", or "annotate the diff".

michael-denyer/pstack-claude · 57 tokens

poteto-mode

Bundled skills live at ../ /SKILL.md from this file, so put this file's absolute path in every poteto-agent prompt.

michael-denyer/pstack-claude · 49 tokens