ralph-prompt-multi-task
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRalph Prompt Generator: Multi-Task
Ralph 多任务提示词生成器
Overview
概述
Generates structured prompts for multiple related tasks that need to be completed in sequence or parallel. Uses phase-based organization with milestone tracking, cumulative success criteria, and clear progression through tasks.
Best For:
- CRUD operation implementations (Create, Read, Update, Delete)
- Multi-step feature development
- Database migrations with multiple stages
- API endpoint suites
- Test suite creation for multiple modules
- Multi-file refactoring projects
Ralph Philosophy: This generator embraces the principle that failures are deterministic and fixable. Each phase iteration learns from previous attempts. Don't fear failures—they're expected and provide data for improvement through prompt tuning.
为需要按顺序或并行完成的多个关联任务生成结构化提示词。采用基于阶段的组织方式,包含里程碑追踪、累计成功标准以及清晰的任务推进流程。
最佳适用场景:
- CRUD操作实现(创建、读取、更新、删除)
- 多步骤功能开发
- 多阶段数据库迁移
- API端点套件开发
- 多模块测试套件创建
- 多文件重构项目
Ralph 理念:本生成器秉持“失败是可确定且可修复的”原则。每个阶段的迭代都会从之前的尝试中学习。无需惧怕失败——失败是预期之内的,且能为通过提示词调优进行改进提供数据支持。
Quick Start
快速开始
Input Required:
- List of tasks to complete
- Task dependencies (which tasks depend on others)
- Success criteria for each task
- Final completion promise
Generate prompt with:
Generate a Ralph multi-task prompt for:
Tasks:
1. [Task 1]
2. [Task 2]
3. [Task 3]
Dependencies: [Task 2 depends on Task 1, etc.]
Final promise: [COMPLETION_PHRASE]所需输入:
- 待完成的任务列表
- 任务依赖关系(哪些任务依赖于其他任务)
- 每个任务的成功标准
- 最终完成承诺
生成提示词的命令:
Generate a Ralph multi-task prompt for:
Tasks:
1. [Task 1]
2. [Task 2]
3. [Task 3]
Dependencies: [Task 2 depends on Task 1, etc.]
Final promise: [COMPLETION_PHRASE]Prompt Generation Workflow
提示词生成流程
Step 1: Map the Tasks
步骤1:梳理任务
Create a task inventory:
| Task # | Task Name | Dependencies | Verification | Est. Complexity |
|---|---|---|---|---|
| 1 | [Name] | None | [How to verify] | Low/Med/High |
| 2 | [Name] | Task 1 | [How to verify] | Low/Med/High |
| 3 | [Name] | Task 1 | [How to verify] | Low/Med/High |
| 4 | [Name] | Tasks 2, 3 | [How to verify] | Low/Med/High |
创建任务清单:
| 任务编号 | 任务名称 | 依赖关系 | 验证方式 | 预估复杂度 |
|---|---|---|---|---|
| 1 | [名称] | 无 | [验证方法] | 低/中/高 |
| 2 | [名称] | 任务1 | [验证方法] | 低/中/高 |
| 3 | [名称] | 任务1 | [验证方法] | 低/中/高 |
| 4 | [名称] | 任务2、3 | [验证方法] | 低/中/高 |
Step 2: Define Phases
步骤2:定义阶段
Group tasks into logical phases:
Phase Structure:
- Phase 1: Foundation - Independent setup tasks, no dependencies
- Phase 2: Core Implementation - Main functionality, depends on Phase 1
- Phase 3: Enhancement - Additional features, depends on Phase 2
- Phase 4: Validation - Testing, cleanup, verification
将任务分组为逻辑阶段:
阶段结构:
- 阶段1:基础搭建 - 独立的准备任务,无依赖
- 阶段2:核心实现 - 主要功能,依赖阶段1
- 阶段3:功能增强 - 附加功能,依赖阶段2
- 阶段4:验证验收 - 测试、清理、验证工作
Step 3: Create Phase Milestones
步骤3:创建阶段里程碑
Each phase needs:
- Clear entry criteria (what must be done to start)
- Specific tasks within the phase
- Exit criteria (what proves phase is complete)
- Phase milestone marker
每个阶段需要包含:
- 明确的进入标准(开始前必须完成的事项)
- 阶段内的具体任务
- 退出标准(证明阶段完成的依据)
- 阶段里程碑标记
Step 4: Structure the Prompt
步骤4:构建提示词结构
Use this template:
markdown
undefined使用以下模板:
markdown
undefinedMulti-Task: [Overall Objective]
多任务:[整体目标]
Overview
概述
[1-2 sentences describing the overall goal and scope]
[1-2句话描述整体目标和范围]
Task Inventory
任务清单
| # | Task | Phase | Dependencies | Verification |
|---|---|---|---|---|
| 1 | [Task 1] | 1 | None | [Verification] |
| 2 | [Task 2] | 2 | Task 1 | [Verification] |
| 3 | [Task 3] | 2 | Task 1 | [Verification] |
| 4 | [Task 4] | 3 | Tasks 2, 3 | [Verification] |
| 编号 | 任务 | 阶段 | 依赖关系 | 验证方式 |
|---|---|---|---|---|
| 1 | [任务1] | 1 | 无 | [验证方式] |
| 2 | [任务2] | 2 | 任务1 | [验证方式] |
| 3 | [任务3] | 2 | 任务1 | [验证方式] |
| 4 | [任务4] | 3 | 任务2、3 | [验证方式] |
Phase 1: [Phase Name] (Foundation)
阶段1:[阶段名称](基础搭建)
Objective
目标
[What this phase accomplishes]
[本阶段要完成的内容]
Tasks
任务
- [Task 1 Name]
- Requirements: [Specific requirements]
- Files: [Files to create/modify]
- Verification: [How to verify]
- [任务1名称]
- 要求:[具体要求]
- 文件:[需要创建/修改的文件]
- 验证:[验证方法]
Phase 1 Success Criteria
阶段1成功标准
- [Criterion 1]
- [Criterion 2]
- Tests pass:
[test command]
- [标准1]
- [标准2]
- 测试通过:
[测试命令]
Phase 1 Checkpoint
阶段1检查点
When Phase 1 criteria met, document:
PHASE 1 COMPLETE:
- [Task 1]: Done - [evidence]
- Tests: [pass/fail status]Continue to Phase 2.
当阶段1标准达成后,记录:
PHASE 1 COMPLETE:
- [任务1]: 完成 - [证明材料]
- 测试:[通过/失败状态]进入阶段2。
Phase 2: [Phase Name] (Core)
阶段2:[阶段名称](核心实现)
Objective
目标
[What this phase accomplishes]
[本阶段要完成的内容]
Prerequisites
前置条件
- Phase 1 complete
- [Any specific requirements]
- 阶段1已完成
- [其他特定要求]
Tasks
任务
-
[Task 2 Name]
- Requirements: [Specific requirements]
- Files: [Files to create/modify]
- Verification: [How to verify]
-
[Task 3 Name]
- Requirements: [Specific requirements]
- Files: [Files to create/modify]
- Verification: [How to verify]
-
[任务2名称]
- 要求:[具体要求]
- 文件:[需要创建/修改的文件]
- 验证:[验证方法]
-
[任务3名称]
- 要求:[具体要求]
- 文件:[需要创建/修改的文件]
- 验证:[验证方法]
Phase 2 Success Criteria
阶段2成功标准
- [Criterion 1]
- [Criterion 2]
- [Criterion 3]
- Tests pass:
[test command]
- [标准1]
- [标准2]
- [标准3]
- 测试通过:
[测试命令]
Phase 2 Checkpoint
阶段2检查点
When Phase 2 criteria met, document:
PHASE 2 COMPLETE:
- [Task 2]: Done - [evidence]
- [Task 3]: Done - [evidence]
- Tests: [pass/fail status]Continue to Phase 3.
当阶段2标准达成后,记录:
PHASE 2 COMPLETE:
- [任务2]: 完成 - [证明材料]
- [任务3]: 完成 - [证明材料]
- 测试:[通过/失败状态]进入阶段3。
Phase 3: [Phase Name] (Enhancement/Validation)
阶段3:[阶段名称](功能增强/验证验收)
Objective
目标
[What this phase accomplishes]
[本阶段要完成的内容]
Prerequisites
前置条件
- Phases 1-2 complete
- [Any specific requirements]
- 阶段1-2已完成
- [其他特定要求]
Tasks
任务
- [Task 4 Name]
- Requirements: [Specific requirements]
- Files: [Files to create/modify]
- Verification: [How to verify]
- [任务4名称]
- 要求:[具体要求]
- 文件:[需要创建/修改的文件]
- 验证:[验证方法]
Phase 3 Success Criteria
阶段3成功标准
- [Criterion 1]
- [Criterion 2]
- All tests pass:
[test command]
- [标准1]
- [标准2]
- 所有测试通过:
[测试命令]
Final Verification
最终验证
Run complete verification:
bash
undefined执行完整验证:
bash
undefinedAll tests
所有测试
[full test command]
[完整测试命令]
Integration check
集成检查
[integration verification]
[集成验证命令]
Lint/Type check
代码检查/类型检查
[lint command]
undefined[代码检查命令]
undefinedCompletion Checklist
完成 checklist
- Phase 1: All tasks complete and verified
- Phase 2: All tasks complete and verified
- Phase 3: All tasks complete and verified
- All tests passing
- No regressions
- [Any additional requirements]
- 阶段1:所有任务完成并验证
- 阶段2:所有任务完成并验证
- 阶段3:所有任务完成并验证
- 所有测试通过
- 无回归问题
- [其他附加要求]
Completion
完成标识
When ALL phases complete and all checklist items verified:
Output: <promise>[COMPLETION_PHRASE]</promise>
当所有阶段完成且所有checklist项验证通过后:
输出:<promise>[COMPLETION_PHRASE]</promise>
Progress Tracking
进度追踪
As you work, track progress in this format:
PROGRESS:
Phase 1: [COMPLETE/IN PROGRESS] - [X/Y tasks]
Phase 2: [COMPLETE/IN PROGRESS/NOT STARTED] - [X/Y tasks]
Phase 3: [COMPLETE/IN PROGRESS/NOT STARTED] - [X/Y tasks]
Overall: [X/Y tasks complete]工作过程中,按以下格式追踪进度:
PROGRESS:
Phase 1: [已完成/进行中] - [已完成任务数/总任务数]
Phase 2: [已完成/进行中/未开始] - [已完成任务数/总任务数]
Phase 3: [已完成/进行中/未开始] - [已完成任务数/总任务数]
Overall: [已完成任务数/总任务数] 任务完成If Stuck
遇到阻塞时
- Document which phase/task is blocking
- List what's been tried
- Identify the specific blocker
- Do NOT skip tasks or output false promise
undefined- 记录哪个阶段/任务被阻塞
- 列出已尝试的解决方法
- 明确具体的阻塞点
- 不要跳过任务或输出虚假的完成承诺
undefinedExample Prompts
示例提示词
Example 1: CRUD API Implementation
示例1:CRUD API实现
Input:
- Tasks: Create, Read (single), Read (list), Update, Delete for Products
- Dependencies: Create first, then others can be parallel
- Promise: CRUD_API_COMPLETE
Generated Prompt:
markdown
undefined输入:
- 任务:产品的创建、读取(单个)、读取(列表)、更新、删除
- 依赖关系:先完成创建,其他任务可并行
- 完成承诺:CRUD_API_COMPLETE
生成的提示词:
markdown
undefinedMulti-Task: Product CRUD API Implementation
多任务:产品CRUD API实现
Overview
概述
Implement complete CRUD operations for Products resource with RESTful endpoints, validation, and comprehensive tests.
为产品资源实现完整的CRUD操作,包含RESTful端点、验证机制和全面的测试。
Task Inventory
任务清单
| # | Task | Phase | Dependencies | Verification |
|---|---|---|---|---|
| 1 | Product model/schema | 1 | None | Model exists, validates |
| 2 | POST /products (Create) | 2 | Task 1 | Returns 201, creates record |
| 3 | GET /products/:id (Read) | 2 | Task 1 | Returns 200, correct data |
| 4 | GET /products (List) | 2 | Task 1 | Returns array, pagination |
| 5 | PUT /products/:id (Update) | 3 | Tasks 2,3 | Returns 200, updates record |
| 6 | DELETE /products/:id | 3 | Tasks 2,3 | Returns 204, removes record |
| 7 | Integration tests | 4 | Tasks 2-6 | All scenarios pass |
| 编号 | 任务 | 阶段 | 依赖关系 | 验证方式 |
|---|---|---|---|---|
| 1 | 产品模型/ schema | 1 | 无 | 模型存在且验证有效 |
| 2 | POST /products(创建) | 2 | 任务1 | 返回201状态码并创建记录 |
| 3 | GET /products/:id(读取单个) | 2 | 任务1 | 返回200状态码和正确数据 |
| 4 | GET /products(读取列表) | 2 | 任务1 | 返回数组并支持分页 |
| 5 | PUT /products/:id(更新) | 3 | 任务2、3 | 返回200状态码并更新记录 |
| 6 | DELETE /products/:id(删除) | 3 | 任务2、3 | 返回204状态码并移除记录 |
| 7 | 集成测试 | 4 | 任务2-6 | 所有场景测试通过 |
Phase 1: Foundation
阶段1:基础搭建
Objective
目标
Create Product model with validation and database schema.
创建带有验证规则的产品模型和数据库schema。
Tasks
任务
- Product Model
- Requirements:
- Fields: id, name, description, price, category, createdAt, updatedAt
- Validation: name required, price > 0, category from enum
- Files: ,
src/models/product.tssrc/schemas/product.ts - Verification: Model compiles, validation tests pass
- Requirements:
- 产品模型
- 要求:
- 字段:id、name、description、price、category、createdAt、updatedAt
- 验证规则:name为必填项,price大于0,category为枚举值
- 文件:,
src/models/product.tssrc/schemas/product.ts - 验证:模型编译通过,验证测试通过
- 要求:
Phase 1 Success Criteria
阶段1成功标准
- Product model created with all fields
- Validation rules implemented
- Database migration/schema created
- Model tests pass:
npm test -- --grep "Product model"
- 产品模型已创建且包含所有字段
- 验证规则已实现
- 数据库迁移/schema已创建
- 模型测试通过:
npm test -- --grep "Product model"
Phase 1 Checkpoint
阶段1检查点
PHASE 1 COMPLETE:
- Product model: Done - all fields, validation working
- Tests: All model tests passingPHASE 1 COMPLETE:
- 产品模型:完成 - 所有字段、验证规则生效
- 测试:所有模型测试通过Phase 2: Core CRUD Operations
阶段2:核心CRUD操作
Objective
目标
Implement Create, Read (single), and Read (list) endpoints.
实现创建、读取(单个)、读取(列表)端点。
Prerequisites
前置条件
- Phase 1 complete (Product model exists)
- 阶段1已完成(产品模型存在)
Tasks
任务
-
POST /products (Create)
- Requirements:
- Accept JSON body with product data
- Validate input using schema
- Return 201 with created product
- Return 400 for validation errors
- Files: ,
src/routes/products.tssrc/controllers/products.ts - Verification:
curl -X POST -H "Content-Type: application/json" -d '{"name":"Test","price":9.99,"category":"electronics"}' localhost:3000/products
- Requirements:
-
GET /products/:id (Read Single)
- Requirements:
- Return 200 with product data
- Return 404 if not found
- Files: ,
src/routes/products.tssrc/controllers/products.ts - Verification:
curl localhost:3000/products/1
- Requirements:
-
GET /products (List)
- Requirements:
- Return array of products
- Support pagination: page, limit query params
- Return metadata: total, page, limit, totalPages
- Files: ,
src/routes/products.tssrc/controllers/products.ts - Verification:
curl "localhost:3000/products?page=1&limit=10"
- Requirements:
-
POST /products(创建)
- 要求:
- 接受包含产品数据的JSON请求体
- 使用schema验证输入
- 返回201状态码和创建的产品信息
- 验证错误时返回400状态码
- 文件:,
src/routes/products.tssrc/controllers/products.ts - 验证:
curl -X POST -H "Content-Type: application/json" -d '{"name":"Test","price":9.99,"category":"electronics"}' localhost:3000/products
- 要求:
-
GET /products/:id(读取单个)
- 要求:
- 返回200状态码和产品数据
- 产品不存在时返回404状态码
- 文件:,
src/routes/products.tssrc/controllers/products.ts - 验证:
curl localhost:3000/products/1
- 要求:
-
GET /products(读取列表)
- 要求:
- 返回产品数组
- 支持分页:page、limit查询参数
- 返回元数据:total、page、limit、totalPages
- 文件:,
src/routes/products.tssrc/controllers/products.ts - 验证:
curl "localhost:3000/products?page=1&limit=10"
- 要求:
Phase 2 Success Criteria
阶段2成功标准
- POST /products creates product, returns 201
- POST /products returns 400 for invalid data
- GET /products/:id returns product
- GET /products/:id returns 404 for missing
- GET /products returns paginated list
- All endpoint tests pass:
npm test -- --grep "products"
- POST /products可创建产品并返回201
- POST /products对无效数据返回400
- GET /products/:id可返回产品数据
- GET /products/:id对不存在的产品返回404
- GET /products可返回分页列表
- 所有端点测试通过:
npm test -- --grep "products"
Phase 2 Checkpoint
阶段2检查点
PHASE 2 COMPLETE:
- POST /products: Done - creates products, validates input
- GET /products/:id: Done - returns product or 404
- GET /products: Done - paginated list working
- Tests: All passingPHASE 2 COMPLETE:
- POST /products:完成 - 可创建产品并验证输入
- GET /products/:id:完成 - 可返回产品或404
- GET /products:完成 - 分页列表功能正常
- 测试:所有测试通过Phase 3: Update and Delete Operations
阶段3:更新与删除操作
Objective
目标
Complete CRUD with Update and Delete endpoints.
完成CRUD的更新和删除端点实现。
Prerequisites
前置条件
- Phase 2 complete (Create and Read working)
- 阶段2已完成(创建和读取功能正常)
Tasks
任务
-
PUT /products/:id (Update)
- Requirements:
- Accept JSON body with update data
- Partial updates allowed
- Return 200 with updated product
- Return 404 if not found
- Return 400 for validation errors
- Verification:
curl -X PUT -H "Content-Type: application/json" -d '{"price":19.99}' localhost:3000/products/1
- Requirements:
-
DELETE /products/:id
- Requirements:
- Return 204 on success (no content)
- Return 404 if not found
- Actually remove record from database
- Verification:
curl -X DELETE localhost:3000/products/1
- Requirements:
-
PUT /products/:id(更新)
- 要求:
- 接受包含更新数据的JSON请求体
- 支持部分更新
- 返回200状态码和更新后的产品信息
- 产品不存在时返回404状态码
- 验证错误时返回400状态码
- 验证:
curl -X PUT -H "Content-Type: application/json" -d '{"price":19.99}' localhost:3000/products/1
- 要求:
-
DELETE /products/:id(删除)
- 要求:
- 成功时返回204状态码(无内容)
- 产品不存在时返回404状态码
- 从数据库中实际移除记录
- 验证:
curl -X DELETE localhost:3000/products/1
- 要求:
Phase 3 Success Criteria
阶段3成功标准
- PUT /products/:id updates product
- PUT returns 404 for missing, 400 for invalid
- DELETE /products/:id removes product
- DELETE returns 404 for missing
- All endpoint tests pass
- PUT /products/:id可更新产品
- PUT对不存在的产品返回404,对无效数据返回400
- DELETE /products/:id可移除产品
- DELETE对不存在的产品返回404
- 所有端点测试通过
Phase 3 Checkpoint
阶段3检查点
PHASE 3 COMPLETE:
- PUT /products/:id: Done - updates work
- DELETE /products/:id: Done - deletes work
- Tests: All passingPHASE 3 COMPLETE:
- PUT /products/:id:完成 - 更新功能正常
- DELETE /products/:id:完成 - 删除功能正常
- 测试:所有测试通过Phase 4: Integration & Validation
阶段4:集成与验证
Objective
目标
Complete test coverage and integration verification.
完成测试覆盖和集成验证。
Tasks
任务
- Integration Tests
- Requirements:
- Full CRUD flow test (create, read, update, delete)
- Error handling tests (400, 404 scenarios)
- Pagination tests
- Edge cases (empty database, special characters)
- Files:
tests/integration/products.test.ts
- Requirements:
- 集成测试
- 要求:
- 完整的CRUD流程测试(创建、读取、更新、删除)
- 错误处理测试(400、404场景)
- 分页测试
- 边缘场景测试(空数据库、特殊字符)
- 文件:
tests/integration/products.test.ts
- 要求:
Phase 4 Success Criteria
阶段4成功标准
- Integration tests cover full CRUD flow
- Error scenarios tested
- All tests passing:
npm test - No TypeScript errors:
npm run typecheck
- 集成测试覆盖完整CRUD流程
- 错误场景已测试
- 所有测试通过:
npm test - 无TypeScript错误:
npm run typecheck
Final Verification
最终验证
bash
undefinedbash
undefinedAll tests
所有测试
npm test
npm test
Type check
类型检查
npm run typecheck
npm run typecheck
Manual CRUD flow test
手动CRUD流程测试
curl -X POST -H "Content-Type: application/json" -d '{"name":"Test Product","price":29.99,"category":"electronics"}' localhost:3000/products
curl localhost:3000/products
curl localhost:3000/products/1
curl -X PUT -H "Content-Type: application/json" -d '{"price":39.99}' localhost:3000/products/1
curl -X DELETE localhost:3000/products/1
undefinedcurl -X POST -H "Content-Type: application/json" -d '{"name":"Test Product","price":29.99,"category":"electronics"}' localhost:3000/products
curl localhost:3000/products
curl localhost:3000/products/1
curl -X PUT -H "Content-Type: application/json" -d '{"price":39.99}' localhost:3000/products/1
curl -X DELETE localhost:3000/products/1
undefinedCompletion Checklist
完成checklist
- Phase 1: Product model complete
- Phase 2: Create, Read single, Read list working
- Phase 3: Update, Delete working
- Phase 4: Integration tests complete
- All tests passing
- Manual verification successful
- 阶段1:产品模型完成
- 阶段2:创建、单个读取、列表读取功能正常
- 阶段3:更新、删除功能正常
- 阶段4:集成测试完成
- 所有测试通过
- 手动验证成功
Completion
完成标识
When ALL phases complete and all checklist items verified:
Output: <promise>CRUD_API_COMPLETE</promise>
当所有阶段完成且所有checklist项验证通过后:
输出:<promise>CRUD_API_COMPLETE</promise>
Progress Tracking
进度追踪
PROGRESS:
Phase 1: [status] - 1/1 tasks
Phase 2: [status] - 3/3 tasks
Phase 3: [status] - 2/2 tasks
Phase 4: [status] - 1/1 tasks
Overall: X/7 tasks completePROGRESS:
Phase 1: [状态] - 1/1 任务完成
Phase 2: [状态] - 3/3 任务完成
Phase 3: [状态] - 2/2 任务完成
Phase 4: [状态] - 1/1 任务完成
Overall: X/7 任务完成If Stuck
遇到阻塞时
- Document which phase/task is blocking
- Note specific error messages
- List approaches tried
- Do NOT skip tasks or output false promise
undefined- 记录哪个阶段/任务被阻塞
- 记录具体的错误信息
- 列出已尝试的解决方法
- 不要跳过任务或输出虚假的完成承诺
undefinedExample 2: CI/CD Pipeline Setup
示例2:CI/CD流水线搭建
Input:
- Tasks: Lint, Test, Build, Deploy staging, Deploy prod
- Dependencies: Sequential progression
- Promise: PIPELINE_COMPLETE
Generated Prompt:
markdown
undefined输入:
- 任务:代码检查、测试、构建、部署到预发布环境、部署到生产环境
- 依赖关系:按顺序推进
- 完成承诺:PIPELINE_COMPLETE
生成的提示词:
markdown
undefinedMulti-Task: CI/CD Pipeline Implementation
多任务:CI/CD流水线实现
Overview
概述
Set up complete CI/CD pipeline with linting, testing, building, and staged deployments using GitHub Actions.
使用GitHub Actions搭建完整的CI/CD流水线,包含代码检查、测试、构建和分阶段部署。
Task Inventory
任务清单
| # | Task | Phase | Dependencies | Verification |
|---|---|---|---|---|
| 1 | Workflow file structure | 1 | None | File exists |
| 2 | Lint job | 2 | Task 1 | Workflow runs lint |
| 3 | Test job | 2 | Task 2 | Tests run in CI |
| 4 | Build job | 3 | Task 3 | Build artifacts created |
| 5 | Deploy staging | 4 | Task 4 | Staging deployment works |
| 6 | Deploy production | 4 | Task 5 | Prod deployment works |
| 编号 | 任务 | 阶段 | 依赖关系 | 验证方式 |
|---|---|---|---|---|
| 1 | 工作流文件结构 | 1 | 无 | 文件存在 |
| 2 | 代码检查任务 | 2 | 任务1 | 工作流执行代码检查 |
| 3 | 测试任务 | 2 | 任务2 | 测试在CI中执行 |
| 4 | 构建任务 | 3 | 任务3 | 生成构建产物 |
| 5 | 部署到预发布环境 | 4 | 任务4 | 预发布部署成功 |
| 6 | 部署到生产环境 | 4 | 任务5 | 生产部署成功 |
Phase 1: Workflow Foundation
阶段1:工作流基础
Tasks
任务
- Workflow File Structure
- Create
.github/workflows/ci.yml - Define triggers (push to main, PRs)
- Set up job structure
- Create
- 工作流文件结构
- 创建
.github/workflows/ci.yml - 定义触发条件(推送到main分支、PR)
- 搭建任务结构
- 创建
Phase 1 Success Criteria
阶段1成功标准
- Workflow file exists and is valid YAML
- Triggers defined for push and PR
- 工作流文件存在且为有效的YAML格式
- 已定义推送和PR的触发条件
Phase 2: Quality Gates
阶段2:质量门禁
Tasks
任务
-
Lint Job
- Run linter on all source files
- Fail pipeline if lint errors
-
Test Job
- Depends on lint passing
- Run full test suite
- Upload coverage report
-
代码检查任务
- 对所有源代码执行代码检查
- 存在代码检查错误时流水线失败
-
测试任务
- 依赖代码检查通过
- 执行完整测试套件
- 上传覆盖率报告
Phase 2 Success Criteria
阶段2成功标准
- Lint job runs and catches errors
- Test job runs full suite
- Pipeline fails if tests fail
- 代码检查任务执行并能捕获错误
- 测试任务执行完整测试套件
- 测试失败时流水线终止
Phase 3: Build
阶段3:构建
Tasks
任务
- Build Job
- Depends on tests passing
- Create production build
- Upload build artifacts
- 构建任务
- 依赖测试通过
- 生成生产环境构建产物
- 上传构建产物
Phase 3 Success Criteria
阶段3成功标准
- Build creates production artifacts
- Artifacts uploaded and accessible
- 构建生成生产环境产物
- 构建产物已上传且可访问
Phase 4: Deployments
阶段4:部署
Tasks
任务
-
Deploy Staging
- Automatic on main branch
- Deploy to staging environment
-
Deploy Production
- Manual approval required
- Deploy to production
-
部署到预发布环境
- 推送到main分支时自动部署
- 部署到预发布环境
-
部署到生产环境
- 需要手动审批
- 部署到生产环境
Phase 4 Success Criteria
阶段4成功标准
- Staging auto-deploys on main
- Production requires manual trigger
- Both environments update correctly
- 预发布环境在main分支推送时自动部署
- 生产环境需要手动触发
- 两个环境都能正确更新
Completion
完成标识
When all phases verified:
Output: <promise>PIPELINE_COMPLETE</promise>
undefined当所有阶段验证通过后:
输出:<promise>PIPELINE_COMPLETE</promise>
undefinedBest Practices
最佳实践
Task Organization
任务组织
- Group related tasks into phases
- Clear dependencies between phases
- Independent tasks within phases can be parallel
- 将关联任务分组到同一阶段
- 明确阶段间的依赖关系
- 阶段内的独立任务可并行执行
Phase Design
阶段设计
- Each phase has clear entry/exit criteria
- Document checkpoint at each phase boundary
- Phase names should reflect purpose (Foundation, Core, Enhancement, Validation)
- 每个阶段有明确的进入/退出标准
- 在每个阶段边界记录检查点
- 阶段名称应反映其用途(基础搭建、核心实现、功能增强、验证验收)
Progress Tracking
进度追踪
- Update progress marker after each task
- Document evidence at checkpoints
- Don't skip phases even if tasks seem simple
- 完成每个任务后更新进度标记
- 在检查点记录证明材料
- 即使任务看似简单,也不要跳过阶段
DO:
建议:
- Create clear phase boundaries
- Define dependencies explicitly
- Include verification for each task
- Track progress systematically
- Checkpoint after each phase
- 创建清晰的阶段边界
- 明确定义依赖关系
- 为每个任务包含验证方式
- 系统地追踪进度
- 每个阶段后设置检查点
DON'T:
禁忌:
- Skip phases or tasks
- Leave dependencies unclear
- Forget phase checkpoints
- Output promise before all phases complete
- 跳过阶段或任务
- 依赖关系不明确
- 遗漏阶段检查点
- 所有阶段完成前输出完成承诺
Integration with Ralph Loop
与Ralph Loop集成
bash
/ralph-wiggum:ralph-loop "[paste generated prompt]" --completion-promise "YOUR_PROMISE" --max-iterations 50Recommended iterations by complexity:
- 4-5 tasks:
--max-iterations 35-45 - 6-8 tasks:
--max-iterations 50-70 - 9+ tasks:
--max-iterations 80-100
For single-task prompts, see .
For project-level prompts, see .
For research/analysis prompts, see .
ralph-prompt-single-taskralph-prompt-projectralph-prompt-researchbash
/ralph-wiggum:ralph-loop "[粘贴生成的提示词]" --completion-promise "YOUR_PROMISE" --max-iterations 50按复杂度推荐的迭代次数:
- 4-5个任务:
--max-iterations 35-45 - 6-8个任务:
--max-iterations 50-70 - 9个以上任务:
--max-iterations 80-100
关于单任务提示词,请查看 。
关于项目级提示词,请查看 。
关于研究/分析类提示词,请查看 。
ralph-prompt-single-taskralph-prompt-projectralph-prompt-research