
Leading AI developers Boris Cherny and Peter Steinberg advocate for moving beyond single prompts to designing loops that repeatedly prompt AI agents until tasks are complete. This article breaks down loop engineering into understanding what loops are, the four essential components of successful loops, and a step-by-step guide to building your first loop, even without technical experience. It emphasizes skill-driven loop development, verification, and memory to optimize AI workflows.
AI developers Boris Cherny, creator of Claude code, and Peter Steinberg, creator of Open Claude, have shared a transformative insight: instead of prompting AI agents like Claude repeatedly, users should focus on designing loops that automate these prompts until a task is complete. This shift from manual prompting to loop engineering promises to revolutionize how we interact with AI.
In this article, we will explore:
A normal prompt runs once and then stops. In contrast, a loop is a prompt that runs repeatedly until a specific task or goal is achieved.
Boris Cherny explains his new approach:
"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."
Instead of manually prompting Claude multiple times, loops automate the process to accomplish clear goals.
There is a four-condition test to determine if a loop is appropriate:
If the answer is yes to all four, the task is a good candidate for loop engineering.
The trigger starts the loop. There are three simple ways to set triggers in Claude:
Execution skills are saved instructions that perform specific tasks within the loop. They are like reusable prompts that ensure consistency.
For example, in a weather-checking loop, an execution skill might analyze your workout preferences to decide whether to cancel a run if it rains.
It is crucial to build loops only with battle-tested skills to ensure reliability.
Every loop needs:
For technical tasks, verification can be straightforward, such as checking if a website loads within 2 seconds.
For non-technical tasks, verification is more abstract but can be bridged by skills that provide approval or scoring (e.g., email drafts reviewed by writing and fact-checking skills).
Using multiple AI agents to analyze outputs can reduce bias and improve verification accuracy.
Loops produce outputs such as documents, code updates, or notifications.
Memory is critical because without recording results, loops start from scratch each time, wasting tokens and repeating mistakes.
Documenting lessons learned and run history in a simple markdown file helps loops improve over time.
Identify the smallest task you have already successfully completed with AI skills.
Apply the four-condition test to see if it qualifies for a loop.
Use prompts to build a loop orchestration skill that abstracts complexity, allowing you to run the loop by simply typing its name.
When first running a loop, enable training mode so the loop pauses at each step for your approval. This prevents token waste and ensures the loop behaves as expected.
Once confident, disable training mode for full automation.
For less quantifiable goals, break loops into smaller checkpoints with human verification to prevent the AI from going off course.
For example, planning a corporate party can be broken down into choosing a date, venue, and theme, each verified before proceeding.
Loop engineering transforms AI interaction from manual prompting to automated, goal-driven processes. By understanding loops, their components, and how to build them, you can significantly enhance your productivity and AI effectiveness.
Start by identifying small tasks, building loops with existing skills, and iteratively improving with verification and memory.
This approach not only saves time and tokens but also develops your problem-solving skills in AI workflows.
If you want to dive deeper, consider exploring resources on Claude skills and loop orchestration to 10x your output.
Happy loop building!
Paste a YouTube link and let Magica create the key takeaways.
Summarize another video