Guide · Loop engineering

Put the skills in the loop.
Keep yourself on the outer one.

The way you work with coding agents is shifting from prompting turn by turn to designing loops that prompt the agent for you - automations, worktrees, subagents, software factories in Claude Code and Codex. agent-skills is built for that shift. The skills are the verification you put inside the loop, so its output is evidence you can stand behind on the outside.

01 The shift

From prompting to loops

Boris Cherny, who leads Claude Code at Anthropic, put it bluntly: "I don't prompt Claude anymore. I have loops running that prompt Claude and figuring out what to do. My job is to write loops." A loop is one agent doing a single job on repeat: gather context, act, check the result, and go again until some condition is met. Stack loops and you get a software factory - many harnessed loops feeding a review gate, with a human owning the whole thing from above.

A loop needs five primitives plus somewhere to keep state, and Claude Code and Codex both ship all of them now. Skills are one of the five. Their job in the loop is specific and it is the reason this pack matters here: they encode the project knowledge the agent would otherwise guess, and the checks that make "done" mean something.

Automations Discovery and triage on a schedule Codex Automations · Claude Code /loop, cron, hooks
Worktrees Isolate parallel work so agents do not collide git worktree · isolation: worktree
Skills Encode project knowledge and the checks that make done mean something SKILL.md, this pack
Connectors Let the loop act in your real tools MCP servers, plugins
Subagents Keep the maker away from the checker .claude/agents · .codex/agents
State Remember what is done across runs Markdown, a Linear board

02 The mental model

Agents run the inner loop. You own the outer loop.

Inside the system there is one kind of thing: capability - investigate, implement, verify, repeat. Outside there is one kind of thing: agency - decide, verify, approve, own. The boundary between them is evidence.

Agents run the inner loop; you own the outer loop, with evidence crossing the boundary
The skills live inside the loop and force the verification. What crosses the boundary is evidence - diffs, tests, logs. You stay in the constraints, sampling, audit, and ownership loops, and you keep the verdict. SVG PNG

Trusting the loop does not mean removing the human. It means the human does not need to be in the inner loop. You move to the loops only a person can hold: what constraints and invariants to set, how much output to sample and read, what evidence to keep and be able to explain, and which part of the production boundary you own. The agent can ship more than you can review, so the scarce resource is your judgment, informed by the quality signals the skills produce.


03 Back pressure

Grant only as much autonomy as you can verify

The rule for a factory: hand a loop only as much autonomy as you can cheaply and reliably verify, and not one inch more. The skill commands, and the loop primitives you wrap around them, map to rungs of that ladder. The skills are what make each rung safe, because they force the check that produces the evidence.

1

Interactive

/spec · /plan · /build · /review
Human in the inner loop

You drive each phase and approve at every step. The skills structure the work and force the verification; you read every result. This is where you build understanding of unfamiliar or high-stakes code.

2

Supervised autonomy

/build auto
Human at the plan gate and on failures

You approve the plan once, then the agent implements every task in one pass. It stays test-driven and commits per task, and it pauses on failures or risky steps. You removed the stepping between tasks, not the verification.

3

Unattended loop

your harness /loop or /goal, around the skills
Human at the boundary, reviewing evidence

A loop primitive in your harness, not part of this pack (Claude Code /loop, or a run-until-done /goal in Claude Code and Codex), runs the skills on a cadence or until a verifiable stop condition holds, with a separate checker grading the result. You review the evidence and give the verdict. Only earn this rung for loops you can cheaply and reliably verify.


04 Which loops earn the dark

Decide where to leave the lights on

A dark factory ships code no human has read, verified only by other machines. That is fine for some loops and dangerous for others. The skilled job is flipping each switch on purpose, not setting them all to the same mode.

