ralph

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Ralph Wiggum Loop Skill

Ralph Wiggum Loop Skill

Autonomous AI coding pattern that runs agents in iterations with clean context, working on PRD-driven features while maintaining CI green.
一种自主AI编码模式,以全新上下文循环运行Agent,在保持CI构建正常的同时开发PRD驱动的功能。

Commands

命令

CommandAction
/ralph
Show help menu
/ralph setup
Create Ralph infrastructure
/ralph init
Build custom PRD interactively
/ralph run
Execute the autonomous loop

命令操作
/ralph
显示帮助菜单
/ralph setup
创建Ralph基础架构
/ralph init
交互式构建自定义PRD
/ralph run
执行自主循环

/ralph setup

/ralph setup

Create all Ralph files in the current directory.
Steps:
  1. Read and copy templates from this skill's
    templates/
    folder:
    • templates/ralph-loop.sh
      ./ralph-loop.sh
    • templates/prd.json
      ./prd.json
    • templates/progress.txt
      ./progress.txt
    • templates/README-RALPH.md
      ./README-RALPH.md
  2. Make script executable:
    chmod +x ralph-loop.sh
  3. Detect project context and customize:
    • Check for
      package.json
      → determine package manager (pnpm/npm/yarn)
    • Check for
      tsconfig.json
      → TypeScript project
    • Update test commands in ralph-loop.sh accordingly
  4. Show completion message with next steps

在当前目录创建所有Ralph文件。
步骤:
  1. 读取并复制本skill的
    templates/
    文件夹中的模板:
    • templates/ralph-loop.sh
      ./ralph-loop.sh
    • templates/prd.json
      ./prd.json
    • templates/progress.txt
      ./progress.txt
    • templates/README-RALPH.md
      ./README-RALPH.md
  2. 赋予脚本可执行权限:
    chmod +x ralph-loop.sh
  3. 检测项目上下文并自定义配置:
    • 检查是否存在
      package.json
      → 确定包管理器(pnpm/npm/yarn)
    • 检查是否存在
      tsconfig.json
      → 判断是否为TypeScript项目
    • 相应更新ralph-loop.sh中的测试命令
  4. 显示完成消息及后续步骤

/ralph init

/ralph init

Guide user through creating a custom PRD interactively.
Questions to ask:
  1. Project name?
  2. What features do you want to build? (collect 3-5 user stories)
  3. For each story:
    • Title?
    • Description?
    • Acceptance criteria? (3-5 specific, testable criteria)
Output: Generate
prd.json
with user's input. Offer to create other Ralph files if not present.

引导用户交互式创建自定义PRD。
需询问的问题:
  1. 项目名称?
  2. 你想要构建哪些功能?(收集3-5个用户故事)
  3. 针对每个故事:
    • 标题?
    • 描述?
    • 验收标准?(3-5条具体、可测试的标准)
输出: 根据用户输入生成
prd.json
。若Ralph其他文件不存在,提供创建选项。

/ralph run

/ralph run

Execute the Ralph loop.
Pre-flight checks:
  1. Verify
    ralph-loop.sh
    exists
  2. Verify
    prd.json
    exists
  3. Show summary:
    • Total user stories
    • Incomplete stories (where
      passes: false
      )
    • Max iterations configured
  4. Ask for confirmation
  5. Execute:
    ./ralph-loop.sh

执行Ralph循环。
预检查:
  1. 验证
    ralph-loop.sh
    是否存在
  2. 验证
    prd.json
    是否存在
  3. 显示摘要:
    • 用户故事总数
    • 未完成的故事(
      passes: false
      的条目)
    • 配置的最大迭代次数
  4. 请求确认
  5. 执行:
    ./ralph-loop.sh

/ralph
(no args)

/ralph
(无参数)

Show help menu:
Ralph Wiggum Loop - Autonomous AI Coding

Commands:
  /ralph setup  - Create Ralph infrastructure in this directory
  /ralph init   - Create a new PRD from scratch
  /ralph run    - Run the Ralph loop

What would you like to do?

显示帮助菜单:
Ralph Wiggum Loop - Autonomous AI Coding

Commands:
  /ralph setup  - Create Ralph infrastructure in this directory
  /ralph init   - Create a new PRD from scratch
  /ralph run    - Run the Ralph loop

What would you like to do?

Key Principles

核心原则

  1. Clean slate each iteration - Fresh context, no baggage
  2. One feature at a time - Prevents scope creep
  3. CI must stay green - Tests and types pass every commit
  4. Progress tracking - Append to progress.txt each iteration
  5. Clear stop condition -
    <promise>COMPLETE</promise>
    when all stories pass
  6. Safety limit - Max iterations prevents infinite loops
  1. 每次迭代全新开始 - 上下文全新,无历史遗留
  2. 一次开发一个功能 - 防止范围蔓延
  3. CI必须保持正常 - 每次提交都要通过测试与类型检查
  4. 进度追踪 - 每次迭代后追加内容至progress.txt
  5. 明确终止条件 - 所有故事通过后标记
    <promise>COMPLETE</promise>
  6. 安全限制 - 最大迭代次数防止无限循环

PRD Quality Checklist

PRD质量检查清单

Good user stories are:
  • ✅ Specific and scoped (completable in one iteration)
  • ✅ Clear acceptance criteria (testable, unambiguous)
  • ✅ Properly prioritized (1 = highest)
  • ✅ Has
    "passes": false
    initially
Bad user stories are:
  • ❌ Too vague ("build the UI")
  • ❌ Too large (touches many systems)
  • ❌ Unclear criteria ("make it nice")
优质用户故事:
  • ✅ 具体且边界清晰(可在一次迭代内完成)
  • ✅ 验收标准明确(可测试、无歧义)
  • ✅ 优先级合理(1为最高优先级)
  • ✅ 初始状态为
    "passes": false
劣质用户故事:
  • ❌ 过于模糊(如“构建UI”)
  • ❌ 范围过大(涉及多个系统)
  • ❌ 标准不明确(如“做得好看”)