ralph
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRalph PRD Converter
Ralph PRD 转换器
Converts existing PRDs to for Ralph's autonomous execution loop.
prd.json将现有PRD转换为供Ralph自治执行循环使用的文件。
prd.jsonThe Job
任务内容
Run Pre-flight Setup, then convert a PRD (markdown or text) into .
scripts/ralph/prd.json先运行前置准备步骤,再将PRD(markdown或文本格式)转换为文件。
scripts/ralph/prd.jsonPre-flight Setup
前置准备
- Project name — read
package.jsonfield; fall back to directory basename.name - Copy runtime files — if missing in target project, copy from this skill's subdirectory to
ralph/:scripts/ralph/- ,
ralph.sh→ralph-tree.shchmod +x CLAUDE.mdralph-audit.ts
- Set NTFY_TOPIC — in , replace
scripts/ralph/ralph.shplaceholder with actual project name. Skip if already customized.<project-name> - Add package.json scripts — if exists, add missing entries:
package.json"ralph-tree": "bash scripts/ralph/ralph-tree.sh""ralph-audit": "bun scripts/ralph/ralph-audit.ts"
- Verify curl — required by ralph.sh for ntfy.sh notifications.
- Confirm setup — print summary: file status, NTFY_TOPIC, curl availability.
- 项目名称 — 读取的
package.json字段;若不存在则使用目录的基础名称。name - 复制运行时文件 — 如果目标项目中缺少以下文件,从本skill的子目录复制到
ralph/目录:scripts/ralph/- 、
ralph.sh→ 执行ralph-tree.sh赋予执行权限chmod +x CLAUDE.mdralph-audit.ts
- 设置NTFY_TOPIC — 在文件中,将
scripts/ralph/ralph.sh占位符替换为实际的项目名称。如果已经自定义过则跳过该步骤。<project-name> - 添加package.json脚本 — 如果存在文件,添加缺失的脚本条目:
package.json"ralph-tree": "bash scripts/ralph/ralph-tree.sh""ralph-audit": "bun scripts/ralph/ralph-audit.ts"
- 验证curl — ralph.sh需要依赖curl来发送ntfy.sh通知,请确保curl已安装。
- 确认设置完成 — 打印汇总信息:文件状态、NTFY_TOPIC配置、curl可用性。
Output Format
输出格式
json
{
"project": "[Project Name]",
"branchName": "ralph/[feature-name-kebab-case]",
"description": "[Feature description]",
"userStories": [
{
"id": "US-001",
"title": "[Story title]",
"description": "As a [user], I want [feature] so that [benefit]",
"acceptanceCriteria": ["Criterion 1", "Typecheck passes"],
"priority": 1,
"passes": false,
"notes": ""
}
]
}json
{
"project": "[Project Name]",
"branchName": "ralph/[feature-name-kebab-case]",
"description": "[Feature description]",
"userStories": [
{
"id": "US-001",
"title": "[Story title]",
"description": "As a [user], I want [feature] so that [benefit]",
"acceptanceCriteria": ["Criterion 1", "Typecheck passes"],
"priority": 1,
"passes": false,
"notes": ""
}
]
}Story Size — The Number One Rule
用户故事规模 — 首要规则
Each story must be completable in ONE Ralph iteration (one context window). Ralph spawns a fresh instance per iteration with no memory of previous work.
Right-sized: add a DB column, add a UI component, update a server action, add a filter.
Too big (split): "build the dashboard", "add auth", "refactor the API".
Rule of thumb: if you can't describe the change in 2-3 sentences, split it.
每个用户故事必须能在**一次Ralph迭代(一个上下文窗口)**内完成。Ralph每次迭代都会生成全新的实例,不会保留之前工作的记忆。
合理规模: 新增一个数据库列、添加一个UI组件、更新一个服务端动作、新增一个过滤器。
规模过大(需要拆分): "构建仪表盘"、"添加认证功能"、"重构API"。
经验法则:如果你无法用2-3句话描述清楚改动,就需要拆分。
Story Ordering
故事排序
Dependencies first: schema/migrations → backend logic → UI components → aggregation views.
优先处理依赖项:schema/数据库迁移 → 后端逻辑 → UI组件 → 聚合视图。
Acceptance Criteria
验收标准
Must be verifiable — something Ralph can CHECK.
Good: "Add column with default 'pending'", "Filter has options: All, Active, Done", "Typecheck passes"
Bad: "Works correctly", "Good UX", "Handles edge cases"
statusAlways include as final criterion.
Add for testable logic.
Add for UI changes.
"Typecheck passes""Tests pass""Verify in browser using dev-browser skill"必须是可验证的 — 是Ralph能够检查的内容。
正面示例: "新增列,默认值为'pending'"、"过滤器包含选项:全部、活跃、已完成"、"类型检查通过"
反面示例: "运行正常"、"用户体验良好"、"处理边界情况"
status必须始终将作为最终验收标准。
可测试逻辑需添加标准。
UI改动需添加标准。
"Typecheck passes""Tests pass""Verify in browser using dev-browser skill"Conversion Rules
转换规则
- Each user story → one JSON entry
- IDs: sequential ,
US-001, ...US-002 - Priority: dependency order, then document order
- All stories: , empty
passes: falsenotes - branchName: kebab-case from feature name, prefixed
ralph/ - Every story gets criterion
"Typecheck passes"
- 每个用户故事对应一条JSON条目
- ID:按顺序编号为、
US-001……US-002 - 优先级:先按依赖顺序排列,再按文档原顺序排列
- 所有故事的字段均设为
passes,false字段为空notes - branchName:由功能名转换为kebab-case格式,前缀为
ralph/ - 每个故事都必须包含验收标准
"Typecheck passes"
Splitting Large PRDs
大型PRD拆分
Break big features into focused, independent stories. Example: "Add notification system" becomes: 1) notifications table, 2) notification service, 3) bell icon, 4) dropdown panel, 5) mark-as-read, 6) preferences page.
See for a full input/output conversion example.
references/example.md将大型功能拆分为聚焦、独立的用户故事。示例:"新增通知系统"可拆分为:1) 通知表结构、2) 通知服务、3) 铃铛图标、4) 下拉面板、5) 标记已读功能、6) 偏好设置页面。
可查看获取完整的输入/输出转换示例。
references/example.mdArchiving Previous Runs
历史运行记录归档
Before writing new , check for an existing one with a different . If different and has content beyond the header: archive to , then reset .
prd.jsonbranchNameprogress.txtarchive/YYYY-MM-DD-feature-name/progress.txt写入新的之前,检查是否存在旧的且其与当前不同。如果分支名不同,且除了头部外还有其他内容:将其归档到目录,然后重置。
prd.jsonprd.jsonbranchNameprogress.txtarchive/YYYY-MM-DD-feature-name/progress.txtChecklist
检查清单
- Pre-flight complete (runtime files copied, NTFY_TOPIC set, package.json scripts added)
- Previous run archived if needed
- Each story fits one iteration
- Dependency order respected
- Every story has "Typecheck passes"
- UI stories have "Verify in browser using dev-browser skill"
- Criteria are verifiable, not vague
- No story depends on a later story
- 前置准备完成(运行时文件已复制、NTFY_TOPIC已设置、package.json脚本已添加)
- 如有需要已归档历史运行记录
- 每个故事都可在一次迭代内完成
- 遵循依赖顺序排列
- 每个故事都包含“Typecheck passes”标准
- UI相关故事包含“Verify in browser using dev-browser skill”标准
- 验收标准可验证,无模糊描述
- 没有故事依赖后续的故事