blueprint-work-order
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGenerate a work-order document for isolated subagent execution with optional GitHub issue integration.
生成用于隔离Subagent执行的工单文档,可选择集成GitHub Issue。
Flags
标志
| Flag | Description |
|---|---|
| Create local work-order only, skip GitHub issue creation |
| Create work-order from existing GitHub issue #N |
| Create work-order from existing PRP (auto-populates context) |
Default behavior: Creates both local work-order AND GitHub issue with label.
work-order| 标志 | 说明 |
|---|---|
| 仅创建本地工单,跳过GitHub Issue创建 |
| 从现有GitHub Issue #N创建工单 |
| 从现有PRP创建工单(自动填充上下文) |
默认行为:同时创建本地工单和带有标签的GitHub Issue。
work-orderPrerequisites
前置条件
- Blueprint Development initialized (exists)
docs/blueprint/ - At least one PRD exists (unless using or
--from-issue)--from-prp - CLI authenticated (unless using
gh)--no-publish
- 已初始化蓝图开发(目录存在)
docs/blueprint/ - 至少存在一个PRD(除非使用或
--from-issue)--from-prp - CLI已完成认证(除非使用
gh)--no-publish
Mode: Create from PRP (--from-prp NAME
)
--from-prp NAME模式:从PRP创建(--from-prp NAME
)
--from-prp NAMEWhen is provided:
--from-prp NAME-
Read PRP:bash
cat docs/prps/$NAME.md -
Extract PRP content:
- Parse frontmatter for id, confidence score, implements references
- Extract Objective section
- Extract Implementation Blueprint tasks
- Extract TDD Requirements
- Extract Success Criteria
- Note ai_docs references
-
Verify confidence:
- If confidence < 9: Warn that PRP may not be ready for delegation
- Ask to proceed anyway or return to refine PRP
-
Generate work-order:
- Pre-populate from PRP content
- Include relevant ai_docs as inline context (not references)
- Copy TDD requirements verbatim
- Include file list from PRP's Codebase Intelligence section
-
Continue to Step 6 (save and optionally publish)
name: blueprint-work-order
当提供时:
--from-prp NAME-
读取PRP:bash
cat docs/prps/$NAME.md -
提取PRP内容:
- 解析前置元数据中的id、置信度分数、实现引用
- 提取目标部分
- 提取实现蓝图任务
- 提取TDD需求
- 提取成功标准
- 记录ai_docs引用
-
验证置信度:
- 如果置信度<9:警告PRP可能尚未准备好进行委托
- 询问是否继续或返回优化PRP
-
生成工单:
- 从PRP内容预填充
- 将相关ai_docs作为内联上下文包含(而非引用)
- 逐字复制TDD需求
- 包含PRP代码库智能部分中的文件列表
-
继续执行步骤6(保存并可选发布)
name: blueprint-work-order
Mode: Create from Existing Issue (--from-issue N
)
--from-issue N模式:从现有Issue创建(--from-issue N
)
--from-issue NWhen is provided:
--from-issue N-
Fetch issue:bash
gh issue view N --json title,body,labels,number -
Parse issue content:
- Extract objective from title/body
- Extract any TDD requirements or success criteria if present
- Note existing labels
-
Generate work-order:
- Number matches issue number (e.g., issue #42 → work-order )
042-... - Pre-populate from issue content
- Add context sections (files, PRD reference, etc.)
- Number matches issue number (e.g., issue #42 → work-order
-
Update issue with link:bash
gh issue comment N --body "Work-order created: \`docs/blueprint/work-orders/NNN-task-name.md\`" gh issue edit N --add-label "work-order" -
Continue to save and report (skip to Step 6 below)
当提供时:
--from-issue N-
获取Issue:bash
gh issue view N --json title,body,labels,number -
解析Issue内容:
- 从标题/正文中提取目标
- 提取任何存在的TDD需求或成功标准
- 记录现有标签
-
生成工单:
- 编号与Issue编号匹配(例如:Issue #42 → 工单)
042-... - 从Issue内容预填充
- 添加上下文部分(文件、PRD引用等)
- 编号与Issue编号匹配(例如:Issue #42 → 工单
-
更新Issue并添加链接:bash
gh issue comment N --body "工单已创建:\`docs/blueprint/work-orders/NNN-task-name.md\`" gh issue edit N --add-label "work-order" -
继续保存并报告(直接跳至下方步骤6)
Mode: Create New Work-Order (Default)
模式:创建新工单(默认)
Step 1: Analyze Current State
步骤1:分析当前状态
- Read for current phase and tasks
docs/blueprint/feature-tracker.json - Run to check uncommitted work
git status - Run to see recent work
git log -5 --oneline - Find existing work-orders (count them for numbering)
- 读取获取当前阶段和任务
docs/blueprint/feature-tracker.json - 运行检查未提交的工作
git status - 运行查看近期工作
git log -5 --oneline - 查找现有工单(统计数量用于编号)
Step 2: Read Relevant PRDs
步骤2:读取相关PRD
- Read PRD files to understand requirements
- Identify next logical work unit based on:
- Work-overview progress
- PRD phase/section ordering
- Git history (what's been done)
- 读取PRD文件以理解需求
- 根据以下内容确定下一个合理的工作单元:
- 工作概览进度
- PRD阶段/章节顺序
- Git历史记录(已完成的工作)
Step 3: Determine Next Work Unit
步骤3:确定下一个工作单元
Should be:
- Specific: Single feature/component/fix
- Isolated: Minimal dependencies
- Testable: Clear success criteria
- Focused: 1-4 hours of work
Good examples:
- "Implement JWT token generation methods"
- "Add input validation to registration endpoint"
- "Create database migration for users table"
Bad examples (too broad):
- "Implement authentication"
- "Fix bugs"
工作单元应满足:
- 具体:单一功能/组件/修复
- 隔离:最小依赖
- 可测试:明确的成功标准
- 聚焦:1-4小时的工作量
良好示例:
- "实现JWT令牌生成方法"
- "为注册端点添加输入验证"
- "创建用户表的数据库迁移"
不良示例(范围过广):
- "实现认证功能"
- "修复Bug"
Step 4: Determine Minimal Context
步骤4:确定最小化上下文
- Files to modify/create (only relevant ones)
- PRD sections (only specific requirements for this task)
- Existing code (only relevant excerpts, not full files)
- Dependencies (external libraries, environment variables)
- 需修改/创建的文件(仅相关文件)
- PRD章节(仅针对此任务的具体需求)
- 现有代码(仅相关片段,而非完整文件)
- 依赖项(外部库、环境变量)
Step 5: Generate Work-Order
步骤5:生成工单
- Number: Find highest existing work-order number + 1 (001, 002, etc.)
- Name:
NNN-brief-task-description.md
Work-order structure:
markdown
name: blueprint-work-order
---
id: WO-NNN
created: {YYYY-MM-DD}
status: pending
implements: # Source PRP or PRD
- PRP-NNN
relates-to: # Related documents
- ADR-NNNN
github-issues:
- N
---- 编号:现有最高工单编号+1(001、002等)
- 名称:
NNN-简要任务描述.md
工单结构:
markdown
name: blueprint-work-order
---
id: WO-NNN
created: {YYYY-MM-DD}
status: pending
implements: # 来源PRP或PRD
- PRP-NNN
relates-to: # 相关文档
- ADR-NNNN
github-issues:
- N
---Work-Order NNN: [Task Name]
工单NNN:[任务名称]
ID: WO-NNN
GitHub Issue: #N
Status: pending
ID:WO-NNN
GitHub Issue:#N
状态:pending
Objective
目标
[One sentence describing what needs to be accomplished]
[一句话描述需要完成的内容]
Context
上下文
Required Files
所需文件
[Only files needed - list with purpose]
[仅列出需要的文件及用途]
PRD Reference
PRD引用
[Link to specific PRD section, not entire PRD]
[链接到具体PRD章节,而非整个PRD]
Technical Decisions
技术决策
[Only decisions relevant to this specific task]
[仅与此特定任务相关的决策]
Existing Code
现有代码
[Only relevant code excerpts needed for integration]
[仅集成所需的相关代码片段]
TDD Requirements
TDD需求
Test 1: [Test Description]
测试1:[测试描述]
[Exact test to write, with code template]
Expected Outcome: Test should fail
[需编写的精确测试,包含代码模板]
预期结果:测试应失败
Test 2: [Test Description]
测试2:[测试描述]
[Exact test to write]
Expected Outcome: Test should fail
[More tests as needed]
[需编写的精确测试]
预期结果:测试应失败
[根据需要添加更多测试]
Implementation Steps
实现步骤
- Write Test 1 - Run: - Expected: FAIL
[test_command] - Implement Test 1 - Run: - Expected: PASS
[test_command] - Refactor (if needed) - Run: - Expected: STILL PASS [Repeat for all tests]
[test_command]
- 编写测试1 - 运行:- 预期:失败
[test_command] - 实现测试1 - 运行:- 预期:通过
[test_command] - 重构(如有需要) - 运行:- 预期:仍通过 [对所有测试重复上述步骤]
[test_command]
Success Criteria
成功标准
- All specified tests written and passing
- [Specific functional requirement met]
- [Performance/security baseline met]
- No regressions (existing tests pass)
- 所有指定测试已编写并通过
- [满足特定功能需求]
- [满足性能/安全基线]
- 无回归(现有测试通过)
Notes
注意事项
[Additional context, gotchas, considerations]
[额外上下文、潜在问题、考虑因素]
Related Work-Orders
相关工单
- Depends on: Work-Order NNN (if applicable)
- Blocks: Work-Order NNN (if applicable)
name: blueprint-work-order
---- 依赖于:工单NNN(如适用)
- 阻塞:工单NNN(如适用)
name: blueprint-work-order
---Step 6: Save Work-Order
步骤6:保存工单
Save to
Ensure zero-padded numbering (001, 002, 010, 100)
docs/blueprint/work-orders/NNN-task-name.md保存至
确保使用补零编号(001、002、010、100)
docs/blueprint/work-orders/NNN-task-name.mdStep 7: Create GitHub Issue (unless --no-publish
)
--no-publish步骤7:创建GitHub Issue(除非使用--no-publish
)
--no-publishbash
gh issue create \
--title "[WO-NNN] [Task Name]" \
--body "## Work Order: [Task Name]
**ID**: WO-NNN
**Local Context**: \`docs/blueprint/work-orders/NNN-task-name.md\`bash
gh issue create \
--title "[WO-NNN] [任务名称]" \
--body "## 工单:[任务名称]
**ID**:WO-NNN
**本地上下文**:\`docs/blueprint/work-orders/NNN-task-name.md\`Related Documents
相关文档
- Implements: {PRP-NNN or PRD-NNN}
- Related ADRs: {list of ADR-NNNN}
- 实现:{PRP-NNN或PRD-NNN}
- 相关ADR:{ADR-NNNN列表}
Objective
目标
[One-line objective from work order]
[工单中的一句话目标]
TDD Requirements
TDD需求
- Test 1: [description]
- Test 2: [description]
- 测试1:[描述]
- 测试2:[描述]
Success Criteria
成功标准
- [Criterion 1]
- [Criterion 2]
AI-assisted development work order. See linked file for full execution context."
--label "work-order"
--label "work-order"
Capture issue number and update work-order file:
```bash- [标准1]
- [标准2]
AI辅助开发工单。查看链接文件获取完整执行上下文。"
--label "work-order"
--label "work-order"
捕获Issue编号并更新工单文件:
```bashExtract issue number from gh output
从gh输出中提取Issue编号
gh issue create ... 2>&1 | grep -oE '#[0-9]+' | head -1
Update the `**GitHub Issue**:` line in the work-order file with the issue number.gh issue create ... 2>&1 | grep -oE '#[0-9]+' | head -1
将工单文件中的`**GitHub Issue**:`行更新为获取到的Issue编号。Step 8: Update docs/blueprint/feature-tracker.json
docs/blueprint/feature-tracker.json步骤8:更新docs/blueprint/feature-tracker.json
docs/blueprint/feature-tracker.jsonAdd new work-order to pending tasks:
bash
jq '.tasks.pending += [{"id": "WO-NNN", "description": "[Task name]", "source": "PRP-NNN", "added": "YYYY-MM-DD"}]' \
docs/blueprint/feature-tracker.json > tmp.json && mv tmp.json docs/blueprint/feature-tracker.json将新工单添加至待处理任务:
bash
jq '.tasks.pending += [{"id": "WO-NNN", "description": "[任务名称]", "source": "PRP-NNN", "added": "YYYY-MM-DD"}]' \
docs/blueprint/feature-tracker.json > tmp.json && mv tmp.json docs/blueprint/feature-tracker.jsonStep 8.5: Update Manifest
步骤8.5:更新清单
Update ID registry:
docs/blueprint/manifest.jsonjson
{
"id_registry": {
"documents": {
"WO-NNN": {
"path": "docs/blueprint/work-orders/NNN-task-name.md",
"title": "[Task Name]",
"implements": ["PRP-NNN"],
"github_issues": [N],
"created": "{date}"
}
},
"github_issues": {
"N": ["WO-NNN", "PRP-NNN"]
}
}
}Also update the source PRP/PRD to add this work-order to its tracking.
更新ID注册表:
docs/blueprint/manifest.jsonjson
{
"id_registry": {
"documents": {
"WO-NNN": {
"path": "docs/blueprint/work-orders/NNN-task-name.md",
"title": "[Task Name]",
"implements": ["PRP-NNN"],
"github_issues": [N],
"created": "{date}"
}
},
"github_issues": {
"N": ["WO-NNN", "PRP-NNN"]
}
}
}同时更新源PRP/PRD,将此工单添加至其追踪列表。
Step 9: Report
步骤9:报告
Work-order created!
ID: WO-NNN
Work-Order: 003-jwt-token-generation.md
Location: docs/blueprint/work-orders/003-jwt-token-generation.md
GitHub Issue: #42 (or "Local only" if --no-publish)
Traceability:
- Implements: PRP-002 (OAuth Integration)
- Related: ADR-0003 (Session Storage)
Objective: [Brief objective]
Context included:
- Files: [List files]
- Tests: [Number of tests specified]
- Dependencies: [Key dependencies]
Ready for execution:
- Can be executed by subagent with isolated context
- TDD workflow enforced (tests specified first)
- Clear success criteria defined
- PR should use "Fixes #42" to auto-close issue
- Commit messages should use: feat(WO-NNN): description工单已创建!
ID:WO-NNN
工单文件:003-jwt-token-generation.md
位置:docs/blueprint/work-orders/003-jwt-token-generation.md
GitHub Issue:#42(如果使用--no-publish则显示"仅本地")
可追溯性:
- 实现:PRP-002(OAuth集成)
- 相关:ADR-0003(会话存储)
目标:[简要目标]
包含的上下文:
- 文件:[文件列表]
- 测试:[指定的测试数量]
- 依赖项:[关键依赖项]
已准备好执行:
- 可由Subagent使用隔离上下文执行
- 强制TDD工作流(先指定测试)
- 定义明确的成功标准
- PR应使用"Fixes #42"以自动关闭Issue
- 提交信息应使用:feat(WO-NNN): 描述Step 10: Prompt for Next Action
步骤10:提示下一步操作
Use AskUserQuestion:
question: "Work-order ready. What would you like to do?"
options:
- label: "Execute this work-order (Recommended)"
description: "Start working on the task with TDD workflow"
- label: "Create another work-order"
description: "Generate the next task from pending items"
- label: "Delegate to subagent"
description: "Hand off for isolated execution"
- label: "I'm done for now"
description: "Exit - work-order is saved and ready"Based on selection:
- "Execute this work-order" → Run with work-order context
/project:continue - "Create another work-order" → Run again
/blueprint:work-order - "Delegate to subagent" → Provide handoff instructions for subagent execution
- "I'm done" → Exit
name: blueprint-work-order
使用AskUserQuestion:
question: "工单已准备好。您想要执行什么操作?"
options:
- label: "执行此工单(推荐)"
description: "按照TDD工作流开始处理任务"
- label: "创建另一个工单"
description: "从待处理项生成下一个任务"
- label: "委托给Subagent"
description: "移交以进行隔离执行"
- label: "我现在完成了"
description: "退出 - 工单已保存并准备就绪"根据选择执行:
- "执行此工单" → 使用工单上下文运行
/project:continue - "创建另一个工单" → 再次运行
/blueprint:work-order - "委托给Subagent" → 提供Subagent执行的移交说明
- "我现在完成了" → 退出
name: blueprint-work-order
Key Principles
核心原则
- Minimal context: Only what's needed, not full files/PRDs
- Specific tests: Exact test cases, not vague descriptions
- TDD enforced: Tests specified before implementation
- Clear criteria: Unambiguous success checkboxes
- Isolated: Task should be doable with only provided context
- Transparent: GitHub issue provides visibility to collaborators
- 最小化上下文:仅包含所需内容,而非完整文件/PRD
- 具体测试:精确的测试用例,而非模糊描述
- 强制TDD:先指定测试再实现
- 明确标准:无歧义的成功检查项
- 隔离性:仅使用提供的上下文即可完成任务
- 透明性:GitHub Issue为协作者提供可见性
Error Handling
错误处理
| Condition | Action |
|---|---|
| No PRDs exist | Guide to write PRDs first |
| No tasks in feature-tracker | Ask for current phase/status |
| Task unclear | Ask user what to work on next |
| Warn and fallback to |
Issue already has | Warn, ask to update or create new |
name: blueprint-work-order
| 条件 | 操作 |
|---|---|
| 无PRD存在 | 引导先编写PRD |
| 功能追踪器中无任务 | 询问当前阶段/状态 |
| 任务不明确 | 询问用户下一步要处理什么 |
| 警告并回退到 |
Issue已带有 | 警告,询问是否更新或创建新工单 |
name: blueprint-work-order
GitHub Integration Notes
GitHub集成说明
Completion Flow
完成流程
- Work completed on work-order
- PR created with in body/title
Fixes #N - Work-order moved to directory
completed/ - Issue auto-closes when PR merges
- 工单工作完成
- 创建PR并在正文/标题中包含
Fixes #N - 将工单移至目录
completed/ - PR合并后Issue自动关闭
Label Convention
标签约定
The label identifies issues created from this workflow. Create it in your repo if it doesn't exist:
work-orderbash
gh label create work-order --description "AI-assisted work order" --color "0E8A16"work-orderbash
gh label create work-order --description "AI-assisted work order" --color "0E8A16"Offline Mode
离线模式
Use when:
--no-publish- Working offline
- Private experimentation
- Issue visibility not needed
Can publish later by manually creating issue and updating work-order file.
在以下情况使用:
--no-publish- 离线工作时
- 私有实验时
- 不需要Issue可见性时
之后可以通过手动创建Issue并更新工单文件来发布。