Per-task ralph loop pattern for implementation and debugging. One loop per task, not one loop per feature.
Enforces per-task verification loops for implementation and debugging. Triggers when dev-implement or dev-debug starts a task, spawning Task agents until tests pass or bugs are fixed, then outputs a completion promise before moving to the next task.
/plugin marketplace add edwinhu/workflows/plugin install workflows@edwinhu-pluginsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Announce: "I'm using dev-ralph-loop to set up verification loops."
ONE LOOP PER TASK. NOT ONE LOOP PER FEATURE. This is not negotiable.
A single feature-level loop provides ZERO per-task enforcement. You can just move to the next task without the loop actually gating anything.
Each task in PLAN.md gets its own ralph loop with its own completion promise. </EXTREMELY-IMPORTANT>
For task N in PLAN.md (1, 2, 3, ...):
1. Start ralph loop for task N
2. Inside loop: spawn Task agents, iterate until done
3. Output promise → loop ends
4. Move to task N+1, start NEW ralph loop
Why per-task loops?
IMPORTANT: Avoid parentheses () in the prompt - they break zsh argument parsing.
Use dashes or brackets instead.
/ralph-wiggum:ralph-loop "Task N: [TASK NAME]" --max-iterations 10 --completion-promise "TASKN_DONE"
/ralph-wiggum:ralph-loop "Debug: [SYMPTOM]" --max-iterations 15 --completion-promise "FIXED"
| Parameter | Purpose | Recommendation |
|---|---|---|
| Prompt | What this loop is for | Be specific: "Task 2: Add auth service" |
--max-iterations | Safety limit | 10 for implementation, 15 for debugging |
--completion-promise | The completion gate | Unique per task: TASK1_DONE, TASK2_DONE, etc. |
Each iteration follows this pattern:
Task(subagent_type="general-purpose", prompt="""
[TASK-SPECIFIC INSTRUCTIONS]
Context:
- Read .claude/LEARNINGS.md for prior attempts
- Read .claude/SPEC.md for requirements
- Read .claude/PLAN.md for approach
Report back: what was done, results, any blockers.
""")
After Task agent returns:
If complete: Output the promise
<promise>TASKN_DONE</promise>
If incomplete: Do NOT output promise. Spawn another Task agent to continue.
<EXTREMELY-IMPORTANT> ## Promise RulesYou may ONLY output the promise when the statement is COMPLETELY AND UNEQUIVOCALLY TRUE.
The promise is a claim that:
You may NOT output the promise to:
If the promise isn't true, don't output it. Keep iterating. </EXTREMELY-IMPORTANT>
When you output the promise, the ralph loop ends. Then:
## Task 1: Create types
/ralph-wiggum:ralph-loop "Task 1: Create types" --max-iterations 5 --completion-promise "TASK1_DONE"
[Spawn Task agent → implements types]
[Verify: tsc --noEmit passes]
<promise>TASK1_DONE</promise>
## Task 2: Add service method
/ralph-wiggum:ralph-loop "Task 2: Add service method" --max-iterations 10 --completion-promise "TASK2_DONE"
[Spawn Task agent → implements method]
[Verify: tests fail → iterate]
[Spawn Task agent → fixes tests]
[Verify: tests pass]
<promise>TASK2_DONE</promise>
## Task 3: Add route handler
/ralph-wiggum:ralph-loop "Task 3: Add route handler" --max-iterations 10 --completion-promise "TASK3_DONE"
[Spawn Task agent → implements route]
[Verify: integration test passes]
<promise>TASK3_DONE</promise>
## All tasks complete
These thoughts mean STOP—you're about to skip enforcement:
| Thought | Reality |
|---|---|
| "One loop for the whole feature" | NO. One loop PER TASK. Feature loops don't enforce. |
| "I'll just move to the next task" | Did the current task's loop complete? If no loop, no gate. |
| "Per-task loops are overhead" | Per-task loops are the ONLY enforcement. |
| "Ralph is for hard problems" | Ralph is for ALL tasks. Simple tasks need gates too. |
| "I'll iterate without the loop" | Without ralph, you'll declare done prematurely. |
| "The ceremony isn't worth it" | The ceremony IS the value. It prevents shortcuts. |
| "I'll cherry-pick the parts I need" | Skills are protocols, not menus. Follow all of it. |
| "Tests passed on first try, skip loop" | Still need the loop structure. Lucky ≠ verified. |
| "Task done, let me check in" | NO. Start next task's loop immediately. |
| "User might want to review" | User wants ALL tasks done. Keep going. |
| "Natural pause point" | Only pause when ALL tasks complete. |
Each task needs its own ralph loop. One feature loop provides ZERO per-task enforcement.
After outputting a promise, IMMEDIATELY start the next task's loop. Do NOT pause for user review.
Ralph loops are for:
Ralph loops are NOT for:
This skill is invoked by:
dev-implement - for implementation tasksdev-debug - for bug investigation and fixesAfter all tasks complete, proceed to the next phase of the parent workflow.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.