/loop

> Run an iterative refinement loop until a quality threshold is met.

170 stars

Best use case

/loop is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

> Run an iterative refinement loop until a quality threshold is met.

Teams using /loop should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/loop/SKILL.md --create-dirs "https://raw.githubusercontent.com/Miosa-osa/canopy/main/library/skills/workflow/loop/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/loop/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How /loop Compares

Feature / Agent/loopStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

> Run an iterative refinement loop until a quality threshold is met.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# /loop

> Run an iterative refinement loop until a quality threshold is met.

## Usage
```
/loop "<task>" --until "<condition>" [--max-iterations <n>]
```

## What It Does
Executes a task repeatedly, evaluating the output against a quality condition after each iteration. Continues refining until the condition is met or max iterations reached. Each iteration builds on the previous output. Useful for progressive improvement of content, code, or designs.

## Implementation
1. **Initial execution** -- run the task, produce first output.
2. **Evaluate** -- check output against the condition (quality score, test pass, criteria met).
3. **Refine** -- if condition not met, identify gaps and re-execute with improvements.
4. **Repeat** -- continue until condition met or max iterations (default: 5).
5. **Report** -- iteration log showing progression and final output.

## Examples
```bash
# Refine until tests pass
/loop "fix failing tests in auth module" --until "all tests pass" --max-iterations 3

# Refine content quality
/loop "write pitch for AI Masters" --until "S/N score > 0.8"

# Iterative optimization
/loop "optimize query performance" --until "p99 < 200ms" --max-iterations 5
```