About this skill
Slash command /loop: repeat a prompt or task in iterations until a completion goal is verifiably met, with evidence checks, strategy changes on repeated failure, and a max-iteration safety cap. Use when the user says /loop or asks to loop a prompt until done.
SKILL.md 40 lines · Skill instructions Show code Hide code
# /loop — Loop a Prompt Until the Completion Goal Is Met
Repeat a prompt/task in iterations, checking after each one whether the completion goal is met. Do not stop until the goal is verifiably achieved or a hard stop condition fires.
## Input Format
```
/loop <prompt> until <completion goal> [max <N> iterations]
```
- **prompt** — the task to execute each iteration
- **completion goal** — concrete, checkable condition that defines "done"
- **max iterations** — optional safety cap, default **10**
Examples:
- `/loop run the build and fix errors until the build succeeds`
- `/loop refactor the module and run tests until all tests pass max 5 iterations`
## Procedure
1. **Parse** the prompt, the completion goal, and the iteration cap (default 10).
2. **Iterate** (iteration 1..N):
a. Execute the prompt using the best available tools (terminal, browser, MCPs, file edits, widgets).
b. **Verify with real evidence** — read actual command output, file contents, tool results, or screenshots. Never assume success.
c. **Evaluate the goal** against that evidence:
- **Met** → report success with the evidence and stop.
- **Not met** → identify the exact gap, adjust the approach, continue to the next iteration.
3. **Stop conditions** (report honestly, never fake success):
- Goal met → success summary with evidence.
- Max iterations reached → last state, what is still blocking, and the recommended next step.
- Hard error (missing credentials, tool unavailable, destructive risk) → stop immediately and report.
## Rules
- NEVER end the turn with the goal unmet and no stop condition triggered. Keep looping.
- If the same approach fails twice in a row, change strategy — do not repeat identical failing actions.
- Each iteration must make measurable progress toward the goal; state the delta between iterations.
- Read output after every action (wait, then read_terminal / screenshot_widget / inspect_widget) before judging the goal.
- Keep a brief iteration log: `#N → action → result → gap`.
- Final reply: goal status (met / not met), iterations used, and evidence.