ralph-prompt-builder
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRalph 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 Type | Generator | Best For |
|---|---|---|
| Single focused task | | Bug fixes, single features, refactoring |
| Multiple related tasks | | CRUD, multi-step features, migrations |
| Complete project | | Greenfield apps, libraries, tools |
| Research/Analysis | | Audits, planning, investigations |
这是为Ralph Wiggum自主循环技术优化的提示词生成主技能。该协调器会分析你的任务描述,并路由到对应的专用生成器:
| 任务类型 | 生成器 | 适用场景 |
|---|---|---|
| 单一聚焦任务 | | 漏洞修复、单一功能开发、代码重构 |
| 多个相关任务 | | CRUD操作、多步骤功能开发、数据迁移 |
| 完整项目 | | 全新应用、类库、工具开发 |
| 研究/分析 | | 审计、规划、调研 |
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 APIThe skill will:
- Classify your task
- Route to the appropriate generator
- Guide you through required inputs
- 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的用户认证该技能会:
- 对你的任务进行分类
- 路由到对应的生成器
- 引导你提供所需输入
- 输出可直接使用的Ralph提示词
Task Classification
任务分类
How Tasks Are Classified
任务分类方式
| Indicators | Classification | Generator |
|---|---|---|
| Fix, repair, single change, one module | Single Task | |
| Multiple features, CRUD, several endpoints | Multi-Task | |
| Build from scratch, new app, create tool | Project | |
| Analyze, audit, compare, plan, investigate | Research | |
| 分类指标 | 任务类型 | 生成器 |
|---|---|---|
| 修复、修补、单一变更、单个模块 | 单任务 | |
| 多个功能、CRUD、多个接口 | 多任务 | |
| 从零构建、新应用、创建工具 | 项目 | |
| 分析、审计、对比、规划、调研 | 研究 | |
Classification Questions
分类判断问题
To classify your task, consider:
-
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
-
How many distinct deliverables?
- One deliverable → Single Task
- 2-5 related deliverables → Multi-Task
- Complete application/tool → Project
- Analysis document → Research
-
Does it involve investigation before action?
- Yes, research required → Research
- No, implementation focus → Single/Multi/Project
-
What's the completion criteria?
- Tests pass → Single Task
- Multiple features working → Multi-Task
- Complete app running → Project
- Document produced → Research
要对任务进行分类,请考虑以下问题:
-
这是从零创建新内容还是修改现有代码?
- 从零创建 → 项目或多任务
- 修改现有代码 → 单任务或多任务
-
有多少个独立的交付成果?
- 1个交付成果 → 单任务
- 2-5个相关交付成果 → 多任务
- 完整应用/工具 → 项目
- 分析文档 → 研究
-
是否需要先进行调研再行动?
- 是,需要调研 → 研究
- 否,聚焦实现 → 单任务/多任务/项目
-
完成标准是什么?
- 测试通过 → 单任务
- 多个功能正常运行 → 多任务
- 完整应用可运行 → 项目
- 产出文档 → 研究
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:
- Verify requirements are complete
- Check verification commands are correct
- Confirm completion criteria match your needs
- Adjust max-iterations recommendation
对应的生成器会创建提示词。请审核并自定义:
- 验证要求是否完整
- 检查验证命令是否正确
- 确认完成标准符合你的需求
- 调整推荐的最大迭代次数
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:
- Task title and objective
- Context
- Requirements
- Success criteria (checkboxes)
- Verification steps with commands
- TDD approach
- Completion conditions
- If stuck guidance
Best practices:
- Include actual test commands
- Make criteria binary (pass/fail)
- Include TDD loop
Recommended iterations: 15-35
用途: 有明确成功标准的聚焦任务
结构:
- 任务标题和目标
- 上下文
- 要求
- 成功标准(复选框形式)
- 带命令的验证步骤
- TDD方法
- 完成条件
- 遇到问题时的指导
最佳实践:
- 包含实际测试命令
- 使标准为二元判断(通过/失败)
- 包含TDD循环
推荐迭代次数:15-35
ralph-prompt-multi-task
ralph-prompt-multi-task
Purpose: Multiple related tasks organized in phases
Structure:
- Task inventory table
- Phase breakdown (Foundation → Core → Enhancement → Validation)
- Per-phase tasks with deliverables
- Phase checkpoints
- Progress tracking
- Final verification
Best practices:
- Group tasks into logical phases
- Clear dependencies
- Document checkpoints
Recommended iterations: 35-100
用途: 分阶段组织的多个相关任务
结构:
- 任务清单表格
- 阶段划分(基础→核心→增强→验证)
- 各阶段的任务和交付物
- 阶段检查点
- 进度跟踪
- 最终验证
最佳实践:
- 将任务按逻辑分组为不同阶段
- 明确依赖关系
- 记录检查点
推荐迭代次数:35-100
ralph-prompt-project
ralph-prompt-project
Purpose: Complete projects from scratch
Structure:
- Project vision and specs
- Six phases:
- Phase 0: Setup
- Phase 1: Architecture
- Phase 2: Core
- Phase 3: Features
- Phase 4: Testing
- Phase 5: Documentation
- Per-phase tasks and deliverables
- Final verification
- Progress tracking
Best practices:
- Define non-goals explicitly
- Complete all phases in order
- Don't skip testing/documentation
Recommended iterations: 60-200
用途: 从零开始的完整项目
结构:
- 项目愿景和规格
- 六个阶段:
- 阶段0:环境搭建
- 阶段1:架构设计
- 阶段2:核心功能
- 阶段3:扩展功能
- 阶段4:测试
- 阶段5:文档
- 各阶段的任务和交付物
- 最终验证
- 进度跟踪
最佳实践:
- 明确界定非目标
- 按顺序完成所有阶段
- 不要跳过测试和文档
推荐迭代次数:60-200
ralph-prompt-research
ralph-prompt-research
Purpose: Analysis, audits, planning, investigations
Structure:
- Research objective and scope
- Five phases:
- Phase 1: Discovery
- Phase 2: Analysis
- Phase 3: Synthesis
- Phase 4: Recommendations
- Phase 5: Documentation
- Deliverables at each phase
- Evidence-based conclusions
Best practices:
- Define scope boundaries clearly
- Create artifacts as you go
- Support conclusions with evidence
Recommended iterations: 30-100
用途: 分析、审计、规划、调研
结构:
- 研究目标和范围
- 五个阶段:
- 阶段1:发现
- 阶段2:分析
- 阶段3:综合
- 阶段4:建议
- 阶段5:文档
- 各阶段的交付物
- 基于证据的结论
最佳实践:
- 明确界定范围边界
- 逐步生成工件
- 用证据支持结论
推荐迭代次数: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 Type | Good Promise | Why |
|---|---|---|
| Bug fix | | Specific to what was fixed |
| CRUD | | Names the resource |
| Project | | Identifies the project |
| Research | | References deliverable |
优质承诺的特点:
- 针对具体任务
- 可验证(你可以检查是否达成)
- 以行动为导向
示例:
| 任务类型 | 优质承诺 | 原因 |
|---|---|---|
| 漏洞修复 | | 明确指向修复的内容 |
| CRUD操作 | | 命名对应的资源 |
| 项目 | | 标识具体项目 |
| 研究 | | 关联交付物 |
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:
| Complexity | Single Task | Multi-Task | Project | Research |
|---|---|---|---|---|
| Simple | 15 | 35 | 60 | 30 |
| Medium | 25 | 50 | 100 | 50 |
| Complex | 35 | 70 | 150 | 80 |
| Very Complex | - | 100 | 200 | 100 |
Adjust based on:
- Familiarity with codebase (-20%)
- External dependencies (+30%)
- Unclear requirements (+50%)
- Comprehensive testing needed (+25%)
根据复杂度的基础推荐:
| 复杂度 | 单任务 | 多任务 | 项目 | 研究 |
|---|---|---|---|---|
| 简单 | 15 | 35 | 60 | 30 |
| 中等 | 25 | 50 | 100 | 50 |
| 复杂 | 35 | 70 | 150 | 80 |
| 极复杂 | - | 100 | 200 | 100 |
调整依据:
- 对代码库的熟悉程度(-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 serviceMulti-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:
- Scope too large → Split into smaller tasks
- Unclear criteria → Make success criteria more specific
- External dependencies → Document or mock dependencies
- Infinite tests → Check for flaky tests
症状: 达到最大迭代次数仍未完成
原因和修复方案:
- 范围过大 → 拆分为更小的任务
- 标准不明确 → 让成功标准更具体
- 外部依赖 → 记录或模拟依赖
- 无限测试 → 检查是否存在不稳定的测试用例
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
undefinedCopy the generated prompt to a file or use directly
将生成的提示词复制到文件或直接使用
/ralph-wiggum:ralph-loop "[YOUR_GENERATED_PROMPT]"
--completion-promise "YOUR_PROMISE"
--max-iterations 50
--completion-promise "YOUR_PROMISE"
--max-iterations 50
/ralph-wiggum:ralph-loop "[你的生成提示词]"
--completion-promise "你的承诺"
--max-iterations 50
--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
undefinedBest 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-taskInput 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:
- - Single focused implementations
ralph-prompt-single-task - - Multiple related tasks
ralph-prompt-multi-task - - Complete projects
ralph-prompt-project - - Analysis and planning
ralph-prompt-research
Ralph Loop Commands:
- - Start a loop
/ralph-wiggum:ralph-loop - - Cancel active loop
/ralph-wiggum:cancel-ralph - - Get help
/ralph-wiggum: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