workflow-optimizer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

workflow-optimizer

工作流优化器

Purpose

用途

Guide users through the SDD workflow by determining current position, recommending next steps, identifying parallel work opportunities, and tracking progress.
Problem Solved: Users must manually determine next steps in the 15-layer SDD workflow, leading to workflow friction, missed dependencies, and inefficient sequencing.
Solution: Analyze completed artifacts, determine workflow position, and provide prioritized recommendations for next steps with clear rationale.
通过确定当前位置、推荐下一步操作、识别并行工作机会并跟踪进度,引导用户完成SDD工作流。
解决的问题:用户必须手动确定15层SDD工作流中的下一步操作,这会导致工作流受阻、遗漏依赖关系以及顺序安排低效。
解决方案:分析已完成的工件,确定工作流位置,并提供带有清晰理由的优先级下一步操作建议。

When to Use This Skill

何时使用此技能

Use workflow-optimizer when:
  • Completed an artifact and need guidance on next steps
  • Starting documentation and need workflow overview
  • Want to identify parallel work opportunities
  • Need progress report on documentation completion
  • Unsure which artifacts to create next
Do NOT use when:
  • Need skill recommendation for specific task (use skill-recommender)
  • Need project context (use context-analyzer)
  • Validating artifacts (use trace-check or quality-advisor)
在以下场景使用workflow-optimizer
  • 完成一个工件后,需要下一步操作指导
  • 开始文档创作时,需要工作流概览
  • 想要识别并行工作机会
  • 需要文档完成进度报告
  • 不确定接下来要创建哪些工件
请勿在以下场景使用
  • 需要针对特定任务的技能推荐(使用skill-recommender)
  • 需要项目上下文信息(使用context-analyzer)
  • 验证工件(使用trace-check或quality-advisor)

Skill Inputs

技能输入

InputTypeRequiredDescription
project_rootstringYesRoot path of project to analyze
completed_artifactstringNoID of just-completed artifact (e.g., PRD-00)
focus_areastringNoOptional filter: "core-workflow", "quality", "planning"
输入项类型是否必填描述
project_rootstring待分析项目的根路径
completed_artifactstring刚完成的工件ID(例如:PRD-00)
focus_areastring可选筛选条件:"core-workflow"、"quality"、"planning"

Skill Workflow

技能工作流

Step 1: Analyze Project State

步骤1:分析项目状态

Scan project to determine documentation status:
Artifact Discovery:
bash
undefined
扫描项目以确定文档状态:
工件发现
bash
undefined

Discover all artifacts

Discover all artifacts

find {project_root}/docs -name ".md" -o -name ".yaml" -o -name "*.feature"

**Status Extraction**:
Extract status from Document Control section:
- Draft
- In Review
- Approved
- Superseded
- Deprecated

**Project State Model**:
```yaml
project_state:
  scan_timestamp: 2025-11-29T14:30:00Z
  artifacts_by_type:
    BRD:
      total: 3
      approved: 2
      draft: 1
      latest: BRD-03
    PRD:
      total: 2
      approved: 1
      draft: 1
      latest: PRD-00
    EARS:
      total: 0
    # ... etc
  total_artifacts: 25
  approved_artifacts: 18
  draft_artifacts: 7
find {project_root}/docs -name ".md" -o -name ".yaml" -o -name "*.feature"

**状态提取**:
从文档控制部分提取状态:
- Draft(草稿)
- In Review(审核中)
- Approved(已批准)
- Superseded(已取代)
- Deprecated(已废弃)

**项目状态模型**:
```yaml
project_state:
  scan_timestamp: 2025-11-29T14:30:00Z
  artifacts_by_type:
    BRD:
      total: 3
      approved: 2
      draft: 1
      latest: BRD-03
    PRD:
      total: 2
      approved: 1
      draft: 1
      latest: PRD-00
    EARS:
      total: 0
    # ... etc
  total_artifacts: 25
  approved_artifacts: 18
  draft_artifacts: 7