Lights out is fine when

  • The check is cheap, high-frequency, and hard to fake: a green-or-red oracle
  • test-driven-development: the suite passes or it does not
  • browser-testing-with-devtools and performance-optimization: Core Web Vitals targets are met or missed
  • code-review-and-quality run by a subagent against a real rubric
  • The loop is short (roughly three to ten steps) so mistakes cannot hide in the corners

Keep the lights on when

  • A wrong answer is expensive and only a person can catch it
  • security-and-hardening: auth, secrets, untrusted input, anything in the OWASP surface
  • api-and-interface-design: a public contract that Hyrum’s Law will freeze
  • Large blast radius, billing, migrations, or a decision that shapes a year of work
  • Brownfield behavior that lives in the scars, not the code

05 A loop with skills in it

The maker and the checker are different agents

The most useful structural move in a loop is splitting the agent that writes from the agent that checks. The model that wrote the code grades its own homework too kindly. This is exactly what /ship does when it fans out to review personas, and what doubt-driven-development does to any confident decision.

  1. 1
    An automation runs on a schedule. Its prompt calls a triage skill that reads yesterday’s CI failures, open issues, and recent commits, and writes findings to a state file.
  2. 2
    Each finding opens an isolated worktree. A subagent drafts the fix following incremental-implementation and test-driven-development - thin slices, each tested and committed.
  3. 3
    A second subagent reviews the draft. It applies code-review-and-quality and, where it matters, the security-auditor persona, against the project skills and existing tests.
  4. 4
    Evidence crosses the boundary. The loop opens a PR with the diff, the passing tests, and a short rationale. Anything it cannot verify lands in your inbox.
  5. 5
    You give the verdict. You read the evidence and decide: ship, block, redirect, or narrow. The state file remembers what passed, so tomorrow’s run picks up where this one stopped.

You designed that once. You did not prompt any single step. And it runs the same in Codex or Claude Code, because the primitives are the same - the skills are the part that stays constant as you move between harnesses.


06 What the loop does not do for you

Three costs that get sharper, not softer

A loop running unattended is a loop making mistakes unattended. The skills give you back pressure, but "done" is a claim, not a proof. These three costs grow as the loop gets smoother, so design against them deliberately.

Cognitive surrender

A loop that runs itself makes it tempting to accept whatever it returns. The skills’ anti-rationalization tables and verdict step exist to keep an opinion in the room. The output is still your answer, with all the accountability attached.

Comprehension debt

The faster the loop ships code you did not write, the wider the gap between what exists and what you understand. Sampling and reading are how you pay it down. A smooth loop grows the debt faster, with the tests green the whole way.

Orchestration tax

It is easy to spin up many agents; your review bandwidth does not parallelize. Your attention is the real ceiling on how many loops you can run, not the tooling. Spend it on the constraints and the dangerous assumptions.


07 The grounded take

What we recommend

This is how we suggest running the skills inside loops. It lines up with widely shared guidance on building agents, which is part of why the skills are shaped the way they are.

Prefer the simplest thing that works

Use a predefined workflow or graph where you can, and reach for open-ended autonomy only when the task genuinely needs it. A skill is a workflow with a shape you can trust, not a free-running agent.

Give the agent ground truth at each step

Effective agents check progress against the environment - tool results, test runs, code execution - rather than their own say-so. Every skill ends in exactly that: evidence, not "seems right."

Pause for a human where evaluation is clear

Agents should stop for human feedback at checkpoints and on blockers. The verdict step and the human checkpoint between phases are those pauses, placed where a wrong call is expensive.

Understanding is not free

Anthropic’s own controlled trial found engineers who leaned on AI scored lower on comprehension of the resulting code. Reading what the loop makes is the antidote, and the reason to keep the lights on where it counts.

Informed by public guidance on agent design, including Anthropic’s Building effective agents, Effective harnesses for long-running agents, and research on AI assistance and coding skills. References, not endorsements.

Build the loop. Stay the engineer.

Two people can build the same loop and get opposite results. One uses it to move faster on work they understand; the other to avoid understanding the work. The loop cannot tell the difference. You can.