Loop
Use this skill to run supervised autonomous loops without drifting from the user's goal.
Loop Contract
Before starting, define:
- objective: the concrete target state
- cadence: how often to check or iterate
- max rounds or time limit
- stop conditions
- rollback or pause conditions
- verification signal
If the user did not specify limits, choose conservative defaults:
- max rounds: 5
- pause on destructive operations, unclear requirements, credential exposure, or repeated identical failure
- verify after every round with the closest reliable check
Iteration Pattern
For each round:
- Inspect current state and last failure.
- Select the smallest next action.
- Execute the action.
- Run the agreed verification.
- Record status:
LOOP_CONTINUE: progress made, more work remainsLOOP_PASS: objective metLOOP_BLOCKED: needs user input or external resourceLOOP_STOP: unsafe or no useful progress
When To Stop
Stop immediately when:
- the objective is met
- the same failure repeats after two different fixes
- a security or privacy issue appears
- changes would exceed the requested scope
- tests require unavailable external services and no safe mock exists
- continuing would require destructive file, database, or git operations not requested by the user
Status Report
For long loops, provide compact updates:
- round number
- action taken
- verification result
- next action or stop reason
Final report should include:
- final status
- changed files or artifacts
- verification commands and results
- remaining risks or manual follow-up
Related Skills
Combine with:
verification-before-completionbefore claiming completionsystematic-debuggingwhen failures are unclearrequesting-code-reviewfor substantial code changessimplifywhen the loop is fighting unnecessary complexity