Playbook

7 Ways to Actually Use Loops

Everyone talks about loops. Nobody says where you'd point one. Here's seven — ready to paste.

The Idea

Everyone's talking about loops right now — but no one tells you what to actually point one at. So here are seven practical ones you could set up today.

Quick reminder: a loop is where you give Claude a goal and it works on its own until it hits it — no babysitting. Each one below is a paste-ready starter: drop it into Claude Code and it'll help you set the whole loop up — goal, checks, stop condition and all — and walk you through the plan before it runs.

The Seven

1

The Speed Loop

Optimises every page until it loads under fifty milliseconds — measuring after each change so it knows when it's done.

Loop 1 — paste into Claude
I'd like to set up a "speed loop" in Claude Code, and I want your help getting it right. The goal: get every page in my app loading fast — ideally under 50ms. Before you start, help me turn this into a proper loop: - Agree how we'll measure page-load time consistently across every page, so the result is real and not guesswork. - Pin down what "done" looks like, plus a max number of rounds so it can't run forever. - Each round: make one improvement, re-measure, and commit only if it got faster. - Keep progress in /tmp/speed-loop.md so it survives a fresh start. Walk me through the plan first. Once I'm happy, kick it off.
2

The Overnight Docs Sweep

Updates your docs to match the day's changes and opens a PR. Wake up to documentation that's actually current.

Loop 2 — paste into Claude
I'd like to set up an "overnight docs sweep" loop in Claude Code, and I'd like your help setting it up. The goal: bring my documentation back in line with what the code actually does, then open a PR — so I wake up to docs that are current. Help me set it up properly first: - How you'll work through the codebase, and what "up to date" means here. - A clear finish line and a stop condition. - Each round: update a section, check it against the real code, commit. - Track what's changed in /tmp/docs-loop.md, and open a PR at the end. Talk me through the plan before you start.
3

Refactor Till Happy

Cleans up the architecture until it's genuinely tidy — testing and committing after each step.

Loop 3 — paste into Claude
I'd like to set up a "refactor" loop in Claude Code, and I want your help setting it up. The goal: clean up the architecture until it's genuinely tidy — without breaking anything. First, help me make it safe and finite: - Define what "clean enough" looks like, so the loop has a real finish line. - Set a max number of rounds. - Each round: make one improvement, run the tests, do a quick self-review, and commit only if it's green. - Track progress in /tmp/refactor-loop.md. Show me the plan first. Once I'm happy, run it.
4

The Logging Loop

Adds logging until every important path is covered — so next time something breaks, you can see what happened.

Loop 4 — paste into Claude
I'd like to set up a "logging" loop in Claude Code, and I'd like your help setting it up. The goal: add logging so every important path in the app is covered — so next time something breaks, I can actually see what happened. Help me set it up first: - Let's agree what counts as an "important path" and what "covered" means, so it has a clear finish. - Set a stop condition. - Each round: add logging to one path, run the app and confirm the new logs actually fire, commit on green. - Track which paths are done in /tmp/logging-loop.md. Walk me through the plan, then start.
5

The Nightly Error Sweep

Reads your production logs, fixes what's broken, and opens a PR. Triage while you sleep.

Loop 5 — paste into Claude
I'd like to set up a "nightly error sweep" loop in Claude Code, and I need your help setting it up safely. The goal: each night, read my production error logs, fix what's broken, and open a PR — so triage happens while I sleep. Help me set it up properly first: - How you'll pull the logs, and how you'll prioritise (most frequent / most damaging first). - A limit on how much to take on per run, so it stays sane. - Each round: fix one error, verify the fix actually works, commit. - Open a PR at the end with a summary, and track what you fixed in /tmp/error-loop.md. Show me the plan before running anything.
6

The SEO + GEO Audit

Improves how you show up in search engines (SEO) and AI answer engines (GEO) — fixing gaps and re-checking until nothing critical is left.

Loop 6 — paste into Claude
I'd like to set up an "SEO + GEO" loop in Claude Code, and I want your help getting it right. The goal: improve how my site shows up both in search engines (SEO) and in AI answer engines like ChatGPT, Claude and Google's AI answers (GEO) — fixing the biggest gaps and re-checking until nothing critical is left. Help me set it up first: - Agree the checks we'll run for both SEO and GEO, and what counts as a "critical" issue. - Set a stop condition. - Each round: audit, fix the highest-impact gaps, then re-crawl / re-check. - Track each pass and what changed in /tmp/seo-geo-loop.md. Talk me through the plan. Once I'm happy, run it.
7

The Eval Loop

Runs a hundred real scenarios through your app and fixes everything that fails — until they all pass.

Loop 7 — paste into Claude
I'd like to set up an "eval" loop in Claude Code, and I'd like your help setting it up. The goal: throw around a hundred real-world scenarios at my app and fix everything that fails — until it all passes. First help me set it up properly: - How we'll generate realistic scenarios, and how each one is judged pass or fail. - A stop condition. - Each round: run the scenarios, fix the underlying bug behind each failure, re-run. - Commit on green and track results in /tmp/eval-loop.md. Walk me through the plan before you start.

Two Things Before You Run One

The whole trick is giving it a goal it can actually check — "loads under 50ms," "tests all pass," "no critical SEO or GEO issues left." That's why every starter above asks Claude to nail down the checks before it runs. A loop with nothing to verify against just runs in circles agreeing with itself. (That's the entire point of the Verify Loop.)

And be straight with yourself about cost: loops burn through tokens, and some of these run for hours. That's fine for an overnight docs sweep or a weekend refactor — just don't kick one off and wander away from a metered account expecting it to be cheap. Set a stop condition and let it work.

Inspired by a video from Matthew Berman. He's also collecting these in his Loop Library — worth a look if you want more than seven.