Stop Prompting Claude. Start Loop Engineering.
Rethinking AI Interaction: The Shift from Prompting to Loop Engineering
Introduction to Loop Engineering
- Boris Cherny, creator of Claude code, emphasizes a paradigm shift in AI usage: moving from prompting to designing loops.
- Peter Steinberg echoes this sentiment, suggesting that users should focus on building loops for coding agents rather than traditional prompts.
Understanding Loops vs. Prompts
- A loop is defined as a prompt that runs continuously until a specific task is completed, contrasting with one-time prompts.
- Boris explains his current workflow: he no longer prompts Claude directly; instead, he writes loops that automate the prompting process.
When to Use Loops
- Four conditions determine when to create a loop:
- Repetitive Task: Is the task something that repeats?
- Clear Definition of Done: Is there a clear way to define when the task is complete?
- Affordability of Waste: Can you afford potential token waste during execution?
- Necessary Tools Availability: Does the loop have all tools required for task completion?
Building Successful Loops
Key Components of Effective Loops
- The first building block is the trigger, which initiates the loop. Three simple methods include:
- Using
slash loopfor local machine tasks.
- Using
slash schedulefor cloud-based automation at specified times.
- Custom orchestration skills for comprehensive control over loops.
Execution Skills and Their Importance
- Execution skills are saved instructions allowing Claude to perform tasks consistently without retyping prompts.
- Each execution skill must be battle-tested; they ensure reliability in achieving desired outcomes within loops.
Goals and Verification in Loop Development
Establishing Goals and Verification Methods
- Every loop requires both a goal (what needs to be accomplished) and verification (how success will be confirmed).
- Technical examples involve measurable goals like website performance metrics; non-technical tasks require creative verification strategies.
Bridging Abstract Tasks with Verifiable Outcomes
- For non-measurable tasks, establish clear checkpoints using existing skills (e.g., email drafting verification through multiple review skills).
Output Management and Memory in Loops
Importance of Output and Memory Tracking
- Every loop generates output but also needs memory tracking to avoid repeating past mistakes or wasting resources.
- Documenting results helps improve future iterations by learning from previous outputs.
Practical Steps for Building Your First Loop
Starting Small with Skill-driven Development
- Begin by identifying small, proven tasks suitable for looping based on earlier discussions about conditions and components.
Utilizing Prompts Effectively
- Use provided prompts tailored towards building effective loops while leveraging past session history for inspiration.
Training Mode and Verification Checkpoints
Implementing Training Mode in New Loops
- Initially set new loops to pause at each step for user approval before proceeding—this ensures accuracy before full automation begins.
Key Checkpoints in Non-measurable Tasks
- Break down complex goals into smaller segments where human verification can occur at critical decision points throughout the process.