ralph-prompt-builder

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Ralph Prompt Builder (Master Orchestrator)

Ralph Prompt Builder(主协调器)

Overview

概述

Master skill for generating prompts optimized for the Ralph Wiggum autonomous loop technique. This orchestrator analyzes your task description and routes to the appropriate specialized generator:
Task TypeGeneratorBest For
Single focused task
ralph-prompt-single-task
Bug fixes, single features, refactoring
Multiple related tasks
ralph-prompt-multi-task
CRUD, multi-step features, migrations
Complete project
ralph-prompt-project
Greenfield apps, libraries, tools
Research/Analysis
ralph-prompt-research
Audits, planning, investigations
这是为Ralph Wiggum自主循环技术优化的提示词生成主技能。该协调器会分析你的任务描述,并路由到对应的专用生成器:
任务类型生成器适用场景
单一聚焦任务
ralph-prompt-single-task
漏洞修复、单一功能开发、代码重构
多个相关任务
ralph-prompt-multi-task
CRUD操作、多步骤功能开发、数据迁移
完整项目
ralph-prompt-project
全新应用、类库、工具开发
研究/分析
ralph-prompt-research
审计、规划、调研

Quick Start

快速开始

Generate any Ralph prompt:
Use ralph-prompt-builder to create a prompt for: [describe your task]
Example:
Use ralph-prompt-builder to create a prompt for: Implementing user authentication with JWT for our Express API
The skill will:
  1. Classify your task
  2. Route to the appropriate generator
  3. Guide you through required inputs
  4. Output a ready-to-use Ralph prompt
生成任意Ralph提示词:
Use ralph-prompt-builder to create a prompt for: [描述你的任务]
示例:
Use ralph-prompt-builder to create a prompt for: 为我们的Express API实现基于JWT的用户认证
该技能会:
  1. 对你的任务进行分类
  2. 路由到对应的生成器
  3. 引导你提供所需输入
  4. 输出可直接使用的Ralph提示词

Task Classification

任务分类

How Tasks Are Classified

任务分类方式

IndicatorsClassificationGenerator
Fix, repair, single change, one moduleSingle Task
ralph-prompt-single-task
Multiple features, CRUD, several endpointsMulti-Task
ralph-prompt-multi-task
Build from scratch, new app, create toolProject
ralph-prompt-project
Analyze, audit, compare, plan, investigateResearch
ralph-prompt-research
分类指标任务类型生成器
修复、修补、单一变更、单个模块单任务
ralph-prompt-single-task
多个功能、CRUD、多个接口多任务
ralph-prompt-multi-task
从零构建、新应用、创建工具项目
ralph-prompt-project
分析、审计、对比、规划、调研研究
ralph-prompt-research

Classification Questions

分类判断问题

To classify your task, consider:
  1. Is this creating something new from scratch or modifying existing code?
    • New from scratch → Project or Multi-Task
    • Modifying existing → Single Task or Multi-Task
  2. How many distinct deliverables?
    • One deliverable → Single Task
    • 2-5 related deliverables → Multi-Task
    • Complete application/tool → Project
    • Analysis document → Research
  3. Does it involve investigation before action?
    • Yes, research required → Research
    • No, implementation focus → Single/Multi/Project
  4. What's the completion criteria?
    • Tests pass → Single Task
    • Multiple features working → Multi-Task
    • Complete app running → Project
    • Document produced → Research
要对任务进行分类,请考虑以下问题:
  1. 这是从零创建新内容还是修改现有代码?
    • 从零创建 → 项目或多任务
    • 修改现有代码 → 单任务或多任务
  2. 有多少个独立的交付成果?
    • 1个交付成果 → 单任务
    • 2-5个相关交付成果 → 多任务
    • 完整应用/工具 → 项目
    • 分析文档 → 研究
  3. 是否需要先进行调研再行动?
    • 是,需要调研 → 研究
    • 否,聚焦实现 → 单任务/多任务/项目
  4. 完成标准是什么?
    • 测试通过 → 单任务
    • 多个功能正常运行 → 多任务
    • 完整应用可运行 → 项目
    • 产出文档 → 研究

Classification Examples

分类示例

Single Task Examples

单任务示例

  • "Fix the race condition in token refresh"
  • "Add pagination to the users endpoint"
  • "Refactor database queries to use async/await"
  • "Write tests for the auth module"
  • "Optimize the image upload function"
  • "修复令牌刷新中的竞态条件"
  • "为用户接口添加分页功能"
  • "重构数据库查询以使用async/await"
  • "为认证模块编写测试用例"
  • "优化图片上传功能"

