- spec-interview → Gather comprehensive requirements through guided discovery
- generate-prd → Create actionable Product Requirements Document
- ralph-convert-prd → Transform PRD into atomic user stories (prd.json)
- Subagent execution → Spawn ralph-coder/ralph-tester subagents via Task tool
This skill coordinates these tools while keeping you in control at decision points.
ALL code implementation MUST happen through subagents — ralph-coder implements production code, ralph-tester writes tests and verifies. You are the orchestrator, NOT the implementer. Do not write code, create files, modify source files, or make any project changes directly.
If you catch yourself about to write code or modify project files: STOP. Spawn a subagent instead.
Do NOT try to fix issues yourself, retry automatically, or continue past errors. Present the error clearly to the user and wait for their instructions.
This maximizes throughput while maintaining correct dependency ordering.
Separation gives each agent a focused context window. The orchestrator wraps ANY agent with Ralph context (story spec, return format, constraints) so even non-Ralph agents integrate seamlessly.
This lets users configure best-practice agents for their stack, and Ralph automatically uses them.
Both agents also update the docs/ folder with documentation about new features, APIs, test setup, and architecture changes. The tasks/test-log.md and tasks/review-notes.md files are updated by tester agents with test registries and improvement recommendations.
Never assume agents "remember" previous stories — but they CAN read shared knowledge files.
Right-sized:
- Add a database column
- Create a UI component
- Update a server action
- Implement a filter
Too large (will fail):
- Build entire dashboard
- Add authentication system
- Refactor entire API
- API stories: curl endpoints with real data, check response codes and bodies
- UI stories: Playwright e2e tests that navigate and interact with real UI
- Database stories: Run migrations, query DB directly to confirm schema
- Infra stories: Health checks, config validation, service startup
Static checks (typecheck, lint) are baseline. Runtime validation is required.
After each story, the tester runs ALL existing tests (via testCommands in prd.json root) to catch regressions. A story is NOT done until the entire test suite passes.
Stories track attempts / maxAttempts to prevent infinite retries on broken stories.
Don't rush. Bad requirements = wasted iterations.
Expect matchers for verificationCommands:
exit_code:0 — command exits with code 0
exit_code:N — command exits with specific code N
contains:STRING — stdout contains STRING
not_empty — stdout is non-empty
matches:REGEX — stdout matches regex pattern
- Full pipeline - Start from scratch (spec → PRD → prd.json → execute)
- Continue from PRD - Already have PRD, convert and execute
- Execute only - Already have prd.json, run Ralph
- Check status - View current prd.json progress
Wait for response before proceeding.
After reading the workflow, follow it exactly.
Key Files:
| File |
Purpose |
| SPEC.md |
Comprehensive requirements from spec-interview |
| tasks/prd-*.md |
Product Requirements Document |
| tasks/prd.json |
Atomic user stories for Ralph |
| tasks/progress.txt |
Learnings between iterations |
| tasks/test-log.md |
Registry of all tests created per story (updated by tester agents) |
| tasks/review-notes.md |
Improvement recommendations after each story (updated by tester agents) |
| tasks/common_knowledge.md |
Shared knowledge base — patterns, conventions, gotchas discovered across stories (updated by both coder and tester agents, read by orchestrator between batches) |
| docs/ |
Project documentation — updated by both coder and tester agents with new features, APIs, test setup, etc. |
Agents:
| Agent |
Role |
Fallback |
| ralph-coder |
Implements production code + docs for one story |
Default coder when no project-specific agent matches |
| ralph-tester |
Writes tests + runs verification for one story |
Default tester when no project-specific agent matches |
| Project agents |
Discovered from .claude/agents/ and ~/.claude/agents/ |
Matched to storyTypes by description keywords |
Execution model:
BATCH 1 (independent stories):
Phase 1: Task(coder, US-001, worktree) + Task(coder, US-005, worktree) ← parallel
Phase 2: Task(tester, US-001) + Task(tester, US-005) ← parallel
Merge: US-001 → main, US-005 → main ← sequential
BATCH 2 (stories that depended on BATCH 1):
Phase 1: Task(coder, US-002, worktree) + Task(coder, US-003, worktree)
Phase 2: Task(tester, US-002) + Task(tester, US-003)
Merge: US-002 → main, US-003 → main
Commands:
# Check story status
cat tasks/prd.json | jq '.userStories[] | {id, title, status, attempts}'
# View learnings
cat tasks/progress.txt
# View test registry
cat tasks/test-log.md
# View review notes
cat tasks/review-notes.md
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: ralph-orchestrator3description: Orchestrates the full Ralph autonomous agent pipeline from requirements gathering to execution. Use when building new features, platforms, or complex tasks that need structured development through spec-interview, PRD generation, and autonomous implementation. Use when this capability is needed.4---56<objective>7Orchestrate the complete Ralph pipeline for autonomous feature development:891. **spec-interview** → Gather comprehensive requirements through guided discovery102. **generate-prd** → Create actionable Product Requirements Document113. **ralph-convert-prd** → Transform PRD into atomic user stories (prd.json)124. **Subagent execution** → Spawn ralph-coder/ralph-tester subagents via Task tool1314This skill coordinates these tools while keeping you in control at decision points.15</objective>1617<essential_principles>1819<principle name="CRITICAL_never_implement_directly">20**NEVER implement user stories yourself.** The orchestrator's ONLY job is to:211. Run spec-interview, generate-prd, ralph-convert-prd skills222. Spawn ralph-coder and ralph-tester subagents via the Task tool to execute stories233. Manage prd.json state, git operations (commit/merge), and progress tracking2425**ALL code implementation MUST happen through subagents** — ralph-coder implements production code, ralph-tester writes tests and verifies. You are the orchestrator, NOT the implementer. Do not write code, create files, modify source files, or make any project changes directly.2627If you catch yourself about to write code or modify project files: **STOP. Spawn a subagent instead.**28</principle>2930<principle name="CRITICAL_stop_on_errors">31**STOP and ask the user for instructions** whenever:32- A subagent returns a failed result33- A pre-execution check fails (invalid prd.json, missing files, dirty git state)34- A merge conflict occurs during worktree merge35- Any unexpected error occurs during the pipeline36- You are unsure about any decision3738**Do NOT** try to fix issues yourself, retry automatically, or continue past errors. Present the error clearly to the user and wait for their instructions.39</principle>4041<principle name="parallel_batch_execution">42Stories with no dependencies between them run in parallel. The orchestrator:431. Groups independent stories into batches442. Spawns multiple ralph-coder subagents simultaneously (each in its own worktree)453. After coders complete, spawns ralph-tester subagents in parallel (in the same worktrees)464. Merges successful worktree branches to main sequentially475. Updates prd.json and moves to the next batch4849This maximizes throughput while maintaining correct dependency ordering.50</principle>5152<principle name="two_phase_pipeline">53Each story goes through a two-phase pipeline:54- **Phase 1: Code** — ralph-coder (or matched project agent) implements production code + docs55- **Phase 2: Test** — ralph-tester (or matched project agent) writes tests + runs verification5657Separation gives each agent a focused context window. The orchestrator wraps ANY agent with Ralph context (story spec, return format, constraints) so even non-Ralph agents integrate seamlessly.58</principle>5960<principle name="orchestrator_owns_state">61**The orchestrator owns all state:**62- **prd.json** — only the orchestrator reads/writes story status. Agents return JSON results, orchestrator updates prd.json. This prevents race conditions during parallel execution.63- **Git operations** — only the orchestrator commits and merges. Neither coder nor tester commits. Orchestrator commits only after tester confirms all verification passes.64- **Worktree lifecycle** — orchestrator creates worktrees (via Task isolation), merges branches, and manages cleanup.65</principle>6667<principle name="agent_discovery">68The orchestrator **prefers existing project/user agents** over defaults. At startup:691. Scan `.claude/agents/*.md` and `~/.claude/agents/*.md`702. Match agents to storyTypes by description keywords713. Fall back to ralph-coder/ralph-tester when no better match exists7273This lets users configure best-practice agents for their stack, and Ralph automatically uses them.74</principle>7576<principle name="shared_knowledge">77Both coder and tester agents update `tasks/common_knowledge.md` with patterns, conventions, gotchas, and architectural decisions they discover. The orchestrator reads this file between batches to:78- Pass accumulated knowledge to subsequent subagent prompts79- Detect actionable discoveries (e.g., manual steps needed, environment issues)80- Make informed routing decisions for upcoming stories8182Both agents also update the `docs/` folder with documentation about new features, APIs, test setup, and architecture changes. The `tasks/test-log.md` and `tasks/review-notes.md` files are updated by tester agents with test registries and improvement recommendations.83</principle>8485<principle name="fresh_context_per_story">86Each subagent runs with a fresh context for each story. Memory persists only through:87- Git history (committed code in worktrees)88- tasks/progress.txt (learnings between iterations)89- tasks/prd.json (story status tracking)90- tasks/common_knowledge.md (shared patterns and conventions across stories)91- tasks/test-log.md (test registry across stories)92- tasks/review-notes.md (improvement recommendations across stories)9394**Never assume agents "remember" previous stories — but they CAN read shared knowledge files.**95</principle>9697<principle name="atomic_stories">98Each user story MUST be completable in ONE context window.99100**Right-sized:**101- Add a database column102- Create a UI component103- Update a server action104- Implement a filter105106**Too large (will fail):**107- Build entire dashboard108- Add authentication system109- Refactor entire API110</principle>111112<principle name="real_verification">113Every story must be verified with **real runtime checks** — not just that it compiles.114115- **API stories**: curl endpoints with real data, check response codes and bodies116- **UI stories**: Playwright e2e tests that navigate and interact with real UI117- **Database stories**: Run migrations, query DB directly to confirm schema118- **Infra stories**: Health checks, config validation, service startup119120Static checks (typecheck, lint) are baseline. Runtime validation is required.121</principle>122123<principle name="quality_gates">124All checks must pass before the orchestrator commits:125- Story-specific verification commands pass (real runtime checks)126- **Full test suite passes** (unit + integration + e2e) — no regressions allowed127- TypeCheck passes128- UI verified via Playwright (for frontend stories)129130After each story, the tester runs ALL existing tests (via `testCommands` in prd.json root) to catch regressions. A story is NOT done until the entire test suite passes.131</principle>132133<principle name="status_tracking">134Stories use structured status tracking:135- `"pending"` → not started136- `"in_progress"` → being worked on by subagents137- `"done"` → verified, committed, and merged to main138- `"failed"` → attempted but verification failed139- `"blocked"` → dependencies not met140141Stories track `attempts` / `maxAttempts` to prevent infinite retries on broken stories.142</principle>143144<principle name="user_control_points">145You approve at each stage:1461. After spec-interview → Review SPEC.md1472. After generate-prd → Review PRD1483. After ralph-convert-prd → Review prd.json stories1494. Before execution → Confirm ready to execute1505. Between batches → View progress (if issues arise)151152Don't rush. Bad requirements = wasted iterations.153</principle>154155</essential_principles>156157<prd_json_schema>158```json159{160 "project": "[Project Name]",161 "branchName": "ralph/[feature-name-kebab-case]",162 "description": "[Feature description]",163 "testCommands": {164 "unit": "npm test",165 "integration": "npm run test:integration",166 "e2e": "npx playwright test",167 "typecheck": "npm run typecheck"168 },169 "userStories": [170 {171 "id": "US-001",172 "title": "[Story title]",173 "description": "As a [user], I want [feature] so that [benefit]",174 "storyType": "backend | frontend | database | api | infra | test",175 "acceptanceCriteria": ["Specific criterion 1", "Typecheck passes"],176 "verificationCommands": [177 { "command": "npm run typecheck", "expect": "exit_code:0" },178 { "command": "curl -s http://localhost:3000/api/...", "expect": "contains:expected" }179 ],180 "status": "pending",181 "priority": 1,182 "attempts": 0,183 "maxAttempts": 3,184 "notes": "",185 "blockedBy": [],186 "docsToUpdate": ["README.md", "docs/api.md"],187 "completedAt": null,188 "lastAttemptLog": ""189 }190 ]191}192```193194**Expect matchers for verificationCommands:**195- `exit_code:0` — command exits with code 0196- `exit_code:N` — command exits with specific code N197- `contains:STRING` — stdout contains STRING198- `not_empty` — stdout is non-empty199- `matches:REGEX` — stdout matches regex pattern200</prd_json_schema>201202<intake>203What would you like to do?2042051. **Full pipeline** - Start from scratch (spec → PRD → prd.json → execute)2062. **Continue from PRD** - Already have PRD, convert and execute2073. **Execute only** - Already have prd.json, run Ralph2084. **Check status** - View current prd.json progress209210**Wait for response before proceeding.**211</intake>212213<routing>214| Response | Workflow |215|----------|----------|216| 1, "full", "start", "new feature" | `workflows/full-pipeline.md` |217| 2, "continue", "have PRD", "convert" | `workflows/from-prd.md` |218| 3, "execute", "run ralph", "have prd.json" | `workflows/execute-only.md` |219| 4, "status", "check", "progress" | `workflows/check-status.md` |220221**After reading the workflow, follow it exactly.**222</routing>223224<quick_reference>225226**Key Files:**227| File | Purpose |228|------|---------|229| SPEC.md | Comprehensive requirements from spec-interview |230| tasks/prd-*.md | Product Requirements Document |231| tasks/prd.json | Atomic user stories for Ralph |232| tasks/progress.txt | Learnings between iterations |233| tasks/test-log.md | Registry of all tests created per story (updated by tester agents) |234| tasks/review-notes.md | Improvement recommendations after each story (updated by tester agents) |235| tasks/common_knowledge.md | Shared knowledge base — patterns, conventions, gotchas discovered across stories (updated by both coder and tester agents, read by orchestrator between batches) |236| docs/ | Project documentation — updated by both coder and tester agents with new features, APIs, test setup, etc. |237238**Agents:**239| Agent | Role | Fallback |240|-------|------|----------|241| ralph-coder | Implements production code + docs for one story | Default coder when no project-specific agent matches |242| ralph-tester | Writes tests + runs verification for one story | Default tester when no project-specific agent matches |243| Project agents | Discovered from .claude/agents/ and ~/.claude/agents/ | Matched to storyTypes by description keywords |244245**Execution model:**246```247BATCH 1 (independent stories):248 Phase 1: Task(coder, US-001, worktree) + Task(coder, US-005, worktree) ← parallel249 Phase 2: Task(tester, US-001) + Task(tester, US-005) ← parallel250 Merge: US-001 → main, US-005 → main ← sequential251252BATCH 2 (stories that depended on BATCH 1):253 Phase 1: Task(coder, US-002, worktree) + Task(coder, US-003, worktree)254 Phase 2: Task(tester, US-002) + Task(tester, US-003)255 Merge: US-002 → main, US-003 → main256```257258**Commands:**259```bash260# Check story status261cat tasks/prd.json | jq '.userStories[] | {id, title, status, attempts}'262263# View learnings264cat tasks/progress.txt265266# View test registry267cat tasks/test-log.md268269# View review notes270cat tasks/review-notes.md271```272273</quick_reference>274275<workflows_index>276| Workflow | Purpose |277|----------|---------|278| full-pipeline.md | Complete flow: spec → PRD → prd.json → execute |279| from-prd.md | Convert existing PRD and execute |280| execute-only.md | Run Ralph on existing prd.json |281| check-status.md | View current progress |282</workflows_index>283284<success_criteria>285Pipeline is complete when:286- [ ] Requirements gathered through spec-interview (including verification environment)287- [ ] PRD created with verifiable acceptance criteria288- [ ] prd.json has atomic stories with storyType, verificationCommands, and blockedBy289- [ ] All stories have `status: "done"` in prd.json290- [ ] All verification commands passed (real runtime checks, not just typecheck)291- [ ] Code committed and merged to main via worktree branches292</success_criteria>293294---295> Converted and distributed by [TomeVault](https://tomevault.io/claim/cfircoo) — claim your Tome and manage your conversions.296<!-- tomevault:4.0:skill_md:2026-04-11 -->