Build structured prompts for Ralph loops with TDD guidance, progress tracking, verification steps, and escape hatches. Invoke when starting a Ralph-based development task, creating orchestrated iteration loops, or converting PRDs to executable Ralph prompts. Wraps the official ralph-loop plugin to maximize loop success rates through careful prompt engineering and persistent state management.
/plugin marketplace add app-vitals/marketplace/plugin install app-vitals-ralph-orchestrator-plugins-ralph-orchestrator@app-vitals/marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
assets/templates/agents_template.mdassets/templates/plan_template.jsonassets/templates/plan_template.mdassets/templates/prd_template.jsonassets/templates/prd_template.mdassets/templates/progress_template.mdreferences/escape-hatches.mdreferences/prompt-patterns.mdreferences/story-sizing.mdBuild structured, scaffolded prompts for Ralph loops that maximize success rates through:
Ralph loops succeed when Claude has:
This skill builds prompts that embed all these elements.
The official ralph-loop plugin creates a self-referential feedback loop:
Key insight: The prompt never changes between iterations. Claude's "memory" comes from:
This skill builds prompts that leverage these persistence mechanisms.
Determine input mode from the invocation context:
PRD Mode (if .claude/ralph/<task-name>/prd.json exists):
"passes": true)<promise>ALL STORIES PASS</promise>Plan Mode (if .claude/ralph/<task-name>/plan.json exists):
"complete": true)<promise>ALL PHASES COMPLETE</promise>Raw Freeform Mode (if neither PRD nor plan exists):
<promise>TASK COMPLETE</promise>Ensure working files exist in .claude/ralph/<task-name>/:
progress.md - Create from template if not exists:
assets/templates/progress_template.md.claude/ralph/<task-name>/progress.mdAGENTS.md - Create from template if not exists:
assets/templates/agents_template.md.claude/ralph/<task-name>/AGENTS.mdThe master prompt is fed to Claude each iteration. It must be:
Build the prompt using this structure:
# Ralph Loop Task: <task-name>
## Your Mission
<problem statement from PRD or freeform prompt>
## Completion Criteria
When ALL of the following are true, output exactly: <promise>ALL STORIES PASS</promise>
<list each success criterion as a checkbox>
**CRITICAL**: Do NOT output the completion promise unless ALL criteria are actually met. The loop will continue until you output this exact text or max iterations is reached.
---
## CRITICAL INSTRUCTIONS
You are in a Ralph loop. Each iteration, you receive this same prompt. Your memory persists ONLY through files on disk. Follow these instructions exactly.
### 1. Read State First (EVERY ITERATION)
Before doing ANY work, read these files to understand current state:
- `.claude/ralph/<task-name>/progress.md` - What you've learned, where you are, what iteration you're on
- `.claude/ralph/<task-name>/AGENTS.md` - Persistent patterns and architectural decisions
- `.claude/ralph/<task-name>/prd.json` - Current story status (which stories pass)
**DO NOT** start working until you've read these files. They contain your memory from previous iterations.
### 2. Progress Tracking (MANDATORY)
After EACH meaningful action, update `.claude/ralph/<task-name>/progress.md`:
**Learnings section** (append-only):
[Iteration N] <what you learned>
Example:
[Iteration 3] Database requires await on pool.connect() before queries [Iteration 4] Test file must be named *.test.ts to be discovered
**Current State section**:
- Update "Working on" with current focus
- Update "Current Story" with active story ID
- Update "Last verification" with most recent test/check result
- Increment "Attempts on current issue" if retrying same problem
**Story Status section**:
- Check off stories as they pass: `- [x] US-001: Create endpoint`
**Iteration History section**:
- Add brief entry for this iteration
### 3. Context Health
**Commit frequently**:
- After each passing test
- After each working feature
- Use descriptive commit messages
- This creates recovery points
**Summarize on milestones**:
- When completing a story, add insights to AGENTS.md
- Document patterns discovered, architectural decisions
- Keep AGENTS.md as distilled knowledge
**Archive if progress.md grows large**:
- If > 300 lines, move old iterations to progress_archive.md
- Keep active iteration history manageable
### 4. TDD Workflow
For each story or feature:
1. **Write test FIRST**
- Define what success looks like in code
- Test should be specific and focused
2. **Run test - confirm it FAILS**
- This proves the test is valid
- If it passes, test may be wrong
3. **Implement minimal code**
- Just enough to make test pass
- Don't over-engineer
4. **Run test - confirm it PASSES**
- If fails, debug and fix
- Update progress.md with learnings
5. **Refactor if needed**
- Clean up while tests still pass
- Run tests after refactoring
6. **Commit and document**
- Commit working code
- Update progress.md
- Update AGENTS.md if pattern discovered
### 5. Verification Steps
<verification method from PRD>
Run verification after implementing each story:
- **Command**: `<verification command if applicable>`
- **Expected result**: <what success looks like>
- **If verification fails**: Note in progress.md, attempt fix, re-verify
### 6. Escape Hatches
**If stuck after 3 attempts on the same issue**:
1. **Document the issue** in progress.md:
2. **Try ONE alternative approach**:
- Different library or method
- Simplified implementation
- Ask if requirement can be relaxed
3. **If still stuck after alternative**:
- Mark story as BLOCKED in prd.json: `"blocked": true, "blocked_reason": "..."`
- Add to "Blocked Stories" section in progress.md
- Move to NEXT story (don't spin forever)
4. **If ALL stories are blocked**:
- Create comprehensive summary in progress.md
- List all blockers and what was attempted
- Do NOT output false completion promise
- The loop will continue until max iterations
**Never output the completion promise to escape a difficult situation. That defeats the purpose of the loop.**
### 7. Project CLAUDE.md Updates
After completing a story/phase, check if any learnings should be promoted to the project-level CLAUDE.md:
**Promote to CLAUDE.md when:**
- Discovered a project-wide convention (naming, structure, patterns)
- Found a command or workflow that applies beyond this task
- Identified a gotcha that future tasks should know about
- Established an architectural decision affecting the whole project
**Do NOT promote:**
- Task-specific implementation details
- Temporary workarounds
- Learnings only relevant to this feature
**Update format:**
Append to CLAUDE.md under a "## Discovered Patterns" or relevant existing section:
**Location:**
- Read: `./CLAUDE.md` (project root)
- Write: Append new patterns, never remove existing content
**Relationship to AGENTS.md:**
- AGENTS.md = Task-specific patterns (stays in `.claude/ralph/<task>/`)
- CLAUDE.md = Project-wide conventions (promoted from AGENTS.md)
---
## User Stories
<For PRD mode, list all stories from prd.json>
### Current Focus: <first non-passing, non-blocked story>
**Story ID**: <id>
**Title**: <title>
**Description**: <description>
**Acceptance Criteria**:
<list criteria as checkboxes>
**Verification**: <story-specific verification>
### Remaining Stories
<list other stories with status indicators>
- [ ] US-002: <title>
- [ ] US-003: <title>
- [x] US-001: <title> (PASS)
- [BLOCKED] US-004: <title>
---
## What To Do Now
1. **Read state files** - progress.md, AGENTS.md, prd.json, and ./CLAUDE.md
2. **Identify current iteration** from progress.md
3. **Determine current story** - first non-passing, non-blocked story
4. **Check attempt count** - if 3+ attempts on same issue, use escape hatch
5. **Follow TDD workflow** for current story
6. **Update progress.md** after each action
7. **Run verification** when story seems complete
8. **Update prd.json** when story passes: `"passes": true`
9. **Update AGENTS.md** with task-specific patterns discovered
10. **Promote to CLAUDE.md** any project-wide conventions discovered
11. **Commit working code** with descriptive message
12. **Move to next story** until all pass
13. **When ALL criteria met**, output: <promise>ALL STORIES PASS</promise>
---
## Remember
- You are in a LOOP - your work from previous iterations is in the files
- READ STATE FIRST every iteration (progress.md, AGENTS.md, prd.json, CLAUDE.md)
- NEVER output the completion promise unless it's TRUE
- Commit often, document always
- If stuck 3 times, use escape hatch - don't spin forever
- Progress through stories methodically
- Your learnings in progress.md help future iterations avoid mistakes
- Promote project-wide patterns to CLAUDE.md, keep task-specific in AGENTS.md
Output the complete master prompt ready for the /ralph command:
Master prompt built for Ralph loop.
**Summary**:
- Task: <task-name>
- Mode: <prd|freeform>
- Stories: <count> (<passing> passing, <blocked> blocked)
- Current focus: <first incomplete story>
- Completion promise: "ALL STORIES PASS"
**Working files**:
- .claude/ralph/<task-name>/progress.md
- .claude/ralph/<task-name>/AGENTS.md
- .claude/ralph/<task-name>/prd.json
- ./CLAUDE.md (project root - for project-wide patterns)
The master prompt includes:
- Mission and completion criteria
- State file reading instructions
- Progress tracking requirements
- TDD workflow guidance
- Verification steps
- Escape hatch patterns
- Story list with status
Ready to invoke ralph-loop with this prompt.
Everything Claude needs to succeed must be in the prompt. The prompt is fed fresh each iteration - Claude doesn't remember previous iterations except through:
Since Ralph loops re-feed the same prompt, persistent files are how Claude "remembers":
Stories should be completable in 1-3 iterations. If a story takes more than 5 iterations:
Every story must have a verification method. Without it, Claude can't objectively know when it's done. Prefer automated verification (tests, type checks) over manual.
When stuck, Claude should:
When .claude/ralph/<task-name>/plan.json exists (created via /ralph-freeform):
Key differences from PRD mode:
<promise>ALL PHASES COMPLETE</promise>Master prompt adaptations for Plan Mode:
prd.json references with plan.jsonPhase Status in plan.json:
{
"id": "P1",
"name": "Phase name",
"steps": ["step 1", "step 2"],
"verification": "How to verify",
"complete": true, // Update when phase done
"notes": "Any notes from implementation"
}
What To Do Now (Plan Mode):
"complete": true<promise>ALL PHASES COMPLETE</promise>When neither PRD nor plan exists (raw prompt passed to /ralph):
<promise>TASK COMPLETE</promise>Load these for detailed guidance:
This skill builds the prompt; the actual looping is handled by the official ralph-loop plugin:
/ralph-loop "<master-prompt>" --max-iterations <N> --completion-promise "ALL STORIES PASS"
The stop hook in ralph-loop:
Our progress.md, AGENTS.md, and prd.json provide the persistent context that makes each iteration productive.
This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.