How to write loops in Claude Code Boris Cherny, creator of Claude Code, says he no longer prompts Claude directly, instead using loops that prompt the agent and figure out what to do. Anthropic's research supports this shift, where agents run code and delegate work, moving the human role from doing to designing the loop. The guide demonstrates how to use Claude Code's /loop, /goal, and dynamic workflows to automate repetitive tasks like watching PRs and addressing review comments. Boris Cherny, the creator of Claude Code, said this in a recent interview: "I don't prompt Claude anymore. I have loops that are running. They're the ones prompting Claude and figuring out what to do. My job is to write loops." Anthropic put it a different way in a recent research piece https://www.anthropic.com/institute/recursive-self-improvement : agents can now run code themselves and delegate hours of work to other agents. The human role is shifting from doing to designing the loop. The shift happens when you start moving work into the loop. You're already running a loop Think about what you do after Claude finishes a task: - Run the tests - Check the output - Push a commit - Open a PR - Wait for review comments - Copy-paste them back into Claude - Address them - Merge That sequence is a loop. You're the controller, carrying context from step to step, deciding when to go again, deciding when to stop. The loop paradigm is you shifting those actions back to the agent. You don't need custom tooling or orchestration frameworks. The primitives are already in Claude Code: /loop , /goal , and dynamic workflows. This guide shows you how to use each one. The demo repo Our demo repo https://github.com/ritza-co/claude-code-loops-demo is a small broken Express API with three routes and three failing tests. Each section of this guide uses it to demonstrate a loop pattern. You don't need it to follow along. The concepts apply to any codebase. But if you want to try the commands yourself, fork it, clone it, and install: git clone https://github.com/YOUR USERNAME/claude-code-loops-democd claude-code-loops-demonpm install 1. Watch a PR with /loop What it is: /loop runs a prompt on a repeating schedule. Claude wakes up, does something, reports back, and goes again. You stop it when you're done. The syntax: | Syntax | Behaviour | |---|---| /loop 5m