Skip to main content
The Ralph Converter skill (/ralph) converts markdown PRDs into the prd.json format that Ralph uses for autonomous execution. It ensures stories are properly sized, ordered by dependencies, and have verifiable acceptance criteria.

Overview

The skill takes a PRD (markdown file or text) and converts it to prd.json in your project’s ralph directory. The conversion process:
  1. Validates story sizes (must fit in one context window)
  2. Orders stories by dependencies (schema → backend → UI)
  3. Ensures acceptance criteria are verifiable
  4. Adds required criteria (typecheck, browser verification)
  5. Archives previous runs if needed

Usage

Invoke the skill with any of these trigger phrases:
Or explicitly load it:

Output Format

The skill generates a prd.json file with this structure:

Field Descriptions

project
string
required
Project name (derived from PRD or repository)
branchName
string
required
Git branch name in kebab-case, prefixed with ralph/
description
string
required
Brief feature description from PRD introduction
userStories
array
required
Array of user story objects ordered by dependency and priority
userStories[].id
string
required
Sequential ID: US-001, US-002, etc.
userStories[].title
string
required
Short descriptive title from PRD
userStories[].description
string
required
User story in standard format: “As a [user], I want [feature] so that [benefit]”
userStories[].acceptanceCriteria
array
required
Verifiable criteria that define “done”. Always includes “Typecheck passes” and “Verify in browser using dev-browser skill” for UI stories.
userStories[].priority
number
required
Execution order (1 = highest). Based on dependencies, then document order.
userStories[].passes
boolean
required
Whether story is complete. Always starts as false.
userStories[].notes
string
required
Learnings from implementation. Always starts empty.

The Number One Rule: Story Size

Each story must be completable in ONE Ralph iteration (one context window). Ralph spawns a fresh AI instance per iteration with no memory of previous work. If a story is too big, the LLM runs out of context before finishing and produces broken code.

Right-sized Stories ✅

  • Add a database column and migration
  • Add a UI component to an existing page
  • Update a server action with new logic
  • Add a filter dropdown to a list

Too Large ❌ (Split These)

  • “Build the entire dashboard” → Split into: schema, queries, UI components, filters
  • “Add authentication” → Split into: schema, middleware, login UI, session handling
  • “Refactor the API” → Split into one story per endpoint or pattern
Rule of thumb: If you cannot describe the change in 2-3 sentences, it’s too big.

Story Ordering: Dependencies First

Stories execute in priority order. Earlier stories must not depend on later ones.

Correct Order ✅

1

Schema/Database Changes

Database migrations, table creation, column additions
2

Server Actions / Backend Logic

API endpoints, server functions, business logic
3

UI Components

Frontend components that use the backend
4

Dashboard/Summary Views

Higher-level views that aggregate data

Wrong Order ❌

Acceptance Criteria: Must Be Verifiable

Each criterion must be something Ralph can CHECK, not something vague.

Good Criteria ✅

  • “Add status column to tasks table with default ‘pending’”
  • “Filter dropdown has options: All, Active, Completed”
  • “Clicking delete shows confirmation dialog”
  • “Typecheck passes”
  • “Tests pass”

Bad Criteria ❌

  • “Works correctly” (too vague)
  • “User can do X easily” (not measurable)
  • “Good UX” (subjective)
  • “Handles edge cases” (which ones?)

Required Criteria

The skill automatically adds to every story:
For stories with UI changes, it also adds:
Frontend stories are NOT complete until visually verified. Ralph will use the dev-browser skill to navigate to the page, interact with the UI, and confirm changes work.

Conversion Rules

The skill follows these rules when converting:
  1. Each user story becomes one JSON entry - One-to-one mapping
  2. IDs are sequential - US-001, US-002, etc.
  3. Priority based on dependencies - Then document order
  4. All stories start incomplete - passes: false, empty notes
  5. branchName derived from feature - Kebab-case, prefixed with ralph/
  6. Typecheck always added - Every story includes “Typecheck passes”

Splitting Large PRDs

If a PRD has big features, the skill splits them into smaller stories:

Original Story

Split Into Smaller Stories

Each story is now one focused change that can be completed and verified independently.

Example Conversion

Here’s a complete example of converting a PRD:

Input PRD

Output JSON

Archiving Previous Runs

Before writing a new prd.json, the skill checks if there’s an existing one from a different feature:
  1. Read current prd.json (if it exists)
  2. Check if branchName differs from the new feature’s branch name
  3. If different AND progress.txt has content:
    • Create archive folder: archive/YYYY-MM-DD-feature-name/
    • Copy current prd.json and progress.txt to archive
    • Reset progress.txt with fresh header
The ralph.sh script handles archiving automatically when you run it, but if you’re manually updating prd.json between runs, the skill will archive for you.

Workflow

1

Have a PRD Ready

Create a PRD using the PRD Generator skill or write one manually in tasks/prd-[feature-name].md
2

Convert to JSON

Invoke the Ralph converter:
3

Review and Edit

Review the generated prd.json. Check:
  • Story sizes are appropriate
  • Dependencies are in correct order
  • Acceptance criteria are verifiable
4

Run Ralph

Start the autonomous execution loop:

Validation Checklist

Before saving prd.json, the skill verifies:
  • Previous run archived (if prd.json exists with different branchName)
  • Each story is completable in one iteration (small enough)
  • Stories are ordered by dependency (schema → backend → UI)
  • Every story has “Typecheck passes” as criterion
  • UI stories have “Verify in browser using dev-browser skill” as criterion
  • Acceptance criteria are verifiable (not vague)
  • No story depends on a later story

Next Steps

After generating prd.json:
  1. Review - Check story sizes and ordering
  2. Commit - Add the prd.json to version control
  3. Run Ralph - Execute ./scripts/ralph/ralph.sh to start autonomous implementation
  4. Monitor - Check progress.txt for learnings and git log for commits

Common Issues

Stories Too Large

If Ralph consistently fails to complete stories:
  • Each story should be 2-3 sentences maximum
  • Split into smaller, more focused stories
  • Check for multiple logical changes in one story

Wrong Dependency Order

If stories fail due to missing dependencies:
  • Ensure schema changes come before backend logic
  • Backend logic must exist before UI can use it
  • Move dependent stories to later in the priority order

Vague Acceptance Criteria

If Ralph can’t determine when a story is complete:
  • Replace “works correctly” with specific behaviors
  • Add concrete UI states or API responses
  • Include specific file paths or function names