Multi-Task Examples

多任务示例

  • "Implement CRUD for Products resource"
  • "Add login, signup, logout, and password reset"
  • "Set up CI/CD pipeline with lint, test, build, deploy"
  • "Add validation, error handling, and logging to API"
  • "Create user, profile, and settings endpoints"
  • "实现产品资源的CRUD操作"
  • "添加登录、注册、登出和密码重置功能"
  • "搭建包含代码检查、测试、构建、部署的CI/CD流水线"
  • "为API添加验证、错误处理和日志功能"
  • "创建用户、个人资料和设置接口"

Project Examples

项目示例

  • "Build a REST API for a todo list application"
  • "Create a CLI tool for database migrations"
  • "Build a URL shortener service"
  • "Create a markdown documentation generator"
  • "Build an authentication microservice"
  • "为待办事项应用构建REST API"
  • "创建用于数据库迁移的CLI工具"
  • "构建URL短链服务"
  • "创建Markdown文档生成器"
  • "构建认证微服务"

Research Examples

研究示例

  • "Analyze the codebase for security vulnerabilities"
  • "Compare React vs Vue vs Svelte for our needs"
  • "Create a migration plan from MongoDB to PostgreSQL"
  • "Audit dependencies for outdated packages"
  • "Document the current API architecture"
  • "分析代码库中的安全漏洞"
  • "对比React、Vue和Svelte以满足我们的需求"
  • "制定从MongoDB迁移到PostgreSQL的计划"
  • "审计依赖包是否存在过时情况"
  • "记录当前API的架构"

Workflow

工作流程

Step 1: Describe Your Task

步骤1:描述你的任务

Provide a description including:
  • What needs to be done
  • What technology/context
  • Any specific requirements
  • Desired outcome
Template:
Task: [What you want to accomplish]
Context: [Relevant background - tech stack, existing code, etc.]
Requirements: [Specific requirements or constraints]
Outcome: [What success looks like]
提供包含以下内容的描述:
  • 需要完成的工作
  • 技术/上下文信息
  • 任何特定要求
  • 预期成果
模板:
任务:[你想要完成的内容]
上下文:[相关背景 - 技术栈、现有代码等]
要求:[特定要求或约束]
成果:[成功的标准]

Step 2: Review Classification

步骤2:查看分类结果

The orchestrator will classify your task and explain why:
CLASSIFICATION: [Task Type]
REASONING: [Why this classification]
GENERATOR: ralph-prompt-[type]

Does this classification look correct? If not, specify your preferred type.
协调器会对你的任务进行分类并说明原因:
分类:[任务类型]
推理:[分类原因]
生成器:ralph-prompt-[类型]

该分类是否正确?如果不正确,请指定你偏好的类型。

Step 3: Provide Generator Inputs

步骤3:提供生成器所需输入

Each generator requires specific inputs:
Single Task:
  • Task description
  • Success criteria (how to verify)
  • Completion promise text
Multi-Task:
  • List of tasks
  • Dependencies between tasks
  • Final completion promise
Project:
  • Project description
  • Tech stack
  • Feature list
  • Completion promise
Research:
  • Research objective
  • Scope (in/out)
  • Deliverable format
  • Completion promise
每个生成器需要特定的输入:
单任务:
  • 任务描述
  • 成功标准(如何验证)
  • 完成承诺文本
多任务:
  • 任务列表
  • 任务间的依赖关系
  • 最终完成承诺
项目:
  • 项目描述
  • 技术栈
  • 功能列表
  • 完成承诺
研究:
  • 研究目标
  • 范围(包含/排除)
  • 交付物格式
  • 完成承诺

Step 4: Generate & Review

步骤4:生成并审核

The appropriate generator creates the prompt. Review and customize:
  1. Verify requirements are complete
  2. Check verification commands are correct
  3. Confirm completion criteria match your needs
  4. Adjust max-iterations recommendation
对应的生成器会创建提示词。请审核并自定义:
  1. 验证要求是否完整
  2. 检查验证命令是否正确
  3. 确认完成标准符合你的需求
  4. 调整推荐的最大迭代次数

Step 5: Execute with Ralph

步骤5:使用Ralph执行

