skills/loop-driver/SKILL.md
Reference document shared by /shovel-ready, /kaizen, and /bughunt for their common autonomous-loop machinery (branching, /ship handoff, /retro pass, merge handling, idle escalation, flag passthrough). NOT user-invokable. Only load when one of the three loop specializations explicitly directs you here.
npx skillsauth add eumemic/dev-skills loop-driverInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Don't invoke this directly. This skill is loaded by
/shovel-ready,/kaizen, and/bughuntfor the phases they share. If a user types/loop-driver, redirect them to one of the three specializations.
This document defines the common skeleton for an autonomous-development loop driver: take a target, ship it on a branch through dev-skills:ship, run a per-iteration /retro pass, merge, then either re-arm or escalate. Each specialization (/shovel-ready, /kaizen, /bughunt) plugs in its own target acquisition logic at Phase 1; everything else lives here.
| Phase | Owner | Description |
|---|---|---|
| 1 | Specialization | Target acquisition. How a candidate is found (issue queue, parallel-agent audit, etc.). |
| 1.5 | Specialization | Quality gate. Top candidate must clear a specialization-defined bar; otherwise the iteration ships nothing (a normal outcome). |
| 2 | loop-driver | Branch and plan. |
| 3 | Specialization | Implement. Specialization-specific discipline (TDD vs. structural-only vs. labeled-issue-feature work). |
| 4 | loop-driver | Hand off to dev-skills:ship. |
| 5 | loop-driver | /retro pass — iteration mode. |
| 6 | loop-driver | Merge (auto or wait-for-user). |
| 7 | loop-driver | Reset idle counter. |
| 8 | loop-driver | Loop control (re-arm or escalate). |
All three specializations share these flags. Pass them through verbatim on every self-arming ScheduleWakeup.
--auto — merge automatically once CI passes (gh pr merge --squash --delete-branch). Default: wait for the user to merge in the GitHub UI.--once — run a single iteration; do not ScheduleWakeup at the end. Default: loop indefinitely. (/shovel-ready doesn't expose --once because the queue's natural emptiness already provides a stop condition.)--model=<sonnet|opus|haiku> — pin spawned subagents to a specific Claude generation. Applied at every subagent spawn point this loop owns: the specialization's Phase 1 audit agents, and the code-reviewer subagent inside /ship (passed through verbatim via --model=). The main session keeps whatever model it started on; this flag only affects Agent-tool calls. Default (omitted): no model: parameter — subagents inherit the session's model.--idle-count=<N> — internal carry-over for the empty-iteration streak counter (Phase 8). Don't set manually.Flags compose. Self-arming wakes preserve every flag the user originally invoked with, plus mutations to --idle-count.
ScheduleWakeup-driven re-entries lose conversation context; the prompt itself must be self-describing.CLAUDE.md), the model sees raw errors and retries through the session log. Don't suppress.Every loop driver has a temptation to find SOMETHING every iteration to justify the wake. Resist this.
The quality gate is the per-iteration version of the idle-escalation Phase 8 mechanism. Phase 8 catches "audit found nothing." Phase 1.5 catches "audit found things, but none clear the bar." Both are healthy outcomes; both feed into idle-count.
What "clearing the bar" means is specialization-specific:
/shovel-ready: implicit — issues bearing the label have already cleared a human-applied bar. The gate barely applies in Execute mode. (It does apply during Audit mode, when deciding whether to label unlabeled candidates.)/kaizen: top candidate must be unambiguously accidental complexity, not borderline ("might be load-bearing"). A net-positive line count is a yellow flag./bughunt: top candidate must have provability ≥ 0.6 AND severity-on-real-paths above triviality. A reachable bug that no one would ever notice isn't worth a PR./retro (when invoked from the loop-driver Phase 5): findings must be codifiable as durable artifacts (memory, skill edit, script, repo issue) — not just session-local "huh, that was annoying."If the top candidate doesn't clear the bar, report what was found and why the bar wasn't met, then proceed to Phase 8 as if the iteration were empty. Don't silently ship a borderline change because "we have to ship something."
default=$(gh repo view --json defaultBranchRef --jq .defaultBranchRef.name)
git fetch origin "$default"
git checkout -b <prefix>/<short-slug> "origin/$default"
Branch prefix and slug convention is specialization-specific:
/shovel-ready: descriptive name including the issue number if convention allows./kaizen: kaizen/<3–5-word-kebab-case> naming the target (e.g., kaizen/collapse-defer-retry-wake)./bughunt: bughunt/<short-symptom-slug> naming the symptom, not the fix (e.g., bughunt/missing-roster-on-group-rename).Plan with TaskCreate: implement → /ship → /retro → merge → loop control. Mark in_progress as you start each step.
dev-skills:shipInvoke dev-skills:ship via the Skill tool. Pass:
--commit-type=<fix|feat|refactor> — see specialization for default.--commit-scope=<topmost-changed-module>.--summary=<one-line description> — used as the PR title.--issue=<N> if applicable. Load-bearing for /shovel-ready (auto-close on merge); optional for /bughunt (only if the bug was already filed); not applicable to /kaizen.--model=<value> if --model= was passed to the loop. /ship applies it to its code-reviewer subagent./ship runs project checks, /simplify pass, code-review subagent (if configured), commits, pushes, opens the PR, and monitors CI until all checks are terminal. It returns when CI is green.
If /ship reports a failing check or a sev ≥ 80 review finding requiring design changes, treat as a blocker — diagnose, fix, re-invoke /ship. Don't skip ahead to Phase 5.
/ship does NOT merge. Merge is owned by Phase 6 of this driver.
/retro pass (iteration mode)After /ship returns with CI green and before Phase 6 merge, invoke dev-skills:retro via the Skill tool with --scope=iteration. Retro reflects on this iteration's friction signals (not the whole session) and produces zero or more action items:
/ship, /retro itself, or other invoked skills.The retro applies its own quality gate: most iterations should produce nothing. "No actionable findings this round" is the expected default. See dev-skills:retro for details.
If retro produces skill edits or scripts that affect the current branch's repo, commit and push them to the same PR. CI will re-run; wait for it green again before proceeding to Phase 6. If retro produces memory entries or repo issues that don't touch the current branch, those are lightweight side effects — proceed directly to Phase 6.
If retro escalates a question via AskUserQuestion, answer it before proceeding. Don't merge with retro work pending.
--auto was passedgh pr merge <N> --squash --delete-branch
Verify: gh pr view <N> --json state,mergedAt. If the merge succeeds on GitHub but the local checkout fails (e.g., "master is already used by another worktree"), that's harmless — the merge is on the server. Proceed to Phase 7.
For /shovel-ready only: also verify auto-close with gh issue view <N> --json state (should be CLOSED). If still OPEN, the PR body is missing a Closes #N line; fix with gh pr edit <N> and re-check.
Persistent Monitor polling gh pr view:
PR=<pr-number>
prev=""
while true; do
state=$(gh pr view "$PR" --json state --jq .state 2>/dev/null || echo "ERR")
if [ "$state" != "$prev" ]; then
echo "PR #$PR state: $state"
prev="$state"
fi
case "$state" in
MERGED|CLOSED) break ;;
esac
sleep 60
done
persistent: true. Optionally PushNotification once CI is green (and again post-retro): "PR #N green and ready for your merge."
When MERGED: report and proceed to Phase 7.
When CLOSED without merge: the user rejected the change.
/shovel-ready: comment on the originating issue explaining what was attempted, so the next iteration doesn't re-pick it without context./kaizen: record the rejected target in conversation context so the next iteration's audit doesn't re-pick it./bughunt: record the rejected symptom so the audit doesn't re-discover it.A productive iteration (PR merged or closed-without-merge after a real attempt) means we found something this round. Reset --idle-count to 0 for the next wake.
A non-productive iteration (Phase 1.5 quality gate killed the iteration before branching) does NOT reset the counter — see Phase 8.
If --once was passed, stop here. Report the iteration outcome and exit.
Otherwise, decide cadence and re-arm:
Re-arm immediately:
ScheduleWakeup({
delaySeconds: 60,
prompt: "/<skill><pass-through flags>",
reason: "<skill> iteration complete; immediately scanning for next candidate."
})
(Pass through --auto if set; never set --once in self-arms.)
Increment --idle-count by 1.
idle-count < 3 — long-cadence re-arm (codebase looks clean for now; check back in an hour):
ScheduleWakeup({
delaySeconds: 3600,
prompt: "/<skill> --idle-count=<N+1><other-flags>",
reason: "<skill>: no candidate cleared the bar; idle streak <N+1>; long-cadence re-audit."
})
idle-count == 3 — escalate via AskUserQuestion:
prompt="/<skill><other-flags>".ScheduleWakeup, stop any active Monitors, report the loop is paused.idle-count > 3 — only happens if the user said "Keep going" at the 3-mark; treat the same as < 3 from there.
/shovel-ready Wait Mode and /bughunt//kaizen empty audits use the long cadence. Productive iterations re-arm at 60s./simplify and the code-review subagent (if configured) catch issues of different types. If neither is configured, do them manually before opening the PR.AskUserQuestion mid-iteration when:
/ship that flips the design.When in doubt, ask. The marginal cost of a question is small; the marginal cost of a bad PR is the rest of the loop's credibility.
testing
This skill should be used when the user asks to "test this feature", "verify this works", "run tests", "check if this is working", "test thoroughly", or mentions testing a specific feature or fix.
tools
Drive a GitHub `shovel-ready` issue queue end-to-end — pick highest-ROI, TDD, /ship, /retro, merge; when empty, audit closed work and unlabeled candidates to refill it; otherwise wait for new labels. Use when the user invokes `/shovel-ready`, asks to "work the shovel-ready queue", "drain shovel-ready", "drive issues to merge", "autopilot on labeled issues", "issue-label queue", or sets up an autonomous-development loop on a GitHub-labeled issue tracker. GitHub-specific (uses `gh` CLI); skip for GitLab/Jira.
development
Drive a code change from working tree to a green PR — runs project checks, /simplify, code-review subagent, commits, opens PR, monitors CI. Stops when CI is green; caller handles merge. Use when invoked as `/ship`, or when another skill (e.g., `/shovel-ready`, `/kaizen`, `/bughunt`) hands off a working tree of changes to be shipped. Project-agnostic; reads check commands from CLAUDE.md.
development
Reflect on a slice of the current session (a single iteration, the whole session, or a natural pause point) to identify durable, codifiable learnings about workflow OR dev infrastructure — and ship them only if they clear a quality bar. Most invocations produce nothing; that's the point. Use when the user asks to "run a retro", "do a retrospective", "reflect on the session", "what did you learn", "improve skills based on this session", "codify learnings"; when invoked from a loop driver (`/shovel-ready`, `/kaizen`, `/bughunt`) with `--scope=iteration`; or **proactively at pause points** when the agent is waiting on async work (CI, autodev runs, monitor events) and has cycles to think meta.