blueprint-work-order

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Generate a work-order document for isolated subagent execution with optional GitHub issue integration.
生成用于隔离Subagent执行的工单文档,可选择集成GitHub Issue。

Flags

标志

FlagDescription
--no-publish
Create local work-order only, skip GitHub issue creation
--from-issue N
Create work-order from existing GitHub issue #N
--from-prp NAME
Create work-order from existing PRP (auto-populates context)
Default behavior: Creates both local work-order AND GitHub issue with
work-order
label.
标志说明
--no-publish
仅创建本地工单,跳过GitHub Issue创建
--from-issue N
从现有GitHub Issue #N创建工单
--from-prp NAME
从现有PRP创建工单(自动填充上下文)
默认行为:同时创建本地工单和带有
work-order
标签的GitHub Issue。

Prerequisites

前置条件

  • Blueprint Development initialized (
    docs/blueprint/
    exists)
  • At least one PRD exists (unless using
    --from-issue
    or
    --from-prp
    )
  • gh
    CLI authenticated (unless using
    --no-publish
    )

  • 已初始化蓝图开发(
    docs/blueprint/
    目录存在)
  • 至少存在一个PRD(除非使用
    --from-issue
    --from-prp
  • gh
    CLI已完成认证(除非使用
    --no-publish

Mode: Create from PRP (
--from-prp NAME
)

模式:从PRP创建(
--from-prp NAME

When
--from-prp NAME
is provided:
  1. Read PRP:
    bash
    cat docs/prps/$NAME.md
  2. 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
  3. Verify confidence:
    • If confidence < 9: Warn that PRP may not be ready for delegation
    • Ask to proceed anyway or return to refine PRP
  4. 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
  5. Continue to Step 6 (save and optionally publish)

name: blueprint-work-order

当提供
--from-prp NAME
时:
  1. 读取PRP:
    bash
    cat docs/prps/$NAME.md
  2. 提取PRP内容:
    • 解析前置元数据中的id、置信度分数、实现引用
    • 提取目标部分
    • 提取实现蓝图任务
    • 提取TDD需求
    • 提取成功标准
    • 记录ai_docs引用
  3. 验证置信度:
    • 如果置信度<9:警告PRP可能尚未准备好进行委托
    • 询问是否继续或返回优化PRP
  4. 生成工单:
    • 从PRP内容预填充
    • 将相关ai_docs作为内联上下文包含(而非引用)
    • 逐字复制TDD需求
    • 包含PRP代码库智能部分中的文件列表
  5. 继续执行步骤6(保存并可选发布)

name: blueprint-work-order

Mode: Create from Existing Issue (
--from-issue N
)

模式:从现有Issue创建(
--from-issue N

When
--from-issue N
is provided:
  1. Fetch issue:
    bash
    gh issue view N --json title,body,labels,number
  2. Parse issue content:
    • Extract objective from title/body
    • Extract any TDD requirements or success criteria if present
    • Note existing labels
  3. 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.)
  4. 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"
  5. Continue to save and report (skip to Step 6 below)

当提供
--from-issue N
时:
  1. 获取Issue:
    bash
    gh issue view N --json title,body,labels,number
  2. 解析Issue内容:
    • 从标题/正文中提取目标
    • 提取任何存在的TDD需求或成功标准
    • 记录现有标签
  3. 生成工单:
    • 编号与Issue编号匹配(例如:Issue #42 → 工单
      042-...
    • 从Issue内容预填充
    • 添加上下文部分(文件、PRD引用等)
  4. 更新Issue并添加链接:
    bash
    gh issue comment N --body "工单已创建:\`docs/blueprint/work-orders/NNN-task-name.md\`"
    gh issue edit N --add-label "work-order"
  5. 继续保存并报告(直接跳至下方步骤6)

Mode: Create New Work-Order (Default)

模式:创建新工单(默认)

Step 1: Analyze Current State

步骤1:分析当前状态

  • Read
    docs/blueprint/feature-tracker.json
    for current phase and tasks
  • Run
    git status
    to check uncommitted work
  • Run
    git log -5 --oneline
    to see recent work
  • 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

实现步骤

  1. Write Test 1 - Run:
    [test_command]
    - Expected: FAIL
  2. Implement Test 1 - Run:
    [test_command]
    - Expected: PASS
  3. Refactor (if needed) - Run:
    [test_command]
    - Expected: STILL PASS [Repeat for all tests]
  1. 编写测试1 - 运行:
    [test_command]
    - 预期:失败
  2. 实现测试1 - 运行:
    [test_command]
    - 预期:通过
  3. 重构(如有需要) - 运行:
    [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
docs/blueprint/work-orders/NNN-task-name.md
Ensure zero-padded numbering (001, 002, 010, 100)
保存至
docs/blueprint/work-orders/NNN-task-name.md
确保使用补零编号(001、002、010、100)

Step 7: Create GitHub Issue (unless
--no-publish
)

步骤7:创建GitHub Issue(除非使用
--no-publish

bash
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"

Capture issue number and update work-order file:
```bash
  • [标准1]
  • [标准2]

AI辅助开发工单。查看链接文件获取完整执行上下文。"
--label "work-order"

捕获Issue编号并更新工单文件:
```bash

Extract 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

步骤8:更新
docs/blueprint/feature-tracker.json

Add 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.json

Step 8.5: Update Manifest

步骤8.5:更新清单

Update
docs/blueprint/manifest.json
ID registry:
json
{
  "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.
更新
docs/blueprint/manifest.json
ID注册表:
json
{
  "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
    /project:continue
    with work-order context
  • "Create another work-order" → Run
    /blueprint:work-order
    again
  • "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

错误处理

ConditionAction
No PRDs existGuide to write PRDs first
No tasks in feature-trackerAsk for current phase/status
Task unclearAsk user what to work on next
gh
not authenticated
Warn and fallback to
--no-publish
behavior
Issue already has
work-order
label
Warn, ask to update or create new

name: blueprint-work-order

条件操作
无PRD存在引导先编写PRD
功能追踪器中无任务询问当前阶段/状态
任务不明确询问用户下一步要处理什么
gh
未认证
警告并回退到
--no-publish
行为
Issue已带有
work-order
标签
警告,询问是否更新或创建新工单

name: blueprint-work-order

GitHub Integration Notes

GitHub集成说明

Completion Flow

完成流程

  1. Work completed on work-order
  2. PR created with
    Fixes #N
    in body/title
  3. Work-order moved to
    completed/
    directory
  4. Issue auto-closes when PR merges
  1. 工单工作完成
  2. 创建PR并在正文/标题中包含
    Fixes #N
  3. 将工单移至
    completed/
    目录
  4. PR合并后Issue自动关闭

Label Convention

标签约定

The
work-order
label identifies issues created from this workflow. Create it in your repo if it doesn't exist:
bash
gh label create work-order --description "AI-assisted work order" --color "0E8A16"
work-order
标签用于标识从此工作流创建的Issue。如果仓库中不存在此标签,请创建:
bash
gh label create work-order --description "AI-assisted work order" --color "0E8A16"

Offline Mode

离线模式

Use
--no-publish
when:
  • Working offline
  • Private experimentation
  • Issue visibility not needed
Can publish later by manually creating issue and updating work-order file.
在以下情况使用
--no-publish
:
  • 离线工作时
  • 私有实验时
  • 不需要Issue可见性时
之后可以通过手动创建Issue并更新工单文件来发布。