Step 2: Determine Workflow Position

步骤2:确定工作流位置

Map artifacts to SDD workflow layers:
Layer Definition:
yaml
workflow_layers:
  layer_1:
    type: BRD
    name: Business Requirements
    prerequisite: null
    description: "Business objectives and stakeholder needs"

  layer_2:
    type: PRD
    name: Product Requirements
    prerequisite: BRD
    description: "Product features and user needs"

  layer_3:
    type: EARS
    name: Formal Requirements
    prerequisite: PRD
    description: "WHEN-THE-SHALL formal requirements"

  layer_4:
    type: BDD
    name: Behavior Tests
    prerequisite: EARS
    description: "Gherkin acceptance scenarios"

  layer_5:
    type: ADR
    name: Architecture Decisions
    prerequisite: BDD
    description: "Technical decision records"

  layer_6:
    type: SYS
    name: System Requirements
    prerequisite: ADR
    description: "Technical system specifications"

  layer_7:
    type: REQ
    name: Atomic Requirements
    prerequisite: SYS
    description: "Detailed atomic requirements"

  layer_8:
    type: IMPL
    name: Implementation Plan
    prerequisite: REQ
    optional: true
    description: "WHO/WHEN project management"

  layer_9:
    type: CTR
    name: Interface Contracts
    prerequisite: [IMPL, REQ]
    optional: true
    description: "API contracts and schemas"

  layer_10:
    type: SPEC
    name: Technical Specifications
    prerequisite: REQ
    description: "YAML implementation specs"

  layer_11:
    type: TASKS
    name: Implementation Tasks
    prerequisite: SPEC
    description: "Code generation task lists - flows to Code layer"
Position Calculation:
yaml
workflow_position:
  completed_layers: [1, 2]  # BRD, PRD done
  in_progress_layers: [3]   # EARS in progress
  blocked_layers: [4, 5, 6, 7, 10, 11]  # Waiting on prerequisites
  ready_layers: [3]         # Can start now
  optional_ready: [8, 9]    # Optional, prereqs met

  current_position:
    layer: 3
    type: EARS
    status: in_progress

  progress_percentage: 18%  # 2 of 11 layers complete
将工件映射到SDD工作流层级:
层级定义
yaml
workflow_layers:
  layer_1:
    type: BRD
    name: Business Requirements
    prerequisite: null
    description: "Business objectives and stakeholder needs"

  layer_2:
    type: PRD
    name: Product Requirements
    prerequisite: BRD
    description: "Product features and user needs"

  layer_3:
    type: EARS
    name: Formal Requirements
    prerequisite: PRD
    description: "WHEN-THE-SHALL formal requirements"

  layer_4:
    type: BDD
    name: Behavior Tests
    prerequisite: EARS
    description: "Gherkin acceptance scenarios"

  layer_5:
    type: ADR
    name: Architecture Decisions
    prerequisite: BDD
    description: "Technical decision records"

  layer_6:
    type: SYS
    name: System Requirements
    prerequisite: ADR
    description: "Technical system specifications"

  layer_7:
    type: REQ
    name: Atomic Requirements
    prerequisite: SYS
    description: "Detailed atomic requirements"

  layer_8:
    type: IMPL
    name: Implementation Plan
    prerequisite: REQ
    optional: true
    description: "WHO/WHEN project management"

  layer_9:
    type: CTR
    name: Interface Contracts
    prerequisite: [IMPL, REQ]
    optional: true
    description: "API contracts and schemas"

  layer_10:
    type: SPEC
    name: Technical Specifications
    prerequisite: REQ
    description: "YAML implementation specs"

  layer_11:
    type: TASKS
    name: Implementation Tasks
    prerequisite: SPEC
    description: "Code generation task lists - flows to Code layer"
