ralph-convert-prd
Skill17 starsChanged 9 months agoMITView on GitHub
Converts Product Requirements Documents into prd.json format for the Ralph autonomous agent system. Use when preparing PRDs for Ralph execution, breaking down features into atomic user stories, or when the user mentions Ralph, prd.json, or autonomous agent workflows.
- Sends data out
In this repository19 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- docs/llms.txtllms.txt
- manage-skillsSkill
- manage-hooksSkill
- create-meta-promptsSkill
- create-plansSkill
- create-subagentsSkill
- damage-controlSkill
- debug-like-expertSkill
- docs-masterSkill
- file-searchSkill
- generate-imagesSkill
- generate-prdSkill
- gitSkill
- manage-slash-commandsSkill
- pytest-best-practicesSkill
- ralph-orchestratorSkill
- spec-interviewSkill
- sqlalchemy-postgresSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 9 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Read the user's PRD or feature requirements
- Distinctive: line 14
Read SPEC.md if available (for verification environment info)
- Distinctive: line 30
Add a database column
- Distinctive: line 31
Create a UI component
- Distinctive: line 49
Never reference something that doesn't exist yet.
- Very specific: line 67
Every story MUST include: "Typecheck passes"
- Very specific: line 73
Every story MUST include verificationCommands with real runtime checks — not just static analysis.
- Distinctive: line 157
Understand the PRD: Read the full requirements document or feature request
- Very specific: line 158
Read SPEC.md: If available, extract verification environment info (dev server URL, DB type, test runners, commands).
- Distinctive: line 165
Generate verificationCommands: Add real runtime checks per storyType (curl, Playwright, DB queries)
- Distinctive: line 166
Add mandatory criteria: Ensure every story has "Typecheck passes"
- Distinctive: line 168
Run pre-save checklist: Verify all requirements before finalizing </workflow>
- Very specific: line 172
Before outputting the final prd.json, verify:
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<objective>
Transform existing Product Requirements Documents into the structured `prd.json` format used by the Ralph autonomous agent system. Each story must be completable in one LLM context window to prevent broken code from context overflow. Each story must include real runtime verification commands.
</objective><quick_start>
- Read the user's PRD or feature requirements
- Read SPEC.md if available (for verification environment info)
- Break down into atomic user stories (one context window each)
- Classify each story with
storyType - Generate
verificationCommandswith real runtime checks - Set
blockedBydependencies - Order stories by dependency (schema → backend → UI → dashboard)
- Output valid
tasks/prd.json</quick_start>
<essential_principles>
<principle name="story_size">
Critical Rule: Each story must be completable in ONE Ralph iteration (one context window).
Stories that are too large cause the LLM to run out of context before completion, resulting in broken code.
Right-sized stories:
- Add a database column
- Create a UI component
- Update server actions
- Implement a filter
Too large (split these):
- Build entire dashboards
- Add authentication systems
- Refactor entire APIs
</principle>
<principle name="story_ordering">
Stories must execute sequentially without forward dependencies:- Schema/database changes
- Server actions and backend logic
- UI components
- Dashboard/summary views
Never reference something that doesn't exist yet.
</principle>
<principle name="acceptance_criteria">
Each criterion must be verifiable and specific. Avoid vague language.Good criteria:
- "Add status column with values: 'pending' | 'in_progress' | 'done'"
- "Filter dropdown includes: All, Active, Completed"
- "Clicking delete shows confirmation dialog"
Bad criteria (too vague):
- "Works correctly"
- "Good UX"
- "Handles edge cases"
</principle>
<principle name="mandatory_criteria">
Every story MUST include: `"Typecheck passes"`UI-focused stories MUST also include: "Verify in browser using Playwright e2e test"
</principle>
<principle name="real_verification">
Every story MUST include `verificationCommands` with real runtime checks — not just static analysis.By storyType:
| storyType | Required verification | Example |
database | Run migration + query DB to confirm schema | prisma migrate deploy, SQL query for new column |
backend | Run tests + curl endpoint with real data | curl -s http://localhost:3000/api/... |
api | curl endpoint, check status code and response body | curl -s -w '%{http_code}' ... |
frontend | Playwright e2e test that interacts with real UI | npx playwright test tests/e2e/... |
infra | Health check, config validation, service startup | curl -s http://localhost:3000/health |
test | Run the test suite | npm test / pytest |
Static checks (typecheck) are always included as baseline. Runtime validation is additionally required.
</principle>
</essential_principles>
<output_format>
{
"project": "[Project Name]",
"branchName": "ralph/[feature-name-kebab-case]",
"description": "[Feature description]",
"testCommands": {
"unit": "npm test",
"integration": "npm run test:integration",
"e2e": "npx playwright test",
"typecheck": "npm run typecheck"
},
"userStories": [
{
"id": "US-001",
"title": "[Story title]",
"description": "As a [user], I want [feature] so that [benefit]",
"storyType": "database",
"acceptanceCriteria": [
"Specific criterion 1",
"Specific criterion 2",
"Typecheck passes"
],
"verificationCommands": [
{ "command": "npm run typecheck", "expect": "exit_code:0" },
{ "command": "curl -s http://localhost:3000/api/tasks | jq length", "expect": "not_empty" }
],
"status": "pending",
"priority": 1,
"attempts": 0,
"maxAttempts": 3,
"notes": "",
"blockedBy": [],
"docsToUpdate": ["README.md"],
"completedAt": null,
"lastAttemptLog": ""
}
]
}Field requirements:
id: Sequential US-001, US-002, etc.title: Short, descriptive actiondescription: User story format (As a... I want... so that...)storyType: One of"backend"|"frontend"|"database"|"api"|"infra"|"test"acceptanceCriteria: Array of specific, verifiable criteriaverificationCommands: Array of{command, expect}with real runtime checksstatus: Always"pending"initiallypriority: Execution order (1 = first)attempts: Always0initiallymaxAttempts: Default3(increase for complex stories)notes: Empty string initiallyblockedBy: Array of story IDs that must be"done"firstdocsToUpdate: Array of file paths to documentation that must be updated when story is done (e.g.,"README.md","docs/api.md","CHANGELOG.md")completedAt: AlwaysnullinitiallylastAttemptLog: Empty string initially
Expect matchers for verificationCommands:
exit_code:0— command exits with code 0exit_code:N— command exits with specific code Ncontains:STRING— stdout contains STRINGnot_empty— stdout is non-emptymatches:REGEX— stdout matches regex pattern </output_format>
<workflow>
1. **Understand the PRD**: Read the full requirements document or feature request
2. **Read SPEC.md**: If available, extract verification environment info (dev server URL, DB type, test runners, commands). Use this to populate the root-level `testCommands` object
3. **Identify components**: List all database changes, backend logic, UI elements
4. **Decompose into stories**: Break each component into atomic, one-iteration tasks
5. **Classify storyType**: Assign `database`, `backend`, `api`, `frontend`, `infra`, or `test` to each story
6. **Order by dependency**: Schema first, then backend, then UI, then dashboards
7. **Set blockedBy**: Each story should list IDs of stories it depends on
8. **Write acceptance criteria**: Make each criterion specific and verifiable
9. **Generate verificationCommands**: Add real runtime checks per storyType (curl, Playwright, DB queries)
10. **Add mandatory criteria**: Ensure every story has "Typecheck passes"
11. **Generate tasks/prd.json**: Output the complete JSON structure to `tasks/prd.json`
12. **Run pre-save checklist**: Verify all requirements before finalizing
</workflow><pre_save_checklist> Before outputting the final prd.json, verify:
- Previous runs archived (if applicable)
- Each story completable in one iteration
- Each story has a
storyTypeassigned - Stories ordered by dependency (no forward references)
blockedBydependencies are set correctly- All stories include "Typecheck passes" in acceptanceCriteria
- UI stories include Playwright verification
- Every story has
verificationCommandswith at least one runtime check - Acceptance criteria are verifiable, not vague
- No story depends on later stories
docsToUpdatelists relevant docs for each storystatusis"pending",attemptsis0,maxAttemptsis set </pre_save_checklist>
<examples>
<example name="database_story">
```json
{
"id": "US-001",
"title": "Add task status column to database",
"description": "As a developer, I want a status column on tasks so that we can track task progress",
"storyType": "database",
"acceptanceCriteria": [
"Add status column to tasks table with type enum('pending', 'in_progress', 'done')",
"Default value is 'pending'",
"Migration runs without errors",
"Typecheck passes"
],
"verificationCommands": [
{ "command": "npx prisma migrate deploy", "expect": "exit_code:0" },
{ "command": "npx prisma db execute --stdin <<< \"SELECT column_name FROM information_schema.columns WHERE table_name='tasks' AND column_name='status'\"", "expect": "contains:status" },
{ "command": "npm run typecheck", "expect": "exit_code:0" }
],
"status": "pending",
"priority": 1,
"attempts": 0,
"maxAttempts": 3,
"notes": "",
"blockedBy": [],
"docsToUpdate": ["README.md"],
"completedAt": null,
"lastAttemptLog": ""
}
```
</example><example name="api_story">
```json
{
"id": "US-002",
"title": "Create task CRUD API endpoints",
"description": "As a developer, I want REST endpoints for tasks so that the frontend can manage tasks",
"storyType": "api",
"acceptanceCriteria": [
"GET /api/tasks returns array of tasks",
"POST /api/tasks creates a new task and returns 201",
"PATCH /api/tasks/:id updates task and returns 200",
"DELETE /api/tasks/:id removes task and returns 204",
"Typecheck passes"
],
"verificationCommands": [
{ "command": "npm run typecheck", "expect": "exit_code:0" },
{ "command": "npm test -- --grep 'tasks API'", "expect": "exit_code:0" },
{ "command": "curl -s -o /dev/null -w '%{http_code}' http://localhost:3000/api/tasks", "expect": "contains:200" },
{ "command": "curl -s -X POST http://localhost:3000/api/tasks -H 'Content-Type: application/json' -d '{\"title\":\"test task\"}' -o /dev/null -w '%{http_code}'", "expect": "contains:201" }
],
"status": "pending",
"priority": 2,
"attempts": 0,
"maxAttempts": 3,
"notes": "",
"blockedBy": ["US-001"],
"docsToUpdate": ["README.md", "docs/api.md"],
"completedAt": null,
"lastAttemptLog": ""
}
```
</example><example name="ui_story">
```json
{
"id": "US-003",
"title": "Add status filter dropdown to task list",
"description": "As a user, I want to filter tasks by status so that I can focus on relevant tasks",
"storyType": "frontend",
"acceptanceCriteria": [
"Filter dropdown appears above task list",
"Options: All, Pending, In Progress, Done",
"Selecting option filters displayed tasks",
"Filter persists on page refresh",
"Typecheck passes",
"Verify in browser using Playwright e2e test"
],
"verificationCommands": [
{ "command": "npm run typecheck", "expect": "exit_code:0" },
{ "command": "npx playwright test tests/e2e/task-filter.spec.ts", "expect": "exit_code:0" }
],
"status": "pending",
"priority": 3,
"attempts": 0,
"maxAttempts": 3,
"notes": "",
"blockedBy": ["US-002"],
"docsToUpdate": ["README.md"],
"completedAt": null,
"lastAttemptLog": ""
}
```
</example>
</examples><success_criteria> Conversion is complete when:
- All features from PRD are captured as user stories
- Each story is atomic (one context window)
- Each story has a
storyTypeassigned - Stories are properly ordered by dependency with
blockedByset - All acceptance criteria are specific and verifiable
- Mandatory criteria ("Typecheck passes") present on all stories
- Every story has
verificationCommandswith real runtime checks - UI stories include Playwright verification
- Valid JSON structure with all required fields
- Pre-save checklist passes </success_criteria>
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

