# Loop Patterns

> Recommended /loop patterns for the agents shipped in this repo (explorer, implementer, reviewer, qa, skill-author). Activates when the user asks about /loop, polling, watch-mode, periodic tasks, or autonomous iteration.

- Skill: `mike-diff/loop-patterns-2` (Agent Skill)
- Install (CLI): `npx skillmds@latest add mike-diff/loop-patterns-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/mike-diff/loop-patterns-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: mike-diff (https://skillmd.com/u/mike-diff)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/mike-diff/loop-patterns-2

---


# /loop patterns per agent

The `/loop` command runs a prompt or slash command on a recurring interval, or self-paces via ScheduleWakeup when no interval is given. These patterns match the responsibilities of the five agents in `.claude/agents/`.

## explorer — periodic codebase crawl

Best when the codebase shifts rapidly (active development, frequent merges).

    /loop 15m Explore changes since the last crawl and append new findings to .context/explorer-notes.md

Cadence: 10–30 minutes. Good for: pre-implementation recon during long discussions.

## implementer — self-paced watch-build

When implementing a long feature across many edits. Omit the interval so ScheduleWakeup picks delays based on build duration.

    /loop Continue building the current feature spec; after each iteration, run the project's build and paste any new errors into the next prompt.

Cadence: self-paced. Good for: large spec phases, CI-heavy projects.

## reviewer — post-edit incremental review

    /loop 20m Review all files modified since the last review pass and flag any that violate `.claude/rules/coding-standards.md`.

Cadence: 15–30 minutes. Good for: keeping a running review in parallel with implementer.

## qa — watch-test loop

    /loop 5m Run the project's test command; if any fail, message the implementer with the full failure output.

Cadence: 5–15 minutes. Good for: active red-green TDD sessions.

## skill-author — TDD drip

Uncommon; used during long skill authoring when the baseline test suite is slow.

    /loop Re-run the skill baseline test after each edit to .claude/skills/<name>/SKILL.md.

Cadence: self-paced. Good for: multi-file skill authoring.

## spec phases — goal-gated cross-phase walk

Solo (no agent team), one session, auto-advance each phase only after its Goal Condition is met:

    /loop Set /goal to the next not-yet-done phase's Goal Condition from @.context/specs/spec-[name].md; when /goal reports "Goal achieved", commit, then advance. Stop when the last phase's goal is achieved.

`/loop` re-runs the prompt in the same session; `/goal` is the per-phase completion judge that `/loop` lacks. They're independent — `/goal` can't invoke `/loop`, so the loop prompt re-sets the goal each iteration. Prefer `/agent-team:dev @<spec>` (sweep) for hands-off team runs; use this for solo single-session control.

Cadence: self-paced. Good for: solo spec implementation without an agent team.

## Bare /loop and loop.md

A bare `/loop` (no prompt) runs a maintenance prompt at a self-paced interval:
Claude Code uses `.claude/loop.md` if the project ships one (falling back to
`~/.claude/loop.md`, then the built-in prompt of continue-unfinished-work /
tend-the-PR / cleanup). Ship a `.claude/loop.md` in the project to tune the
pass to its own validation scripts. Supplying any prompt on the command line
bypasses the file.

## Not recommended

- Running `/loop` on one-shot tasks — starts a recurring process that outlives the task
- Cadences under 60 seconds — the runtime clamps `delaySeconds` to [60, 3600]
- Loops that accumulate unbounded context — pair with summarize-and-reset instructions

