Plan to PRD
Guide a planning session and create a comprehensive PRD item.
Step 1: Identify Target Plan
If there are multiple plan directories under plans/, ask which plan this PRD item is for.
If the user hasn't specified and multiple exist, use AskUserQuestion to clarify.
If only one plan exists, use that one automatically.
Step 2: Research Phase (Read-Only)
Before making any changes:
- •Use Explore agents to understand relevant code areas
- •Read existing files that will be modified
- •Read
plans/<plan>/progress.txtfor learnings from similar past implementations - •Use AskUserQuestion to clarify ambiguous requirements
- •Do NOT make any edits yet
Step 3: Draft the Plan
Write your plan to .claude/plans/current-prd-draft.md. Include:
- •Problem being solved
- •Proposed solution and benefit
- •Files to modify (with descriptions)
- •Implementation approach with code snippets where helpful
- •Step-by-step implementation instructions
Iterate with the user until they're satisfied with the plan.
Step 4: Convert to PRD Item
When the user approves the plan, format it as a PRD item with this structure:
{
"category": "<use existing categories as guide (foundation, auth, integration, bugfix, performance, testing, refactor, styling, mocks, tooling) - prefer general categories, new ones can be added if needed>",
"description": "<brief description of the feature/fix>",
"requiredPackages": ["<package-name>"],
"context": {
"problem": "<what problem this solves>",
"solution": "<how it solves it>",
"benefit": "<why this matters>"
},
"filesToModify": [
"<file path> - <what changes>"
],
"implementation": {
"<file or component>": {
"<aspect>": "<details>",
"code": "<code snippet if helpful>"
}
},
"steps": [
"<detailed step 1>",
"<detailed step 2 with line numbers if known>"
],
"passes": false
}
Important Rules
- •Never add a
priorityfield unless the user explicitly requests it - •Prefer general categories - use existing ones as a guide, new ones can be added if needed
- •Steps should be detailed enough to implement without re-reading the plan
- •Include code snippets in implementation when the exact code is known
- •Include line numbers in steps when you know them from exploration
Writing for ralph.sh Automation
PRD items are consumed by ralph.sh which runs Claude autonomously to implement features. The PRD must be self-contained and unambiguous for automated implementation.
What ralph.sh expects:
- •Picks highest priority feature with
passes: false - •Implements following the steps exactly
- •Runs
bun run test:all(typecheck, lint, unit tests, E2E, build) - •Updates
passes: trueand commits - •Logs learnings to progress.txt
- •Outputs
<promise>FEATURE_COMPLETE</promise>when done
PRD items MUST include:
- •Required packages - If the feature needs any packages not already in package.json:
- •List each package with exact name:
"requiredPackages": ["@tanstack/react-query", "zod"] - •ralph.sh will BLOCK if it needs a package not specified here
- •Check package.json first to see what's already installed
- •List each package with exact name:
- •Specific file paths - exact paths, not vague references
- •Line numbers when known - "In src/main.tsx line 44" not "In main.tsx"
- •Complete code snippets - working code, not pseudocode or hints
- •Testing requirements:
- •For
.tsfiles: "Add unit tests in src/tests/<name>.test.ts" - •For
.tsxfiles: "Add E2E tests in e2e/<name>.spec.ts" - •What specific behaviors to test
- •For
- •Verification steps that match test:all expectations:
- •"Run bun run typecheck to verify no type errors"
- •"Run bun run test:all to ensure all tests pass"
- •References to design docs when relevant:
- •"See plans/<plan>/DESIGN.md for visual spec"
- •"See plans/<plan>/API.md for endpoint details"
- •Clear success criteria - how to know it's done
PRD items should NOT include:
- •Vague instructions like "update as needed"
- •Missing context that requires asking questions
- •Incomplete code that needs filling in
- •Steps that depend on human judgment
Reference past implementations:
Check progress.txt for similar features. If a past session solved a related problem, reference the learnings. Example: "Similar to Session 47 approach for formatMetricValue"
Step 5: Add to prd.json
Append the PRD item to plans/<plan-name>/prd.json.
Step 6: Offer to Commit
After adding the PRD item, ask the user: "PRD item added. Would you like me to commit this update?"
If yes, commit using user's preferred commit message conventions.