bash
/ralph-wiggum:ralph-loop "[generated prompt]" --completion-promise "[YOUR_PROMISE]" --max-iterations [recommended]
bash
/ralph-wiggum:ralph-loop "[生成的提示词]" --completion-promise "[你的承诺]" --max-iterations [推荐次数]

Generator Summaries

生成器概述

ralph-prompt-single-task

ralph-prompt-single-task

Purpose: Focused tasks with clear success criteria
Structure:
  1. Task title and objective
  2. Context
  3. Requirements
  4. Success criteria (checkboxes)
  5. Verification steps with commands
  6. TDD approach
  7. Completion conditions
  8. If stuck guidance
Best practices:
  • Include actual test commands
  • Make criteria binary (pass/fail)
  • Include TDD loop
Recommended iterations: 15-35

用途: 有明确成功标准的聚焦任务
结构:
  1. 任务标题和目标
  2. 上下文
  3. 要求
  4. 成功标准(复选框形式)
  5. 带命令的验证步骤
  6. TDD方法
  7. 完成条件
  8. 遇到问题时的指导
最佳实践:
  • 包含实际测试命令
  • 使标准为二元判断(通过/失败)
  • 包含TDD循环
推荐迭代次数:15-35

ralph-prompt-multi-task

ralph-prompt-multi-task

Purpose: Multiple related tasks organized in phases
Structure:
  1. Task inventory table
  2. Phase breakdown (Foundation → Core → Enhancement → Validation)
  3. Per-phase tasks with deliverables
  4. Phase checkpoints
  5. Progress tracking
  6. Final verification
Best practices:
  • Group tasks into logical phases
  • Clear dependencies
  • Document checkpoints
Recommended iterations: 35-100

用途: 分阶段组织的多个相关任务
结构:
  1. 任务清单表格
  2. 阶段划分(基础→核心→增强→验证)
  3. 各阶段的任务和交付物
  4. 阶段检查点
  5. 进度跟踪
  6. 最终验证
最佳实践:
  • 将任务按逻辑分组为不同阶段
  • 明确依赖关系
  • 记录检查点
推荐迭代次数:35-100

ralph-prompt-project

ralph-prompt-project

Purpose: Complete projects from scratch
Structure:
  1. Project vision and specs
  2. Six phases:
    • Phase 0: Setup
    • Phase 1: Architecture
    • Phase 2: Core
    • Phase 3: Features
    • Phase 4: Testing
    • Phase 5: Documentation
  3. Per-phase tasks and deliverables
  4. Final verification
  5. Progress tracking
Best practices:
  • Define non-goals explicitly
  • Complete all phases in order
  • Don't skip testing/documentation
Recommended iterations: 60-200

用途: 从零开始的完整项目
结构:
  1. 项目愿景和规格
  2. 六个阶段:
    • 阶段0:环境搭建
    • 阶段1:架构设计
    • 阶段2:核心功能
    • 阶段3:扩展功能
    • 阶段4:测试
    • 阶段5:文档
  3. 各阶段的任务和交付物
  4. 最终验证
  5. 进度跟踪
最佳实践:
  • 明确界定非目标
  • 按顺序完成所有阶段
  • 不要跳过测试和文档
推荐迭代次数:60-200

ralph-prompt-research

ralph-prompt-research

Purpose: Analysis, audits, planning, investigations
Structure:
  1. Research objective and scope
  2. Five phases:
    • Phase 1: Discovery
    • Phase 2: Analysis
    • Phase 3: Synthesis
    • Phase 4: Recommendations
    • Phase 5: Documentation
  3. Deliverables at each phase
  4. Evidence-based conclusions
Best practices:
  • Define scope boundaries clearly
  • Create artifacts as you go
  • Support conclusions with evidence
Recommended iterations: 30-100
用途: 分析、审计、规划、调研
结构:
  1. 研究目标和范围
  2. 五个阶段:
    • 阶段1:发现
    • 阶段2:分析
    • 阶段3:综合
    • 阶段4:建议
    • 阶段5:文档
  3. 各阶段的交付物
  4. 基于证据的结论
最佳实践:
  • 明确界定范围边界
  • 逐步生成工件
  • 用证据支持结论
推荐迭代次数:30-100

Common Patterns

常见模式

Choosing a Completion Promise

选择完成承诺