位置计算
yaml
workflow_position:
  completed_layers: [1, 2]  # BRD、PRD已完成
  in_progress_layers: [3]   # EARS进行中
  blocked_layers: [4, 5, 6, 7, 10, 11]  # 等待前置依赖
  ready_layers: [3]         # 可立即开始
  optional_ready: [8, 9]    # 可选,前置依赖已满足

  current_position:
    layer: 3
    type: EARS
    status: in_progress

  progress_percentage: 18%  # 11个层级中完成2个

Step 3: Identify Required Next Steps

步骤3:确定必需的下一步操作

Determine mandatory next artifacts:
Dependency Analysis:
yaml
dependency_graph:
  PRD-00:
    completed: true
    downstream_required:
      - EARS (Layer 3) - formal requirements
      - BDD (Layer 4) - test scenarios
    downstream_optional:
      - IMPL (Layer 8) - if complex project

  EARS (to be created):
    upstream_required:
      - PRD-00 ✓ (completed)
    will_enable:
      - BDD (Layer 4)
      - ADR (Layer 5)
Next Steps Priority:
PriorityArtifactRationale
P0EARSRequired downstream from PRD, blocks BDD and ADR
P1BDDCan start once EARS begun, enables ADR
P2ADRRequires BDD completion
确定强制要求的下一个工件:
依赖分析
yaml
dependency_graph:
  PRD-00:
    completed: true
    downstream_required:
      - EARS(第3层)- 正式需求
      - BDD(第4层)- 测试场景
    downstream_optional:
      - IMPL(第8层)- 若为复杂项目

  EARS(待创建):
    upstream_required:
      - PRD-00 ✓(已完成)
    will_enable:
      - BDD(第4层)
      - ADR(第5层)
下一步操作优先级
优先级工件理由
P0EARSPRD的下游必需工件,会阻塞BDD和ADR
P1BDDEARS启动后即可开始,为ADR提供支持
P2ADR需要完成BDD

Step 4: Identify Parallel Opportunities

步骤4:识别并行机会

Find work that can proceed in parallel:
Parallelization Rules:
yaml
parallel_opportunities:
  rule_1:
    name: "EARS and BDD overlap"
    condition: "EARS in progress"
    parallel_work: "BDD scenarios for completed EARS"
    benefit: "Faster progress through testing layer"

  rule_2:
    name: "Multiple feature tracks"
    condition: "Multiple BRDs exist"
    parallel_work: "PRD for each BRD"
    benefit: "Parallel feature development"

  rule_3:
    name: "ADR independence"
    condition: "Technical decisions needed"
    parallel_work: "ADRs can be written in parallel"
    benefit: "Architecture decisions don't block each other"
Parallel Work Output:
yaml
parallel_opportunities:
  can_parallelize:
    - track: "Feature A"
      current: EARS-01
      parallel: "Start BDD-01 scenarios for EARS-01 requirements"

    - track: "Feature B"
      current: PRD-00 complete
      parallel: "Start EARS-02 while Feature A progresses"

  blocked_parallelization:
    - item: "SPEC creation"
      blocker: "REQ layer incomplete"
      unblock_by: "Complete REQ-01 through REQ-05"
找出可并行开展的工作:
并行化规则
yaml
parallel_opportunities:
  rule_1:
    name: "EARS与BDD重叠"
    condition: "EARS进行中"
    parallel_work: "为已完成的EARS编写BDD场景"
    benefit: "加快测试层级的进度"

  rule_2:
    name: "多功能分支"
    condition: "存在多个BRD"
    parallel_work: "为每个BRD创建PRD"
    benefit: "并行功能开发"

  rule_3:
    name: "ADR独立性"
    condition: "需要技术决策"
    parallel_work: "可并行编写ADR"
    benefit: "架构决策互不阻塞"
并行工作输出
yaml
parallel_opportunities:
  can_parallelize:
    - track: "Feature A"
      current: EARS-01
      parallel: "为EARS-01的需求启动BDD-01场景编写"

    - track: "Feature B"
      current: PRD-00已完成
      parallel: "在Feature A推进EARS/BDD的同时,启动EARS-02"

  blocked_parallelization:
    - item: "SPEC创建"
      blocker: "REQ层级未完成"
      unblock_by: "完成REQ-01至REQ-05"

Step 5: Calculate Progress Metrics

步骤5:计算进度指标

Generate progress report:
Progress Metrics:
yaml
progress_report:
  overall:
    layers_complete: 2
    total_layers: 12
    percentage: 17%

  by_layer:
    - layer: 1 (BRD)
      status: complete
      artifacts: 3
      approved: 2

    - layer: 2 (PRD)
      status: complete
      artifacts: 2
      approved: 1

    - layer: 3 (EARS)
      status: in_progress
      artifacts: 0
      target: 3 (based on PRD features)

    - layer: 4 (BDD)
      status: blocked
      blocker: "EARS incomplete"

  estimated_remaining:
    artifacts: 25
    layers: 10

  critical_path:
    - EARS (blocks BDD)
    - BDD (blocks ADR)
    - REQ (blocks SPEC)
    - SPEC (blocks TASKS)
生成进度报告:
进度指标
yaml
progress_report:
  overall:
    layers_complete: 2
    total_layers: 12
    percentage: 17%

  by_layer:
    - layer: 1 (BRD)
      status: complete
      artifacts: 3
      approved: 2

    - layer: 2 (PRD)
      status: complete
      artifacts: 2
      approved: 1

    - layer: 3 (EARS)
      status: in_progress
      artifacts: 0
      target: 3(基于PRD功能)

    - layer: 4 (BDD)
      status: blocked
      blocker: "EARS未完成"

  estimated_remaining:
    artifacts: 25
    layers: 10

  critical_path:
    - EARS(阻塞BDD)
    - BDD(阻塞ADR)
    - REQ(阻塞SPEC)
    - SPEC(阻塞TASKS)

Step 6: Generate Recommendations

步骤6:生成建议

Provide actionable next-step guidance:
Recommendation Format:
yaml
recommendations:
  context:
    completed_artifact: PRD-00
    workflow_position: Layer 2 complete
    progress: 17%

  next_steps:
    - priority: P0
      action: "Create EARS document"
      artifact_type: EARS
      skill: doc-ears
      rationale: "Required downstream from PRD-00. EARS formalizes product features into WHEN-THE-SHALL requirements."
      estimated_effort: "Medium (2-4 hours)"
      blocks: [BDD, ADR]

    - priority: P1
      action: "Start BDD scenarios"
      artifact_type: BDD
      skill: doc-bdd
      rationale: "Can begin once EARS started. Write scenarios for completed requirements."
      estimated_effort: "Medium (2-4 hours)"
      parallel_with: EARS

    - priority: P2
      action: "Consider ADR for key decisions"
      artifact_type: ADR
      skill: doc-adr
      rationale: "If architectural decisions needed, document early. Requires BDD completion."
      estimated_effort: "Low-Medium (1-3 hours)"
      condition: "After BDD progress"

  parallel_opportunities:
    - "Feature B: Start PRD-03 while Feature A progresses through EARS/BDD"
    - "Technical: Draft ADRs for known architecture decisions"

  blocked_items:
    - item: "SPEC creation"
      reason: "Requires REQ completion (Layer 7)"
      unblock_path: "Complete layers 3-7 first"

  workflow_guidance:
    current_focus: "EARS creation for PRD-00 features"
    short_term: "Complete EARS → BDD → ADR sequence"
    medium_term: "Progress through SYS → REQ → SPEC"

  progress_summary:
    completed: "BRD-01, BRD-02, BRD-03, PRD-01, PRD-00"
    in_progress: "None"
    next_milestone: "Complete Layer 3 (EARS)"
    overall: "17% complete (2/12 layers)"