Good promises are:
  • Specific to the task
  • Verifiable (you can check if it's true)
  • Action-oriented
Examples:
Task TypeGood PromiseWhy
Bug fix
AUTH_FIX_COMPLETE
Specific to what was fixed
CRUD
PRODUCT_CRUD_DONE
Names the resource
Project
TODO_API_V1_COMPLETE
Identifies the project
Research
SECURITY_AUDIT_DELIVERED
References deliverable
优质承诺的特点:
  • 针对具体任务
  • 可验证(你可以检查是否达成)
  • 以行动为导向
示例:
任务类型优质承诺原因
漏洞修复
AUTH_FIX_COMPLETE
明确指向修复的内容
CRUD操作
PRODUCT_CRUD_DONE
命名对应的资源
项目
TODO_API_V1_COMPLETE
标识具体项目
研究
SECURITY_AUDIT_DELIVERED
关联交付物

The Ralph Philosophy

Ralph理念

The Ralph Wiggum technique is built on a key insight: failures are deterministic and fixable.
  • Deterministically bad: When prompts fail, they fail in predictable ways
  • Fixable through iteration: Each failure provides data to improve
  • Prompt tuning > tool changing: Fix failures by improving the prompt, not switching approaches
This means: Don't fear failures. They're expected and correctable. The loop will iterate until success.
Ralph Wiggum技术基于一个核心见解:失败是确定性的且可修复的
  • 确定性失败:当提示词失败时,失败模式是可预测的
  • 通过迭代修复:每次失败都能提供改进数据
  • 提示词调优 > 工具更换:通过改进提示词来修复失败,而非更换方法
这意味着:不要害怕失败。失败是预期之内的,且可以纠正。循环会持续迭代直到成功。

Setting Max Iterations

设置最大迭代次数

Base recommendations by complexity:
ComplexitySingle TaskMulti-TaskProjectResearch
Simple15356030
Medium255010050
Complex357015080
Very Complex-100200100
Adjust based on:
  • Familiarity with codebase (-20%)
  • External dependencies (+30%)
  • Unclear requirements (+50%)
  • Comprehensive testing needed (+25%)
根据复杂度的基础推荐:
复杂度单任务多任务项目研究
简单15356030
中等255010050
复杂357015080
极复杂-100200100
调整依据:
  • 对代码库的熟悉程度(-20%)
  • 外部依赖(+30%)
  • 需求不明确(+50%)
  • 需要全面测试(+25%)

Splitting Large Tasks

拆分大型任务

If task feels too large, consider splitting:
Project → Multiple Projects:
Instead of: "Build complete e-commerce platform"
Split into:
1. Project: User authentication service
2. Project: Product catalog API
3. Project: Shopping cart service
4. Project: Order processing service
Multi-Task → Separate Multi-Tasks:
Instead of: "Build full admin dashboard"
Split into:
1. Multi-Task: User management (CRUD + roles)
2. Multi-Task: Analytics dashboard
3. Multi-Task: Settings panel
如果任务感觉太大,可以考虑拆分:
项目 → 多个项目:
原任务:"构建完整的电商平台"
拆分为:
1. 项目:用户认证服务
2. 项目:产品目录API
3. 项目:购物车服务
4. 项目:订单处理服务
多任务 → 独立多任务:
原任务:"构建完整的管理后台"
拆分为:
1. 多任务:用户管理(CRUD + 角色)
2. 多任务:数据分析仪表盘
3. 多任务:设置面板

Troubleshooting

故障排除

Task Won't Complete

任务无法完成

Symptoms: Hitting max iterations without completion
Causes and fixes:
  1. Scope too large → Split into smaller tasks
  2. Unclear criteria → Make success criteria more specific
  3. External dependencies → Document or mock dependencies
  4. Infinite tests → Check for flaky tests
症状: 达到最大迭代次数仍未完成
原因和修复方案:
  1. 范围过大 → 拆分为更小的任务
  2. 标准不明确 → 让成功标准更具体
  3. 外部依赖 → 记录或模拟依赖
  4. 无限测试 → 检查是否存在不稳定的测试用例

Wrong Generator Selected

生成器选择错误

Fix: Specify the generator explicitly:
Use ralph-prompt-single-task (not multi-task) for: [task]
修复: 明确指定生成器:
Use ralph-prompt-single-task (not multi-task) for: [任务]

Prompt Too Vague

提示词过于模糊

Fix: Ensure your input includes:
  • Specific files/modules affected
  • Actual test commands
  • Concrete success criteria
  • Technology context
修复: 确保你的输入包含:
  • 受影响的具体文件/模块
  • 实际测试命令
  • 具体的成功标准
  • 技术上下文

Integration with Ralph Loop

与Ralph Loop集成

After generating a prompt:
bash
undefined
生成提示词后:
bash
undefined

Copy the generated prompt to a file or use directly

将生成的提示词复制到文件或直接使用

/ralph-wiggum:ralph-loop "[YOUR_GENERATED_PROMPT]"
--completion-promise "YOUR_PROMISE"
--max-iterations 50
/ralph-wiggum:ralph-loop "[你的生成提示词]"
--completion-promise "你的承诺"
--max-iterations 50

Monitor progress

监控进度

head -10 .claude/ralph-loop.local.md
head -10 .claude/ralph-loop.local.md

Cancel if needed

必要时取消

/ralph-wiggum:cancel-ralph
undefined
/ralph-wiggum:cancel-ralph
undefined

Best Practices

最佳实践

DO:

建议:

  • Start with the right generator for your task type
  • Provide complete context and requirements
  • Include specific verification commands
  • Set appropriate max-iterations for complexity
  • Review generated prompts before running
  • 根据任务类型选择正确的生成器
  • 提供完整的上下文和要求
  • 包含具体的验证命令
  • 根据复杂度设置合适的最大迭代次数
  • 运行前审核生成的提示词

DON'T:

不建议:

  • Use vague task descriptions
  • Skip the classification step
  • Ignore the "If Stuck" guidance in generated prompts
  • Set max-iterations too low (iterations are normal)
  • Expect first-try perfection—Ralph embraces iteration
  • 使用模糊的任务描述
  • 跳过分类步骤
  • 忽略生成提示词中的"遇到问题时的指导"
  • 设置过低的最大迭代次数(迭代是正常流程)
  • 期望一次成功——Ralph拥抱迭代

Quick Reference

快速参考

Task Type Decision Tree

任务类型决策树

Is this research/analysis/planning?
├─ YES → ralph-prompt-research
└─ NO → Is this building a complete app from scratch?
         ├─ YES → ralph-prompt-project
         └─ NO → Are there multiple related deliverables?
                  ├─ YES → ralph-prompt-multi-task
                  └─ NO → ralph-prompt-single-task
这是研究/分析/规划类任务吗?
├─ 是 → ralph-prompt-research
└─ 否 → 这是从零构建完整应用吗?
         ├─ 是 → ralph-prompt-project
         └─ 否 → 是否有多个相关交付物?
                  ├─ 是 → ralph-prompt-multi-task
                  └─ 否 → ralph-prompt-single-task

Input Checklist

输入检查清单

Before generating, have ready:
  • Clear task description
  • Technology context (language, framework)
  • Success criteria (how to verify done)
  • Completion promise text
  • Any specific requirements
生成前,请准备好:
  • 清晰的任务描述
  • 技术上下文(语言、框架)
  • 成功标准(如何验证完成)
  • 完成承诺文本
  • 任何特定要求

Output Checklist

输出检查清单

Before running the prompt:
  • All requirements captured
  • Verification commands are correct
  • Success criteria are binary (pass/fail)
  • TDD/iteration approach included
  • "If Stuck" guidance provided
  • Max iterations set appropriately

Specialized Generators:
  • ralph-prompt-single-task
    - Single focused implementations
  • ralph-prompt-multi-task
    - Multiple related tasks
  • ralph-prompt-project
    - Complete projects
  • ralph-prompt-research
    - Analysis and planning
Ralph Loop Commands:
  • /ralph-wiggum:ralph-loop
    - Start a loop
  • /ralph-wiggum:cancel-ralph
    - Cancel active loop
  • /ralph-wiggum:help
    - Get help
运行提示词前,请确认:
  • 所有要求已被捕获
  • 验证命令正确
  • 成功标准为二元判断(通过/失败)
  • 包含TDD/迭代方法
  • 提供了"遇到问题时的指导"
  • 最大迭代次数设置合理

专用生成器:
  • ralph-prompt-single-task
    - 单一聚焦实现
  • ralph-prompt-multi-task
    - 多个相关任务
  • ralph-prompt-project
    - 完整项目
  • ralph-prompt-research
    - 分析和规划
Ralph Loop命令:
  • /ralph-wiggum:ralph-loop
    - 启动循环
  • /ralph-wiggum:cancel-ralph
    - 取消活跃循环
  • /ralph-wiggum:help
    - 获取帮助