提供可执行的下一步操作指导:
建议格式
yaml
recommendations:
  context:
    completed_artifact: PRD-00
    workflow_position: 第2层已完成
    progress: 17%

  next_steps:
    - priority: P0
      action: "创建EARS文档"
      artifact_type: EARS
      skill: doc-ears
      rationale: "PRD-00的下游必需工件。EARS将产品功能正式化为WHEN-THE-SHALL格式的需求。"
      estimated_effort: "中等(2-4小时)"
      blocks: [BDD, ADR]

    - priority: P1
      action: "启动BDD场景编写"
      artifact_type: BDD
      skill: doc-bdd
      rationale: "EARS启动后即可开始。为已完成的需求编写场景。"
      estimated_effort: "中等(2-4小时)"
      parallel_with: EARS

    - priority: P2
      action: "考虑为关键决策创建ADR"
      artifact_type: ADR
      skill: doc-adr
      rationale: "若需要架构决策,尽早文档化。需完成BDD。"
      estimated_effort: "低-中等(1-3小时)"
      condition: "BDD取得进展后"

  parallel_opportunities:
    - "Feature B:在Feature A推进EARS/BDD的同时,启动PRD-03"
    - "技术层面:为已知的架构决策起草ADR"

  blocked_items:
    - item: "SPEC创建"
      reason: "需要完成REQ(第7层)"
      unblock_path: "先完成第3-7层"

  workflow_guidance:
    current_focus: "为PRD-00的功能创建EARS"
    short_term: "完成EARS → BDD → ADR流程"
    medium_term: "推进SYS → REQ → SPEC"

  progress_summary:
    completed: "BRD-01、BRD-02、BRD-03、PRD-01、PRD-00"
    in_progress: "无"
    next_milestone: "完成第3层(EARS)"
    overall: "完成17%(12个层级中完成2个)"

Example Usage

使用示例

Example 1: Post-PRD Guidance

示例1:PRD完成后的指导

User Request: "I just finished PRD-00, what should I do next?"
Workflow Recommendations:
yaml
completed: PRD-00
position: Layer 2 complete

next_steps:
  1. Create EARS-01 (P0)
     - Formalize PRD-00 features into WHEN-THE-SHALL requirements
     - Run: /skill doc-ears

  2. Start BDD scenarios (P1)
     - Can begin once EARS requirements defined
     - Run: /skill doc-bdd

parallel_opportunity:
  "If other BRDs exist, you can create their PRDs in parallel"

progress: "17% → 25% after EARS completion"
用户请求:"我刚完成PRD-00,接下来该做什么?"
工作流建议
yaml
completed: PRD-00
position: 第2层已完成

next_steps:
  1. 创建EARS-01(P0)
     - 将PRD-00的功能正式化为WHEN-THE-SHALL格式的需求
     - 执行:/skill doc-ears

  2. 启动BDD场景编写(P1)
     - EARS需求定义完成后即可开始
     - 执行:/skill doc-bdd

parallel_opportunity:
  "若存在其他BRD,可并行创建其对应的PRD"

progress: "17% → 完成EARS后达到25%"

Example 2: Project Overview

示例2:项目概览

User Request: "Where am I in the documentation workflow?"
Workflow Status:
yaml
project_status:
  completed_layers:
    - Layer 1 (BRD): 3 documents ✓
    - Layer 2 (PRD): 2 documents ✓

  in_progress:
    - Layer 3 (EARS): 0 documents, target 5

  blocked:
    - Layers 4-11: Waiting on upstream completion

  progress: 18%

  critical_path:
    EARS → BDD → ADR → SYS → REQ → SPEC → TASKS

  recommended_focus:
    "Complete EARS layer to unblock BDD and ADR"
用户请求:"我在文档工作流中处于什么位置?"
工作流状态
yaml
project_status:
  completed_layers:
    - 第1层(BRD):3个文档 ✓
    - 第2层(PRD):2个文档 ✓

  in_progress:
    - 第3层(EARS):0个文档,目标5个

  blocked:
    - 第4-11层:等待上游完成

  progress: 18%

  critical_path:
    EARS → BDD → ADR → SYS → REQ → SPEC → TASKS

  recommended_focus:
    "完成EARS层级以解除BDD和ADR的阻塞"

Example 3: Parallel Work Identification

示例3:并行工作识别

User Request: "What can I work on in parallel?"
Parallel Opportunities:
yaml
current_tracks:
  track_a:
    name: "Core Platform"
    position: EARS creation
    next: BDD scenarios

  track_b:
    name: "Partner Integration"
    position: BRD complete
    next: PRD creation (independent of Track A)

parallel_work:
  - "Track B PRD can proceed while Track A completes EARS"
  - "ADRs for known decisions can be drafted early"
  - "BDD scenarios can start once first EARS requirements defined"

sequential_requirements:
  - "SPEC requires REQ completion - no parallel path"
  - "TASKS requires SPEC - sequential"
用户请求:"我可以并行开展哪些工作?"
并行机会
yaml
current_tracks:
  track_a:
    name: "Core Platform"
    position: EARS创建中
    next: BDD场景编写

  track_b:
    name: "Partner Integration"
    position: BRD已完成
    next: 创建PRD(独立于Track A)

parallel_work:
  - "Track B的PRD可在Track A完成EARS的同时推进"
  - "可为已知决策起草ADR"
  - "首个EARS需求定义完成后即可启动BDD场景编写"

sequential_requirements:
  - "SPEC需要REQ完成 - 无并行路径"
  - "TASKS需要SPEC - 按顺序执行"

Integration with Other Skills

与其他技能的集成

IntegrationDescription
context-analyzerProvides artifact inventory and traceability data
skill-recommenderReceives workflow position for better skill suggestions
doc-flowCan be invoked by doc-flow for workflow orchestration
project-mngtShares planning concepts (MVP, phases)
集成对象描述
context-analyzer提供工件清单和可追溯性数据
skill-recommender接收工作流位置信息以优化技能建议
doc-flow可被doc-flow调用以实现工作流编排
project-mngt共享规划概念(MVP、阶段)

Quality Gates

质量门控

Definition of Done

完成定义

  • Project state analyzed
  • Workflow position calculated
  • Next steps prioritized (P0, P1, P2)
  • Parallel opportunities identified
  • Progress metrics calculated
  • Actionable recommendations generated
  • 已分析项目状态
  • 已计算工作流位置
  • 已对下一步操作进行优先级排序(P0、P1、P2)
  • 已识别并行机会
  • 已计算进度指标
  • 已生成可执行建议

Performance Targets

性能指标

MetricTarget
Analysis latency<1s for 50 artifacts
Recommendation generation<500ms
Progress calculation<200ms
指标目标
分析延迟50个工件时<1秒
建议生成时间<500毫秒
进度计算时间<200毫秒

Traceability

可追溯性

Required Tags:
@prd: PRD.000.004
@adr: ADR-000
必需标签
@prd: PRD.000.004
@adr: ADR-000

Upstream Sources

上游来源

SourceTypeReference
PRD-00Product RequirementsPRD-00
ADR-000Architecture DecisionADR-000
来源类型参考
PRD-00产品需求PRD-00
ADR-000架构决策ADR-000

Downstream Artifacts

下游工件

ArtifactTypeReference
doc-flowSkill ConsumerWorkflow orchestration
project-mngtSkill ConsumerRelease planning integration

工件类型参考
doc-flow技能使用者工作流编排
project-mngt技能使用者发布规划集成

Version Information

版本信息

Version: 1.0.0 Created: 2025-11-29 Status: Active Author: AI Dev Flow Framework Team
版本:1.0.0 创建时间:2025-11-29 状态:活跃 作者:AI Dev Flow框架团队