doc-bdd-autopilot

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

doc-bdd-autopilot

doc-bdd-autopilot

Purpose

用途

Automated BDD (Behavior-Driven Development) generation pipeline that processes EARS documents and generates Gherkin scenarios with readiness validation, scenario categorization, and ADR-Ready score compliance.
Layer: 4 (BDD Generation)
Upstream: BRD (Layer 1), PRD (Layer 2), EARS (Layer 3)
Downstream Artifacts: ADR (Layer 5), SYS (Layer 6), REQ (Layer 7)

自动化**BDD(行为驱动开发)**生成流水线,可处理EARS文档并生成带有就绪验证、场景分类和ADR就绪评分合规性的Gherkin场景。
层级: 4 (BDD生成)
上游: BRD (层级1), PRD (层级2), EARS (层级3)
下游产物: ADR (层级5), SYS (层级6), REQ (层级7)

Skill Dependencies

技能依赖

This autopilot orchestrates the following skills:
SkillPurposePhase
doc-naming
Element ID format (BDD.NN.14.SS, BDD.NN.15.SS), scenario/step codesAll Phases
doc-ears-validator
Validate EARS BDD-Ready scorePhase 2: EARS Readiness
doc-bdd
BDD creation rules, Gherkin syntax, section-based structurePhase 3: BDD Generation
quality-advisor
Real-time quality feedback during BDD generationPhase 3: BDD Generation
doc-bdd-validator
Validate BDD structure, content, ADR-Ready scorePhase 4: BDD Validation
doc-bdd-reviewer
Content review, link validation, quality scoringPhase 5: Review
doc-bdd-fixer
Apply fixes from review report, create missing filesPhase 5: Fix
Delegation Principle: The autopilot orchestrates workflow but delegates:
  • BDD structure/content rules ->
    doc-bdd
    skill
  • Real-time quality feedback ->
    quality-advisor
    skill
  • BDD validation logic ->
    doc-bdd-validator
    skill
  • Content review and scoring ->
    doc-bdd-reviewer
    skill
  • Issue resolution and fixes ->
    doc-bdd-fixer
    skill
  • EARS validation logic ->
    doc-ears-validator
    skill
  • Element ID standards ->
    doc-naming
    skill

该自动生成器编排以下技能:
技能用途阶段
doc-naming
元素ID格式(BDD.NN.14.SS, BDD.NN.15.SS)、场景/步骤编码所有阶段
doc-ears-validator
验证EARS的BDD就绪评分阶段2:EARS就绪检查
doc-bdd
BDD创建规则、Gherkin语法、基于章节的结构阶段3:BDD生成
quality-advisor
BDD生成过程中的实时质量反馈阶段3:BDD生成
doc-bdd-validator
验证BDD结构、内容、ADR就绪评分阶段4:BDD验证
doc-bdd-reviewer
内容审核、链接验证、质量评分阶段5:审核
doc-bdd-fixer
应用审核报告中的修复建议、创建缺失文件阶段5:修复
委托原则: 自动生成器编排工作流,但将以下任务委托给对应技能:
  • BDD结构/内容规则 →
    doc-bdd
    技能
  • 实时质量反馈 →
    quality-advisor
    技能
  • BDD验证逻辑 →
    doc-bdd-validator
    技能
  • 内容审核与评分 →
    doc-bdd-reviewer
    技能
  • 问题解决与修复 →
    doc-bdd-fixer
    技能
  • EARS验证逻辑 →
    doc-ears-validator
    技能
  • 元素ID标准 →
    doc-naming
    技能

Smart Document Detection

智能文档检测

The autopilot automatically determines the action based on the input document type.
自动生成器会根据输入文档类型自动确定操作。

Input Type Recognition

输入类型识别

InputDetected AsAction
BDD-NN
Self typeReview existing BDD document
EARS-NN
Upstream typeGenerate if missing, review if exists
输入识别类型操作
BDD-NN
自身类型审核现有BDD文档
EARS-NN
上游类型缺失则生成,存在则审核

Detection Algorithm

检测算法

1. Parse input: Extract TYPE and NN from "{TYPE}-{NN}"
2. Determine action:
   - IF TYPE == "BDD": Review Mode
   - ELSE IF TYPE == "EARS": Generate/Find Mode
   - ELSE: Error (invalid type for this autopilot)
3. For Generate/Find Mode:
   - Check: Does BDD-{NN} exist in docs/04_BDD/?
   - IF exists: Switch to Review Mode for BDD-{NN}
   - ELSE: Proceed with Generation from EARS-{NN}
1. 解析输入:从"{TYPE}-{NN}"中提取TYPE和NN
2. 确定操作:
   - 若TYPE == "BDD":审核模式
   - 若TYPE == "EARS":生成/查找模式
   - 其他:错误(该自动生成器不支持的类型)
3. 对于生成/查找模式:
   - 检查:docs/04_BDD/中是否存在BDD-{NN}?
   - 若存在:切换为BDD-{NN}的审核模式
   - 若不存在:从EARS-{NN}开始生成

File Existence Check

文件存在性检查

bash
undefined
bash
undefined

Check for nested folder structure (mandatory)

检查嵌套文件夹结构(必填)

ls docs/04_BDD/BDD-{NN}_*/
undefined
ls docs/04_BDD/BDD-{NN}_*/
undefined

Examples

示例

bash
undefined
bash
undefined

Review mode (same type - BDD input)

审核模式(同类型输入 - BDD输入)

/doc-bdd-autopilot BDD-01 # Reviews existing BDD-01
/doc-bdd-autopilot BDD-01 # 审核现有BDD-01

Generate/Find mode (upstream type - EARS input)

生成/查找模式(上游类型输入 - EARS输入)

/doc-bdd-autopilot EARS-01 # Generates BDD-01 if missing, or reviews existing BDD-01
/doc-bdd-autopilot EARS-01 # 若BDD-01缺失则生成,否则审核现有BDD-01

Multiple inputs

多输入

/doc-bdd-autopilot EARS-01,EARS-02 # Generates/reviews BDD-01 and BDD-02 /doc-bdd-autopilot BDD-01,BDD-02 # Reviews BDD-01 and BDD-02
undefined
/doc-bdd-autopilot EARS-01,EARS-02 # 生成/审核BDD-01和BDD-02 /doc-bdd-autopilot BDD-01,BDD-02 # 审核BDD-01和BDD-02
undefined

Action Determination Output

操作判定输出

Input: EARS-01
├── Detected Type: EARS (upstream)
├── Expected BDD: BDD-01
├── BDD Exists: Yes → docs/04_BDD/BDD-01_f1_iam/
└── Action: REVIEW MODE - Running doc-bdd-reviewer on BDD-01

Input: EARS-05
├── Detected Type: EARS (upstream)
├── Expected BDD: BDD-05
├── BDD Exists: No
└── Action: GENERATE MODE - Creating BDD-05 from EARS-05

Input: BDD-03
├── Detected Type: BDD (self)
└── Action: REVIEW MODE - Running doc-bdd-reviewer on BDD-03

输入: EARS-01
├── 检测类型: EARS(上游)
├── 预期BDD: BDD-01
├── BDD是否存在: 是 → docs/04_BDD/BDD-01_f1_iam/
└── 操作: 审核模式 - 对BDD-01运行doc-bdd-reviewer

输入: EARS-05
├── 检测类型: EARS(上游)
├── 预期BDD: BDD-05
├── BDD是否存在: 否
└── 操作: 生成模式 - 从EARS-05创建BDD-05

输入: BDD-03
├── 检测类型: BDD(自身)
└── 操作: 审核模式 - 对BDD-03运行doc-bdd-reviewer

When to Use This Skill

何时使用该技能

Use
doc-bdd-autopilot
when
:
  • You have one or more completed EARS documents ready for BDD generation
  • You want automated scenario categorization (Success, Error, Edge, Data-Driven)
  • You need BDD-Ready score validation before generation
  • You want automatic ADR-Ready score validation after BDD creation
  • You need to generate Gherkin Given-When-Then scenarios from EARS statements
Do NOT use when:
  • Creating a single BDD suite with extensive manual customization (use
    doc-bdd
    directly)
  • EARS documents are incomplete or in Draft status
  • You need fine-grained control over each scenario
  • EARS BDD-Ready score is below 90%

当以下情况时使用
doc-bdd-autopilot
:
  • 您有一个或多个已完成的EARS文档,准备生成BDD场景
  • 您需要自动进行场景分类(成功路径、错误路径、边缘情况、数据驱动)
  • 生成前需要验证BDD就绪评分
  • BDD创建后需要自动验证ADR就绪评分
  • 需要从EARS语句生成Gherkin Given-When-Then场景
请勿在以下情况使用:
  • 创建需要大量手动定制的单个BDD套件(直接使用
    doc-bdd
  • EARS文档不完整或处于草稿状态
  • 需要对每个场景进行细粒度控制
  • EARS的BDD就绪评分低于90%

Workflow Overview

工作流概述

mermaid
flowchart TD
    subgraph Phase1["Phase 1: EARS Analysis"]
        A[Input: EARS List] --> B[Read EARS Documents]
        B --> C[Extract EARS Statements]
        C --> D[Categorize by Statement Type]
        D --> E[Identify Quality Attributes]
        E --> F[Extract Threshold References]
    end

    subgraph Phase2["Phase 2: BDD Readiness Check"]
        F --> G{Next EARS}
        G --> H[Check BDD-Ready Score]
        H --> I{Score >= 90?}
        I -->|No| J[Auto-Fix EARS Issues]
        J --> K[Re-validate EARS]
        K --> I
        I -->|Yes| L[Mark EARS Ready]
    end

    subgraph Phase3["Phase 3: BDD Generation"]
        L --> M[Plan Section Structure]
        M --> N[Generate Feature Files]
        N --> O[Generate Success Path Scenarios]
        O --> P[Generate Error Condition Scenarios]
        P --> Q[Generate Edge Case Scenarios]
        Q --> R[Generate Data-Driven Scenarios]
        R --> S[quality-advisor: Real-time Feedback]
        S --> T[Add Quality Attribute Scenarios]
        T --> U[Add Cumulative Tags]
        U --> V[Write BDD Files]
    end

    subgraph Phase4["Phase 4: BDD Validation"]
        V --> W[Run doc-bdd-validator]
        W --> X{ADR-Ready >= 90?}
        X -->|No| Y[Auto-Fix BDD Issues]
        Y --> Z[Re-validate BDD]
        Z --> X
        X -->|Yes| AA[Validation Passed]
    end

    subgraph Phase5["Phase 5: Final Review"]
        AA --> AB[Check Gherkin Syntax Compliance]
        AB --> AC[Verify Threshold References]
        AC --> AD[Validate Cumulative Tags]
        AD --> AE[Check Scenario Coverage]
        AE --> AF{Review Passed?}
        AF -->|No| AG[Flag Issues]
        AG --> AH[Auto-Fix or Manual]
        AH --> AF
        AF -->|Yes| AI[Mark BDD Complete]
    end

    AI --> AJ{More EARS?}
    AJ -->|Yes| G
    AJ -->|No| AK[Generate Summary Report]
    AK --> AL[Complete]

mermaid
flowchart TD
    subgraph Phase1["阶段1: EARS分析"]
        A[输入: EARS列表] --> B[读取EARS文档]
        B --> C[提取EARS语句]
        C --> D[按语句类型分类]
        D --> E[识别质量属性]
        E --> F[提取阈值引用]
    end

    subgraph Phase2["阶段2: BDD就绪检查"]
        F --> G{下一个EARS}
        G --> H[检查BDD就绪评分]
        H --> I{评分 >= 90?}
        I -->|否| J[自动修复EARS问题]
        J --> K[重新验证EARS]
        K --> I
        I -->|是| L[标记EARS就绪]
    end

    subgraph Phase3["阶段3: BDD生成"]
        L --> M[规划章节结构]
        M --> N[生成Feature文件]
        N --> O[生成成功路径场景]
        O --> P[生成错误条件场景]
        P --> Q[生成边缘情况场景]
        Q --> R[生成数据驱动场景]
        R --> S[quality-advisor: 实时反馈]
        S --> T[添加质量属性场景]
        T --> U[添加累积标签]
        U --> V[写入BDD文件]
    end

    subgraph Phase4["阶段4: BDD验证"]
        V --> W[运行doc-bdd-validator]
        W --> X{ADR就绪评分 >= 90?}
        X -->|否| Y[自动修复BDD问题]
        Y --> Z[重新验证BDD]
        Z --> X
        X -->|是| AA[验证通过]
    end

    subgraph Phase5["阶段5: 最终审核"]
        AA --> AB[检查Gherkin语法合规性]
        AB --> AC[验证阈值引用]
        AC --> AD[验证累积标签]
        AD --> AE[检查场景覆盖率]
        AE --> AF{审核通过?}
        AF -->|否| AG[标记问题]
        AG --> AH[自动修复或手动处理]
        AH --> AF
        AF -->|是| AI[标记BDD完成]
    end

    AI --> AJ{还有更多EARS?}
    AJ -->|是| G
    AJ -->|否| AK[生成汇总报告]
    AK --> AL[完成]

Detailed Workflow

详细工作流

Phase 1: EARS Analysis

阶段1: EARS分析

Analyze EARS documents to extract requirements for BDD scenario generation.
Input Sources (from EARS):
EARS SectionBDD ContentMapping
Event-Driven Statements (001-099)User action scenariosSuccess/Error scenarios
State-Driven Statements (101-199)System state scenariosState validation scenarios
Unwanted Behavior Statements (201-299)Error handling scenariosNegative/Recovery scenarios
Ubiquitous Statements (401-499)Cross-cutting scenariosQuality attribute scenarios
Quality Attributes SectionPerformance/Security testsQuality attribute scenarios
Threshold ReferencesParameterized values@threshold tags in steps
Analysis Process:
bash
undefined
分析EARS文档,提取用于BDD场景生成的需求。
输入来源(来自EARS):
EARS章节BDD内容映射关系
事件驱动语句(001-099)用户操作场景成功/错误场景
状态驱动语句(101-199)系统状态场景状态验证场景
异常行为语句(201-299)错误处理场景负面/恢复场景
通用语句(401-499)跨领域场景质量属性场景
质量属性章节性能/安全测试质量属性场景
阈值引用参数化值步骤中的@threshold标签
分析流程:
bash
undefined

Check for EARS documents

检查EARS文档

ls -la docs/03_EARS/
ls -la docs/03_EARS/

Expected structure:

预期结构:

- EARS-NN_{slug}.md (monolithic)

- EARS-NN_{slug}.md(单体文档)

- EARS-NN_{slug}/ (sectioned with EARS-NN.S_{section}.md files)

- EARS-NN_{slug}/(分章节,包含EARS-NN.S_{section}.md文件)


**Output**: Scenario catalog with categorization hints, threshold references, and traceability links.

**输出**: 带有分类提示、阈值引用和可追溯性链接的场景目录。

Phase 2: BDD Readiness Check

阶段2: BDD就绪检查

Validate that source EARS meet BDD-Ready requirements before generation.
Skill Delegation: This phase uses validation rules from
doc-ears-validator
skill. See:
.claude/skills/doc-ears-validator/SKILL.md
for complete EARS validation rules.
BDD-Ready Scoring Criteria (100%):
CategoryWeightCriteria
Requirements Clarity40%EARS syntax compliance, statement atomicity, quantifiable constraints
Testability35%BDD translation readiness, observable verification, edge cases specified
Quality Attributes15%Performance targets, security requirements, reliability targets
Strategic Alignment10%Business objective links, implementation paths
Minimum Score: 90% (configurable)
Auto-Fix Actions:
IssueAuto-Fix Action
Missing WHEN-THE-SHALL syntaxReformat statement
Non-atomic statementsSplit into multiple statements
Missing quantifiable constraintsAdd placeholder constraints
Missing edge case specificationsFlag for manual review
Incomplete quality attributesAdd template quality attributes
Validation Command (internal):
bash
python ai_dev_flow/scripts/validate_bdd_ready.py \
  --ears docs/03_EARS/EARS-01_{slug}/ \
  --min-score 90 \
  --auto-fix
在生成前验证源EARS是否满足BDD就绪要求。
技能委托: 该阶段使用
doc-ears-validator
技能中的验证规则。 参考:
.claude/skills/doc-ears-validator/SKILL.md
获取完整的EARS验证规则。
BDD就绪评分标准(100%):
类别权重标准
需求清晰度40%EARS语法合规性、语句原子性、可量化约束
可测试性35%BDD转换就绪性、可观察的验证、指定的边缘情况
质量属性15%性能目标、安全需求、可靠性目标
战略对齐10%业务目标关联、实现路径
最低评分: 90%(可配置)
自动修复操作:
问题自动修复操作
缺失WHEN-THE-SHALL语法重新格式化语句
非原子语句拆分为多个语句
缺失可量化约束添加占位符约束
缺失边缘情况说明标记为需要手动审核
不完整的质量属性添加模板化质量属性
验证命令(内部):
bash
python ai_dev_flow/scripts/validate_bdd_ready.py \
  --ears docs/03_EARS/EARS-01_{slug}/ \
  --min-score 90 \
  --auto-fix

Phase 3: BDD Generation

阶段3: BDD生成

Generate BDD scenarios from validated EARS with real-time quality feedback.
Skill Delegation: This phase follows rules defined in
doc-bdd
skill. See:
.claude/skills/doc-bdd/SKILL.md
for complete BDD creation guidance.
Quality Guidance: Uses
quality-advisor
skill for real-time feedback during generation. See:
.claude/skills/quality-advisor/SKILL.md
for quality monitoring.
Generation Process:
  1. Reserve BDD ID:
    bash
    # Check for next available ID
    ls docs/04_BDD/BDD-*.feature docs/04_BDD/BDD-*/BDD-*.0_*.md 2>/dev/null | \
      grep -oP 'BDD-\K\d+' | sort -n | tail -1
    # Increment for new BDD
  2. Create Suite Directory:
    bash
    mkdir -p docs/04_BDD/BDD-NN_{slug}/
  3. Plan Section Structure:
    Section Planning Based on EARS Scope:
    EARS Statement CountBDD StructureRationale
    1-10 statements2-3 sectionsCompact coverage
    11-30 statements4-8 sectionsStandard grouping
    31+ statements9+ sections with subsectionsComplex domain
  4. Generate Index File (
    BDD-NN.0_index.md
    ):
    FieldValue
    BDD IDBDD-NN
    Version0.1.0
    Date CreatedCurrent date (YYYY-MM-DD)
    Last UpdatedCurrent date (YYYY-MM-DD)
    StatusDraft
    PriorityFrom EARS priority
    Source Document@ears: EARS.NN.25.SS (single value)
    ADR-Ready ScoreCalculated after generation
  5. Generate Feature Files by Section:
    Section File Pattern:
    BDD-NN.S_{section_name}.feature
    Subsection Pattern (if >500 lines):
    BDD-NN.S.SS_{subsection_name}.feature
  6. Generate Scenarios by Category:
    Success Path Scenarios (@primary):
    gherkin
    @section: NN.SS
    @parent_doc: BDD-NN
    @index: BDD-NN.0_index.md
    @brd:BRD.NN.01.SS
    @prd:PRD.NN.07.SS
    @ears:EARS.NN.25.SS
    
    Feature: BDD-NN.SS: [Feature Name]
      As a [role]
      I want [feature]
      So that [benefit]
    
      Background:
        Given the system timezone is "America/New_York"
        And the current time is "09:30:00" in "America/New_York"
    
      @primary @functional @scenario-id:BDD.NN.14.01
      Scenario: Successful [action description]
        Given [precondition from EARS WHEN clause]
        When [action from EARS trigger]
        Then [outcome from EARS SHALL clause]
        And response time is less than @threshold:PRD.NN.perf.api.p95_latency
    Error Condition Scenarios (@negative):
    gherkin
    @negative @error_handling @scenario-id:BDD.NN.14.10
    Scenario: [Error condition] results in [expected behavior]
      Given [error precondition from EARS IF clause]
      When [action that triggers error]
      Then [error handling from EARS prevention/recovery]
      And error code "[ERROR_CODE]" is returned
    Edge Case Scenarios (@edge_case, @boundary):
    gherkin
    @edge_case @boundary @scenario-id:BDD.NN.14.20
    Scenario: [Boundary condition] at [limit value]
      Given [boundary precondition]
      When [action at boundary]
      Then [expected boundary behavior]
    Data-Driven Scenarios (@data_driven):
    gherkin
    @data_driven @scenario-id:BDD.NN.14.30
    Scenario Outline: [Parameterized test description]
      Given [context with <variable>]
      When [action with <variable>]
      Then [outcome with <variable>]
      Examples:
        | variable | expected |
        | value1   | result1  |
        | value2   | result2  |
    Quality Attribute Scenarios (@quality_attribute):
    gherkin
    @quality_attribute @performance @scenario-id:BDD.NN.14.40
    Scenario: API response meets performance threshold
      Given system is under normal load
      When user submits request
      Then response time is less than @threshold:PRD.NN.perf.api.p95_latency
      And throughput exceeds @threshold:PRD.NN.perf.api.min_throughput
    Integration Scenarios (@integration):
    gherkin
    @integration @external_system @scenario-id:BDD.NN.14.50
    Scenario: External system integration succeeds
      Given external service is available
      When system initiates integration call
      Then integration completes within @threshold:PRD.NN.timeout.integration.max
    Failure Recovery Scenarios (@failure_recovery):
    gherkin
    @failure_recovery @circuit_breaker @scenario-id:BDD.NN.14.60
    Scenario: System recovers from transient failure
      Given external service experiences transient failure
      When retry mechanism activates
      Then system recovers within @threshold:PRD.NN.retry.max_attempts attempts
      And circuit breaker state is updated
  7. Real-Time Quality Feedback (via
    quality-advisor
    skill):
    • Monitor Gherkin syntax compliance as scenarios are generated
    • Detect anti-patterns (missing Given/When/Then, hardcoded values)
    • Validate @threshold tag format and references
    • Check element ID format compliance (BDD.NN.14.SS, BDD.NN.15.SS)
    • Flag issues early to reduce post-generation rework
  8. Add Cumulative Traceability Tags:
    Required Tags per Feature (Gherkin-native, NOT in comments):
    gherkin
    @brd:BRD.NN.01.SS
    @prd:PRD.NN.07.SS
    @ears:EARS.NN.25.SS
    Feature: BDD-NN.SS: Feature Name
    Layer 4 Cumulative Tag Requirement: @brd, @prd, @ears (3+ tags)
  9. Generate Redirect Stub:
    bash
    # Create redirect stub at docs/04_BDD/ root
    touch docs/04_BDD/BDD-NN_{slug}.feature
    Redirect Stub Content:
    gherkin
    @redirect
    @section: NN.00
    @parent_doc: BDD-NN
    @index: BDD-NN.0_index.md
    
    Feature: BDD-NN: [Suite Name] (Redirect)
    
      This is a redirect stub. Test scenarios are in section files:
      - BDD-NN.1_{section1}.feature - [Description]
      - BDD-NN.2_{section2}.feature - [Description]
    
    Background:
      Given the system timezone is "America/New_York"
      # No scenarios in redirect stub
  10. Update Index File:
    • List all section files with scenario counts and line counts
    • Add traceability matrix linking EARS to BDD sections
    • Calculate and display ADR-Ready Score
从已验证的EARS生成BDD场景,并提供实时质量反馈。
技能委托: 该阶段遵循
doc-bdd
技能中定义的规则。 参考:
.claude/skills/doc-bdd/SKILL.md
获取完整的BDD创建指南。
质量指导: 使用
quality-advisor
技能在生成过程中提供实时反馈。 参考:
.claude/skills/quality-advisor/SKILL.md
获取质量监控相关内容。
生成流程:
  1. 预留BDD ID:
    bash
    # 检查下一个可用ID
    ls docs/04_BDD/BDD-*.feature docs/04_BDD/BDD-*/BDD-*.0_*.md 2>/dev/null | \
      grep -oP 'BDD-\K\d+' | sort -n | tail -1
    # 为新BDD递增ID
  2. 创建套件目录:
    bash
    mkdir -p docs/04_BDD/BDD-NN_{slug}/
  3. 规划章节结构:
    基于EARS范围的章节规划:
    EARS语句数量BDD结构理由
    1-10条语句2-3个章节紧凑覆盖
    11-30条语句4-8个章节标准分组
    31+条语句9+个章节(含子章节)复杂领域
  4. 生成索引文件 (
    BDD-NN.0_index.md
    ):
    字段
    BDD IDBDD-NN
    版本0.1.0
    创建日期当前日期(YYYY-MM-DD)
    最后更新日期当前日期(YYYY-MM-DD)
    状态草稿
    优先级来自EARS优先级
    源文档@ears: EARS.NN.25.SS(单个值)
    ADR就绪评分生成后计算
  5. 按章节生成Feature文件:
    章节文件格式:
    BDD-NN.S_{section_name}.feature
    子章节格式(若超过500行):
    BDD-NN.S.SS_{subsection_name}.feature
  6. 按类别生成场景:
    成功路径场景 (@primary):
    gherkin
    @section: NN.SS
    @parent_doc: BDD-NN
    @index: BDD-NN.0_index.md
    @brd:BRD.NN.01.SS
    @prd:PRD.NN.07.SS
    @ears:EARS.NN.25.SS
    
    Feature: BDD-NN.SS: [功能名称]
      As a [角色]
      I want [功能]
      So that [收益]
    
      Background:
        Given the system timezone is "America/New_York"
        And the current time is "09:30:00" in "America/New_York"
    
      @primary @functional @scenario-id:BDD.NN.14.01
      Scenario: Successful [操作描述]
        Given [来自EARS WHEN子句的前置条件]
        When [来自EARS触发事件的操作]
        Then [来自EARS SHALL子句的结果]
        And response time is less than @threshold:PRD.NN.perf.api.p95_latency
    错误条件场景 (@negative):
    gherkin
    @negative @error_handling @scenario-id:BDD.NN.14.10
    Scenario: [错误条件] results in [预期行为]
      Given [来自EARS IF子句的错误前置条件]
      When [触发错误的操作]
      Then [来自EARS预防/恢复策略的错误处理]
      And error code "[ERROR_CODE]" is returned
    边缘情况场景 (@edge_case, @boundary):
    gherkin
    @edge_case @boundary @scenario-id:BDD.NN.14.20
    Scenario: [边界条件] at [极限值]
      Given [边界前置条件]
      When [边界处的操作]
      Then [预期的边界行为]
    数据驱动场景 (@data_driven):
    gherkin
    @data_driven @scenario-id:BDD.NN.14.30
    Scenario Outline: [参数化测试描述]
      Given [包含<variable>的上下文]
      When [包含<variable>的操作]
      Then [包含<variable>的结果]
      Examples:
        | variable | expected |
        | value1   | result1  |
        | value2   | result2  |
    质量属性场景 (@quality_attribute):
    gherkin
    @quality_attribute @performance @scenario-id:BDD.NN.14.40
    Scenario: API response meets performance threshold
      Given system is under normal load
      When user submits request
      Then response time is less than @threshold:PRD.NN.perf.api.p95_latency
      And throughput exceeds @threshold:PRD.NN.perf.api.min_throughput
    集成场景 (@integration):
    gherkin
    @integration @external_system @scenario-id:BDD.NN.14.50
    Scenario: External system integration succeeds
      Given external service is available
      When system initiates integration call
      Then integration completes within @threshold:PRD.NN.timeout.integration.max
    故障恢复场景 (@failure_recovery):
    gherkin
    @failure_recovery @circuit_breaker @scenario-id:BDD.NN.14.60
    Scenario: System recovers from transient failure
      Given external service experiences transient failure
      When retry mechanism activates
      Then system recovers within @threshold:PRD.NN.retry.max_attempts attempts
      And circuit breaker state is updated
  7. 实时质量反馈(通过
    quality-advisor
    技能):
    • 在场景生成过程中监控Gherkin语法合规性
    • 检测反模式(缺失Given/When/Then、硬编码值)
    • 验证@threshold标签格式和引用
    • 检查元素ID格式合规性(BDD.NN.14.SS, BDD.NN.15.SS)
    • 提前标记问题以减少生成后的返工
  8. 添加累积可追溯性标签:
    每个Feature必填的标签(Gherkin原生标签,不可在注释中):
    gherkin
    @brd:BRD.NN.01.SS
    @prd:PRD.NN.07.SS
    @ears:EARS.NN.25.SS
    Feature: BDD-NN.SS: Feature Name
    层级4累积标签要求: @brd, @prd, @ears(至少3个标签)
  9. 生成重定向存根:
    bash
    # 在docs/04_BDD/根目录创建重定向存根
    touch docs/04_BDD/BDD-NN_{slug}.feature
    重定向存根内容:
    gherkin
    @redirect
    @section: NN.00
    @parent_doc: BDD-NN
    @index: BDD-NN.0_index.md
    
    Feature: BDD-NN: [套件名称] (Redirect)
    
      This is a redirect stub. Test scenarios are in section files:
      - BDD-NN.1_{section1}.feature - [描述]
      - BDD-NN.2_{section2}.feature - [描述]
    
    Background:
      Given the system timezone is "America/New_York"
      # No scenarios in redirect stub
  10. 更新索引文件:
    • 列出所有章节文件及其场景数量和行数
    • 添加将EARS链接到BDD章节的可追溯性矩阵
    • 计算并显示ADR就绪评分

Phase 4: BDD Validation

阶段4: BDD验证

After BDD generation, validate structure and ADR-Ready score.
Skill Delegation: This phase uses validation rules from
doc-bdd-validator
skill. See:
.claude/skills/doc-bdd-validator/SKILL.md
for complete validation rules.
Validation Command:
bash
python ai_dev_flow/scripts/validate_bdd.py docs/04_BDD/BDD-NN_{slug}/ --verbose
Validation Checks:
CheckRequirementError Code
Section StructureIndex file exists, valid patternsCHECK 9.1-9.7
Document ControlAll required fields in indexBDD-E001 to BDD-E009
Gherkin SyntaxValid Given-When-Then structureBDD-E010, BDD-E011
Element ID FormatBDD.NN.14.SS (scenarios), BDD.NN.15.SS (steps)BDD-E008
Tags PlacementGherkin-native, not in commentsBDD-E041
Cumulative Tags@brd, @prd, @ears presentBDD-W002
ADR-Ready Score>= 90%BDD-W003
File Size< 500 lines per .feature fileCHECK 9.4
Scenario Count<= 12 per Feature blockCHECK 9.4
Scenario Type Tag@scenario-type present on each scenarioBDD-E050
Priority Tag@p0/@p1/@p2/@p3 present on each scenarioBDD-E051
Timing Constraint FormatWITHIN @threshold format for timed opsBDD-E052
5-Category Coveragesuccess, optional, recovery, parameterized, errorBDD-E053
Threshold Format@threshold:PRD.NN.category.field syntaxBDD-E054
WITHIN ConstraintRequired for performance scenariosBDD-E055
Auto-Fix Actions:
IssueAuto-Fix Action
Missing Given-When-ThenAdd template step structure
Invalid element ID formatConvert to BDD.NN.14.SS format
Tags in commentsMove to Gherkin-native position
Missing @threshold tagsAdd placeholder tags
Hardcoded numeric valuesReplace with @threshold references
Missing ADR-Ready ScoreCalculate and insert
Validation Loop:
LOOP (max 3 iterations):
  1. Run doc-bdd-validator
  2. IF errors found: Apply auto-fixes
  3. IF warnings found: Review and address if critical
  4. IF ADR-Ready Score < 90%: Enhance scenarios
  5. IF clean: Mark VALIDATED, proceed
  6. IF max iterations: Log issues, flag for manual review
BDD生成后,验证结构和ADR就绪评分。
技能委托: 该阶段使用
doc-bdd-validator
技能中的验证规则。 参考:
.claude/skills/doc-bdd-validator/SKILL.md
获取完整的验证规则。
验证命令:
bash
python ai_dev_flow/scripts/validate_bdd.py docs/04_BDD/BDD-NN_{slug}/ --verbose
验证检查项:
检查项要求错误代码
章节结构存在索引文件、格式有效CHECK 9.1-9.7
文档控制索引中包含所有必填字段BDD-E001至BDD-E009
Gherkin语法有效的Given-When-Then结构BDD-E010, BDD-E011
元素ID格式BDD.NN.14.SS(场景)、BDD.NN.15.SS(步骤)BDD-E008
标签位置Gherkin原生标签,不可在注释中BDD-E041
累积标签存在@brd、@prd、@earsBDD-W002
ADR就绪评分>= 90%BDD-W003
文件大小每个.feature文件不超过500行CHECK 9.4
场景数量每个Feature块不超过12个场景CHECK 9.4
场景类型标签每个场景都有@scenario-type标签BDD-E050
优先级标签每个场景都有@p0/@p1/@p2/@p3标签BDD-E051
时间约束格式定时操作使用WITHIN @threshold格式BDD-E052
5类别覆盖成功、可选、恢复、参数化、错误BDD-E053
阈值格式@threshold:PRD.NN.category.field语法BDD-E054
WITHIN约束性能场景必填BDD-E055
自动修复操作:
问题自动修复操作
缺失Given-When-Then添加模板化步骤结构
无效元素ID格式转换为BDD.NN.14.SS格式
标签在注释中移动到Gherkin原生位置
缺失@threshold标签添加占位符标签
硬编码数值替换为@threshold引用
缺失ADR就绪评分计算并插入
验证循环:
循环(最多3次迭代):
  1. 运行doc-bdd-validator
  2. 若发现错误:应用自动修复
  3. 若发现警告:审核并处理关键警告
  4. 若ADR就绪评分 < 90%:增强场景
  5. 若验证通过:标记为已验证,继续
  6. 若达到最大迭代次数:记录问题,标记为需要手动审核

Phase 5: Review & Fix Cycle (v2.1)

阶段5: 审核与修复循环(v2.1)

Iterative review and fix cycle to ensure BDD quality before completion.
mermaid
flowchart TD
    A[Phase 5 Start] --> B[Run doc-bdd-reviewer]
    B --> C[Generate Review Report]
    C --> D{Review Score >= 90?}

    D -->|Yes| E[PASS - Proceed to Phase 6]
    D -->|No| F{Iteration < Max?}

    F -->|Yes| G[Run doc-bdd-fixer]
    G --> H[Apply Fixes]
    H --> I[Generate Fix Report]
    I --> J[Increment Iteration]
    J --> B

    F -->|No| K[Flag for Manual Review]
    K --> L[Generate Final Report with Remaining Issues]
    L --> E
迭代式审核与修复循环,确保BDD在完成前的质量。
mermaid
flowchart TD
    A[阶段5开始] --> B[运行doc-bdd-reviewer]
    B --> C[生成审核报告]
    C --> D{审核评分 >= 90?}

    D -->|是| E[通过 - 进入阶段6]
    D -->|否| F{迭代次数 < 最大值?}

    F -->|是| G[运行doc-bdd-fixer]
    G --> H[应用修复]
    H --> I[生成修复报告]
    I --> J[递增迭代次数]
    J --> B

    F -->|否| K[标记为需要手动审核]
    K --> L[生成包含剩余问题的最终报告]
    L --> E

5.1 Initial Review

5.1 初始审核

Run
doc-bdd-reviewer
to identify issues.
bash
/doc-bdd-reviewer BDD-NN
Output:
BDD-NN.R_review_report_v001.md
Review Checks:
  1. Gherkin Syntax Compliance:
    • All scenarios use Given-When-Then structure
    • No vague language ("fast", "efficient", "user-friendly")
    • All steps are atomic and actionable
    • Background steps are appropriate
  2. Threshold Reference Consistency:
    • All @threshold tags reference valid PRD thresholds
    • Threshold values match PRD source
    • No orphan threshold references
    • No hardcoded numeric values in steps
  3. Cumulative Tag Validation:
    • @brd tags reference valid BRD elements
    • @prd tags reference valid PRD elements
    • @ears tags reference valid EARS elements
    • Tags are Gherkin-native (not in comments)
  4. Scenario Coverage:
    • All 8 scenario categories represented
    • Success path scenarios for each EARS event-driven statement
    • Error scenarios for each EARS unwanted behavior statement
    • Edge cases for boundary conditions
    • Data-driven scenarios for parameterized tests
运行
doc-bdd-reviewer
识别问题。
bash
/doc-bdd-reviewer BDD-NN
输出:
BDD-NN.R_review_report_v001.md
审核检查项:
  1. Gherkin语法合规性:
    • 所有场景使用Given-When-Then结构
    • 无模糊语言(如"快速"、"高效"、"用户友好")
    • 所有步骤都是原子且可执行的
    • 背景步骤设置合理
  2. 阈值引用一致性:
    • 所有@threshold标签引用有效的PRD阈值
    • 阈值值与PRD源一致
    • 无孤立的阈值引用
    • 步骤中无硬编码数值
  3. 累积标签验证:
    • @brd标签引用有效的BRD元素
    • @prd标签引用有效的PRD元素
    • @ears标签引用有效的EARS元素
    • 标签为Gherkin原生标签(不可在注释中)
  4. 场景覆盖率:
    • 涵盖所有8种场景类别
    • 每个EARS事件驱动语句都有成功路径场景
    • 每个EARS异常行为语句都有错误场景
    • 边界条件有边缘情况场景
    • 参数化需求有数据驱动场景

5.2 Fix Cycle

5.2 修复循环

If review score < 90%, invoke
doc-bdd-fixer
.
bash
/doc-bdd-fixer BDD-NN --revalidate
Fix Categories:
CategoryFixes Applied
Missing FilesCreate index, redirect stubs
Broken LinksUpdate paths, create targets
Element IDsConvert legacy patterns to BDD.NN.14.SS/BDD.NN.15.SS
TagsMove comment tags to Gherkin-native, add missing tags
ThresholdsReplace hardcoded values with @threshold references
v2.0 ComplianceAdd @scenario-type, @priority, WITHIN constraints
Output:
BDD-NN.F_fix_report_v001.md
若审核评分 < 90%,调用
doc-bdd-fixer
bash
/doc-bdd-fixer BDD-NN --revalidate
修复类别:
类别应用的修复
缺失文件创建索引、重定向存根
链接损坏更新路径、创建目标
元素ID将旧格式转换为BDD.NN.14.SS/BDD.NN.15.SS格式
标签将注释中的标签移动到Gherkin原生位置、添加缺失标签
阈值将硬编码值替换为@threshold引用
v2.0合规性添加@scenario-type、@priority、WITHIN约束
输出:
BDD-NN.F_fix_report_v001.md

5.3 Re-Review

5.3 重新审核

After fixes, automatically re-run reviewer.
bash
/doc-bdd-reviewer BDD-NN
Output:
BDD-NN.R_review_report_v002.md
修复后自动重新运行审核。
bash
/doc-bdd-reviewer BDD-NN
输出:
BDD-NN.R_review_report_v002.md

5.4 Iteration Control

5.4 迭代控制

ParameterDefaultDescription
max_iterations
3Maximum fix-review cycles
target_score
90Minimum passing score
stop_on_manual
falseStop if only manual issues remain
Iteration Example:
Iteration 1:
  Review v001: Score 84 (3 errors, 6 warnings)
  Fix v001: Fixed 7 issues, added 5 threshold references

Iteration 2:
  Review v002: Score 92 (0 errors, 4 warnings)
  Status: PASS (score >= 90)
参数默认值描述
max_iterations
3最大修复-审核循环次数
target_score
90最低通过评分
stop_on_manual
false若仅剩余手动问题则停止
迭代示例:
迭代1:
  审核v001: 评分84(3个错误,6个警告)
  修复v001: 修复7个问题,添加5个阈值引用

迭代2:
  审核v002: 评分92(0个错误,4个警告)
  状态: 通过(评分 >= 90)

5.5 Quality Checks (Post-Fix)

5.5 质量检查(修复后)

After passing the fix cycle:
  1. ADR-Ready Report (with Visual Indicators):
    Score Display Format:
    • ✅ >= 90% (Target Met)
    • 🟡 85-89% (Near Threshold)
    • ❌ < 85% (Failing)
    ADR-Ready Score Breakdown
    =========================
    Scenario Completeness:      35/35 ✅
      EARS Translation:         15/15
      Success/Error/Edge:       15/15
      Observable Verification:  5/5
    
    Testability:               30/30 ✅
      Automatable Scenarios:   15/15
      Data-Driven Examples:    10/10
      Performance Benchmarks:  5/5
    
    Architecture Requirements: 25/25 ✅
      Quality Attributes:      15/15
      Integration Points:      10/10
    
    Business Validation:       10/10 ✅
      Acceptance Criteria:     5/5
      Success Outcomes:        5/5
    
    v2.0 Compliance:           (Bonus)
      Scenario Type Tags:      ✅ All scenarios tagged
      Priority Tags:           ✅ All scenarios prioritized
      SHALL+WITHIN Language:   ✅ 15/15 timed scenarios
      5-Category Coverage:     ✅ All 5 categories present
      Threshold Format:        ✅ @threshold:PRD.NN format
    ----------------------------
    Total ADR-Ready Score:     ✅ 100/100 (Target: >= 90)
    Status: READY FOR ADR GENERATION
  2. Traceability Matrix Update:
    bash
    # Update BDD-00_TRACEABILITY_MATRIX.md
    python ai_dev_flow/scripts/update_traceability_matrix.py \
      --bdd docs/04_BDD/BDD-NN_{slug}/ \
      --matrix docs/04_BDD/BDD-00_TRACEABILITY_MATRIX.md

通过修复循环后:
  1. ADR就绪报告(带视觉指示器):
    评分显示格式:
    • ✅ >= 90%(达到目标)
    • 🟡 85-89%(接近阈值)
    • ❌ < 85%(未通过)
    ADR就绪评分细分
    =========================
    场景完整性:      35/35 ✅
      EARS转换:         15/15
      成功/错误/边缘情况:       15/15
      可观察的验证:  5/5
    
    可测试性:               30/30 ✅
      可自动化场景:   15/15
      数据驱动示例:    10/10
      性能基准:  5/5
    
    架构需求: 25/25 ✅
      质量属性:      15/15
      集成点:      10/10
    
    业务验证:       10/10 ✅
      验收标准:     5/5
      成功结果:        5/5
    
    v2.0合规性:           (加分项)
      场景类型标签:      ✅ 所有场景都有标签
      优先级标签:           ✅ 所有场景都已设置优先级
      SHALL+WITHIN语言:   ✅ 15/15个定时场景符合要求
      5类别覆盖:     ✅ 所有5个类别都已覆盖
      阈值格式:        ✅ @threshold:PRD.NN格式
    ----------------------------
    总ADR就绪评分:     ✅ 100/100(目标: >= 90)
    状态: 可用于ADR生成
  2. 可追溯性矩阵更新:
    bash
    # 更新BDD-00_TRACEABILITY_MATRIX.md
    python ai_dev_flow/scripts/update_traceability_matrix.py \
      --bdd docs/04_BDD/BDD-NN_{slug}/ \
      --matrix docs/04_BDD/BDD-00_TRACEABILITY_MATRIX.md

Scenario Category Reference

场景类别参考

1. Success Path Scenarios (@primary)

1. 成功路径场景 (@primary)

Purpose: Validate happy path functionality
Source: EARS Event-Driven statements (WHEN...THE...SHALL)
Example:
gherkin
@primary @functional
Scenario: User successfully authenticates with valid credentials
  Given user has valid credentials
  And authentication service is available
  When user submits authentication request
  Then user session is created
  And session token is returned
  And response time is less than @threshold:PRD.01.auth.response.p95
Coverage Target: Every EARS event-driven requirement
用途: 验证正常路径功能
来源: EARS事件驱动语句(WHEN...THE...SHALL)
示例:
gherkin
@primary @functional
Scenario: User successfully authenticates with valid credentials
  Given user has valid credentials
  And authentication service is available
  When user submits authentication request
  Then user session is created
  And session token is returned
  And response time is less than @threshold:PRD.01.auth.response.p95
覆盖目标: 每个EARS事件驱动需求

2. Alternative Path Scenarios (@alternative)

2. 备选路径场景 (@alternative)

Purpose: Validate optional parameters and alternate workflows
Source: EARS variations and optional paths
Example:
gherkin
@alternative @optional_params
Scenario: User authenticates with remember-me option
  Given user has valid credentials
  When user submits authentication with remember-me enabled
  Then extended session token is returned
  And session expiry is set to @threshold:PRD.01.session.extended_ttl
Coverage Target: Each optional parameter combination
用途: 验证可选参数和备选工作流
来源: EARS变体和可选路径
示例:
gherkin
@alternative @optional_params
Scenario: User authenticates with remember-me option
  Given user has valid credentials
  When user submits authentication with remember-me enabled
  Then extended session token is returned
  And session expiry is set to @threshold:PRD.01.session.extended_ttl
覆盖目标: 每个可选参数组合

3. Error Condition Scenarios (@negative)

3. 错误条件场景 (@negative)

Purpose: Validate error handling and invalid inputs
Source: EARS Unwanted Behavior statements (IF...THEN...SHALL)
Example:
gherkin
@negative @error_handling
Scenario: Authentication fails with invalid credentials
  Given user has invalid credentials
  When user submits authentication request
  Then authentication is rejected
  And error code "AUTH_INVALID_CREDENTIALS" is returned
  And failed attempt is logged
Coverage Target: Every EARS unwanted behavior statement
用途: 验证错误处理和无效输入
来源: EARS异常行为语句(IF...THEN...SHALL)
示例:
gherkin
@negative @error_handling
Scenario: Authentication fails with invalid credentials
  Given user has invalid credentials
  When user submits authentication request
  Then authentication is rejected
  And error code "AUTH_INVALID_CREDENTIALS" is returned
  And failed attempt is logged
覆盖目标: 每个EARS异常行为语句

4. Edge Case Scenarios (@edge_case, @boundary)

4. 边缘情况场景 (@edge_case, @boundary)

Purpose: Validate boundary conditions and limits
Source: EARS constraints and threshold boundaries
Example:
gherkin
@edge_case @boundary
Scenario: Session expires at exact timeout boundary
  Given session was created at "09:00:00" in "America/New_York"
  And session timeout is @threshold:PRD.01.session.idle_timeout
  When current time reaches session expiry
  Then session is invalidated
  And user is prompted to re-authenticate
Coverage Target: Each numeric threshold and boundary condition
用途: 验证边界条件和限制
来源: EARS约束和阈值边界
示例:
gherkin
@edge_case @boundary
Scenario: Session expires at exact timeout boundary
  Given session was created at "09:00:00" in "America/New_York"
  And session timeout is @threshold:PRD.01.session.idle_timeout
  When current time reaches session expiry
  Then session is invalidated
  And user is prompted to re-authenticate
覆盖目标: 每个数值阈值和边界条件

5. Data-Driven Scenarios (@data_driven)

5. 数据驱动场景 (@data_driven)

Purpose: Validate behavior across multiple data combinations
Source: EARS statements with parameterized values
Example:
gherkin
@data_driven
Scenario Outline: Validate user role authorization
  Given user has role <role>
  When user attempts to access <resource>
  Then access is <result>

  Examples:
    | role    | resource    | result  |
    | admin   | /admin      | granted |
    | user    | /admin      | denied  |
    | user    | /dashboard  | granted |
    | guest   | /dashboard  | denied  |
Coverage Target: Each parameterized requirement
用途: 验证多数据组合下的行为
来源: 带有参数化值的EARS语句
示例:
gherkin
@data_driven
Scenario Outline: Validate user role authorization
  Given user has role <role>
  When user attempts to access <resource>
  Then access is <result>

  Examples:
    | role    | resource    | result  |
    | admin   | /admin      | granted |
    | user    | /admin      | denied  |
    | user    | /dashboard  | granted |
    | guest   | /dashboard  | denied  |
覆盖目标: 每个参数化需求

6. Integration Scenarios (@integration)

6. 集成场景 (@integration)

Purpose: Validate external system interactions
Source: EARS statements involving external dependencies
Example:
gherkin
@integration @external_api
Scenario: System integrates with external identity provider
  Given external identity provider is configured
  When user initiates SSO authentication
  Then system redirects to identity provider
  And callback is processed within @threshold:PRD.01.sso.callback_timeout
Coverage Target: Each external system dependency
用途: 验证外部系统交互
来源: 涉及外部依赖的EARS语句
示例:
gherkin
@integration @external_api
Scenario: System integrates with external identity provider
  Given external identity provider is configured
  When user initiates SSO authentication
  Then system redirects to identity provider
  And callback is processed within @threshold:PRD.01.sso.callback_timeout
覆盖目标: 每个外部系统依赖

7. Quality Attribute Scenarios (@quality_attribute)

7. 质量属性场景 (@quality_attribute)

Purpose: Validate non-functional requirements
Source: EARS Quality Attributes section
Example:
gherkin
@quality_attribute @performance
Scenario: Authentication endpoint meets performance SLA
  Given system is under normal load
  When 100 concurrent authentication requests are submitted
  Then p95 response time is less than @threshold:PRD.01.perf.auth.p95_latency
  And no requests fail due to timeout
Coverage Target: Each quality attribute (performance, security, reliability)
用途: 验证非功能需求
来源: EARS质量属性章节
示例:
gherkin
@quality_attribute @performance
Scenario: Authentication endpoint meets performance SLA
  Given system is under normal load
  When 100 concurrent authentication requests are submitted
  Then p95 response time is less than @threshold:PRD.01.perf.auth.p95_latency
  And no requests fail due to timeout
覆盖目标: 每个质量属性(性能、安全、可靠性)

8. Failure Recovery Scenarios (@failure_recovery)

8. 故障恢复场景 (@failure_recovery)

Purpose: Validate resilience and recovery mechanisms
Source: EARS Unwanted Behavior recovery statements
Example:
gherkin
@failure_recovery @circuit_breaker
Scenario: Authentication service recovers from database failure
  Given database connection fails
  When authentication request is received
  Then circuit breaker activates
  And fallback authentication is attempted
  And service recovers within @threshold:PRD.01.recovery.max_time
Coverage Target: Each recovery and resilience mechanism

用途: 验证弹性和恢复机制
来源: EARS异常行为恢复语句
示例:
gherkin
@failure_recovery @circuit_breaker
Scenario: Authentication service recovers from database failure
  Given database connection fails
  When authentication request is received
  Then circuit breaker activates
  And fallback authentication is attempted
  And service recovers within @threshold:PRD.01.recovery.max_time
覆盖目标: 每个恢复和弹性机制

Enhanced Scenario Tagging (v2.0)

增强场景标签(v2.0)

Scenario Type Classification

场景类型分类

All scenarios MUST include a
@scenario-type
tag for classification:
TagPurposePriority DefaultCoverage Requirement
@scenario-type:success
Primary happy path@p0-criticalRequired for all EARS event-driven
@scenario-type:optional
Alternative workflows@p2-mediumOptional parameters
@scenario-type:recovery
Failure recovery@p1-highResilience patterns
@scenario-type:parameterized
Data-driven@p2-mediumMulti-value validation
@scenario-type:error
Negative cases@p1-highError handling
所有场景必须包含
@scenario-type
标签用于分类:
标签用途默认优先级覆盖要求
@scenario-type:success
主要正常路径@p0-critical所有EARS事件驱动需求必填
@scenario-type:optional
备选工作流@p2-medium可选参数
@scenario-type:recovery
故障恢复@p1-high弹性模式
@scenario-type:parameterized
数据驱动@p2-medium多值验证
@scenario-type:error
负面场景@p1-high错误处理

Priority Classification

优先级分类

All scenarios MUST include a priority tag:
TagDefinitionImpact
@p0-critical
MVP blocking - must pass for releaseBlocks deployment
@p1-high
Sprint required - must pass within sprintSprint scope
@p2-medium
Next iteration - important but deferrableNext planning cycle
@p3-low
Backlog - nice to haveFuture consideration
所有场景必须包含优先级标签:
标签定义影响
@p0-critical
阻塞MVP - 发布前必须通过阻塞部署
@p1-high
迭代内必须完成 - 迭代内必须通过迭代范围
@p2-medium
下一个迭代 - 重要但可推迟下一个规划周期
@p3-low
待办项 - 锦上添花未来考虑

SHALL+WITHIN Language Pattern

SHALL+WITHIN语言格式

For timed operations, use formal EARS-derived language with WITHIN constraints:
gherkin
@scenario-type:success @p0-critical
Scenario: Authentication completes within performance threshold
  Given user has valid credentials
  When user submits authentication request
  Then the system SHALL authenticate the user
  And the response SHALL be returned WITHIN @threshold:PRD.01.perf.auth.p95_latency
WITHIN Constraint Rules:
  1. All performance-related scenarios MUST include WITHIN clauses
  2. WITHIN values MUST reference threshold registry (no hardcoded values)
  3. Format:
    WITHIN @threshold:PRD.NN.category.field
对于定时操作,使用源自EARS的正式语言并带有WITHIN约束:
gherkin
@scenario-type:success @p0-critical
Scenario: Authentication completes within performance threshold
  Given user has valid credentials
  When user submits authentication request
  Then the system SHALL authenticate the user
  And the response SHALL be returned WITHIN @threshold:PRD.01.perf.auth.p95_latency
WITHIN约束规则:
  1. 所有性能相关场景必须包含WITHIN子句
  2. WITHIN值必须引用阈值注册表(不可硬编码)
  3. 格式:
    WITHIN @threshold:PRD.NN.category.field

Enhanced Scenario Template

增强场景模板

gherkin
@section: NN.SS
@parent_doc: BDD-NN
@index: BDD-NN.0_index.md
@brd:BRD.NN.01.SS
@prd:PRD.NN.07.SS
@ears:EARS.NN.25.SS

Feature: BDD-NN.SS: [Feature Name]
  As a [role]
  I want [feature]
  So that [benefit]

  Background:
    Given the system timezone is "America/New_York"
    And the current time is "09:30:00" in "America/New_York"

  @scenario-type:success @p0-critical @scenario-id:BDD.NN.14.01
  Scenario: [Primary success path description]
    Given [precondition from EARS WHEN clause]
    When [action from EARS trigger]
    Then the system SHALL [outcome from EARS SHALL clause]
    And the response SHALL be returned WITHIN @threshold:PRD.NN.perf.api.p95_latency

  @scenario-type:error @p1-high @scenario-id:BDD.NN.14.10
  Scenario: [Error condition] results in [expected behavior]
    Given [error precondition from EARS IF clause]
    When [action that triggers error]
    Then the system SHALL NOT [prevented behavior]
    And error code "[ERROR_CODE]" SHALL be returned WITHIN @threshold:PRD.NN.timeout.error.response

  @scenario-type:recovery @p1-high @scenario-id:BDD.NN.14.20
  Scenario: System recovers from [failure type]
    Given [failure condition]
    When [recovery trigger]
    Then the system SHALL recover WITHIN @threshold:PRD.NN.recovery.max_time
    And circuit breaker state SHALL transition to "half-open"

  @scenario-type:parameterized @p2-medium @scenario-id:BDD.NN.14.30
  Scenario Outline: [Parameterized test description]
    Given [context with <variable>]
    When [action with <variable>]
    Then the system SHALL [outcome with <expected>]

    Examples:
      | variable | expected |
      | value1   | result1  |
      | value2   | result2  |

  @scenario-type:optional @p2-medium @scenario-id:BDD.NN.14.40
  Scenario: [Alternative path with optional parameter]
    Given [optional context]
    When [alternative action]
    Then the system SHALL [alternative outcome]
gherkin
@section: NN.SS
@parent_doc: BDD-NN
@index: BDD-NN.0_index.md
@brd:BRD.NN.01.SS
@prd:PRD.NN.07.SS
@ears:EARS.NN.25.SS

Feature: BDD-NN.SS: [功能名称]
  As a [角色]
  I want [功能]
  So that [收益]

  Background:
    Given the system timezone is "America/New_York"
    And the current time is "09:30:00" in "America/New_York"

  @scenario-type:success @p0-critical @scenario-id:BDD.NN.14.01
  Scenario: [主要成功路径描述]
    Given [来自EARS WHEN子句的前置条件]
    When [来自EARS触发事件的操作]
    Then the system SHALL [来自EARS SHALL子句的结果]
    And the response SHALL be returned WITHIN @threshold:PRD.NN.perf.api.p95_latency

  @scenario-type:error @p1-high @scenario-id:BDD.NN.14.10
  Scenario: [错误条件] results in [预期行为]
    Given [来自EARS IF子句的错误前置条件]
    When [触发错误的操作]
    Then the system SHALL NOT [被阻止的行为]
    And error code "[ERROR_CODE]" SHALL be returned WITHIN @threshold:PRD.NN.timeout.error.response

  @scenario-type:recovery @p1-high @scenario-id:BDD.NN.14.20
  Scenario: System recovers from [故障类型]
    Given [故障条件]
    When [恢复触发事件]
    Then the system SHALL recover WITHIN @threshold:PRD.NN.recovery.max_time
    And circuit breaker state SHALL transition to "half-open"

  @scenario-type:parameterized @p2-medium @scenario-id:BDD.NN.14.30
  Scenario Outline: [参数化测试描述]
    Given [包含<variable>的上下文]
    When [包含<variable>的操作]
    Then the system SHALL [包含<expected>的结果]

    Examples:
      | variable | expected |
      | value1   | result1  |
      | value2   | result2  |

  @scenario-type:optional @p2-medium @scenario-id:BDD.NN.14.40
  Scenario: [带有可选参数的备选路径]
    Given [可选上下文]
    When [备选操作]
    Then the system SHALL [备选结果]

5-Category Coverage Matrix

5类别覆盖矩阵

CategoryMinimum ScenariosPriority Distribution
Success1 per EARS event-driven100% @p0-critical or @p1-high
Error1 per EARS unwanted behavior80% @p1-high, 20% @p2-medium
Recovery1 per circuit breaker pattern100% @p1-high
Parameterized1 per multi-value requirement50% @p1-high, 50% @p2-medium
Optional1 per optional parameter100% @p2-medium or @p3-low

类别最低场景数量优先级分布
成功每个EARS事件驱动需求1个100% @p0-critical或@p1-high
错误每个EARS异常行为语句1个80% @p1-high,20% @p2-medium
恢复每个断路器模式1个100% @p1-high
参数化每个多值需求1个50% @p1-high,50% @p2-medium
可选每个可选参数1个100% @p2-medium或@p3-low

Execution Modes

执行模式

Single EARS Mode

单个EARS模式

Generate BDD from one EARS document.
bash
undefined
从一个EARS文档生成BDD。
bash
undefined

Example: Generate BDD from EARS-01

示例: 从EARS-01生成BDD

python ai_dev_flow/scripts/bdd_autopilot.py
--ears docs/03_EARS/EARS-01_f1_iam/
--output docs/04_BDD/
--id 01
--slug f1_iam_scenarios
undefined
python ai_dev_flow/scripts/bdd_autopilot.py
--ears docs/03_EARS/EARS-01_f1_iam/
--output docs/04_BDD/
--id 01
--slug f1_iam_scenarios
undefined

Batch Mode

批量模式

Generate BDD from multiple EARS in sequence.
bash
undefined
从多个EARS依次生成BDD。
bash
undefined

Example: Generate BDD from all EARS

示例: 从所有EARS生成BDD

python ai_dev_flow/scripts/bdd_autopilot.py
--batch config/bdd_batch.yaml
--output docs/04_BDD/

**Batch Configuration** (`config/bdd_batch.yaml`):

```yaml
bdd_generation:
  - id: "01"
    slug: "f1_iam_scenarios"
    ears: "EARS-01"
    priority: 1

  - id: "02"
    slug: "f2_data_scenarios"
    ears: "EARS-02"
    priority: 2

  - id: "03"
    slug: "f3_api_scenarios"
    ears: "EARS-03"
    priority: 2

execution:
  parallel: false
  fail_fast: true
python ai_dev_flow/scripts/bdd_autopilot.py
--batch config/bdd_batch.yaml
--output docs/04_BDD/

**批量配置** (`config/bdd_batch.yaml`):

```yaml
bdd_generation:
  - id: "01"
    slug: "f1_iam_scenarios"
    ears: "EARS-01"
    priority: 1

  - id: "02"
    slug: "f2_data_scenarios"
    ears: "EARS-02"
    priority: 2

  - id: "03"
    slug: "f3_api_scenarios"
    ears: "EARS-03"
    priority: 2

execution:
  parallel: false
  fail_fast: true

Dry Run Mode

试运行模式

Preview execution plan without generating files.
bash
python ai_dev_flow/scripts/bdd_autopilot.py \
  --ears docs/03_EARS/EARS-01_f1_iam/ \
  --dry-run
预览执行计划但不生成文件。
bash
python ai_dev_flow/scripts/bdd_autopilot.py \
  --ears docs/03_EARS/EARS-01_f1_iam/ \
  --dry-run

Review Mode (v2.1)

审核模式(v2.1)

Validate existing BDD documents and generate a quality report without modification.
Purpose: Audit existing BDD documents for compliance, quality scores, and identify issues.
Command:
bash
undefined
验证现有BDD文档并生成质量报告,不修改文档。
用途: 审核现有BDD文档的合规性、质量评分并识别问题。
命令:
bash
undefined

Review single BDD suite

审核单个BDD套件

python ai_dev_flow/scripts/bdd_autopilot.py
--bdd docs/04_BDD/BDD-01_f1_iam/
--mode review
python ai_dev_flow/scripts/bdd_autopilot.py
--bdd docs/04_BDD/BDD-01_f1_iam/
--mode review

Review all BDD suites

审核所有BDD套件

python ai_dev_flow/scripts/bdd_autopilot.py
--bdd docs/04_BDD/
--mode review
--output-report tmp/bdd_review_report.md

**Review Process**:

```mermaid
flowchart TD
    A[Input: Existing BDD] --> B[Load BDD Documents]
    B --> C[Run Validation Checks]
    C --> D[Calculate ADR-Ready Score]
    D --> E[Identify Issues]
    E --> F[Categorize Issues]
    F --> G{Generate Report}
    G --> H[Fixable Issues List]
    G --> I[Manual Review Items]
    G --> J[Score Breakdown]
    H --> K[Output: Review Report]
    I --> K
    J --> K
Review Report Structure:
markdown
undefined
python ai_dev_flow/scripts/bdd_autopilot.py
--bdd docs/04_BDD/
--mode review
--output-report tmp/bdd_review_report.md

**审核流程**:

```mermaid
flowchart TD
    A[输入: 现有BDD] --> B[加载BDD文档]
    B --> C[运行验证检查]
    C --> D[计算ADR就绪评分]
    D --> E[识别问题]
    E --> F[分类问题]
    F --> G{生成报告}
    G --> H[可自动修复的问题列表]
    G --> I[需要手动审核的项]
    G --> J[评分细分]
    H --> K[输出: 审核报告]
    I --> K
    J --> K
审核报告结构:
markdown
undefined

BDD Review Report: BDD-01_f1_iam

BDD审核报告: BDD-01_f1_iam

Summary

摘要

  • ADR-Ready Score: 87% 🟡
  • Total Issues: 12
  • Auto-Fixable: 8
  • Manual Review: 4
  • ADR就绪评分: 87% 🟡
  • 总问题数: 12
  • 可自动修复: 8
  • 需要手动审核: 4

Score Breakdown

评分细分

CategoryScoreStatus
Scenario Completeness32/35🟡
Testability28/30
Architecture Requirements20/25🟡
Business Validation7/10
类别评分状态
场景完整性32/35🟡
可测试性28/30
架构需求20/25🟡
业务验证7/10

v2.0 Compliance

v2.0合规性

CheckStatusDetails
Scenario Type Tags5 scenarios missing @scenario-type
Priority Tags🟡3 scenarios missing priority
SHALL+WITHIN Language8 timed scenarios lack WITHIN
5-Category CoverageAll categories present
Threshold Format🟡2 hardcoded values found
检查项状态详情
场景类型标签5个场景缺失@scenario-type
优先级标签🟡3个场景缺失优先级
SHALL+WITHIN语言8个定时场景缺少WITHIN
5类别覆盖所有类别都已覆盖
阈值格式🟡发现2个硬编码值

Auto-Fixable Issues

可自动修复的问题

#IssueLocationFix Action
1Missing @scenario-type tagBDD-01.1:L45Add @scenario-type:success
2Hardcoded timeout valueBDD-01.2:L78Replace with @threshold
............
#问题位置修复操作
1缺失@scenario-type标签BDD-01.1:L45添加@scenario-type:success
2硬编码超时值BDD-01.2:L78替换为@threshold
............

Manual Review Required

需要手动审核的项

#IssueLocationReason
1Ambiguous step definitionBDD-01.3:L102Requires domain knowledge
2Missing edge case scenarioBDD-01.1Content decision needed
............
#问题位置原因
1步骤定义模糊BDD-01.3:L102需要领域知识
2缺失边缘情况场景BDD-01.1需要内容决策
............

Recommendations

建议

  1. Run fix mode to address 8 auto-fixable issues
  2. Review and update 4 items requiring manual attention
  3. Add 2 missing edge case scenarios for full coverage

**Review Configuration**:

```yaml
review_mode:
  enabled: true
  checks:
    - structure_validation      # Index, sections, redirects
    - gherkin_syntax           # Given-When-Then compliance
    - tag_validation           # Cumulative tags, scenario tags
    - threshold_references     # @threshold format and validity
    - v2_compliance            # Scenario types, priorities, WITHIN
    - coverage_analysis        # 5-category coverage
    - score_calculation        # ADR-Ready score
  output:
    format: markdown           # markdown, json, html
    include_line_numbers: true
    include_fix_suggestions: true
  thresholds:
    pass: 90
    warning: 85
    fail: 0
  1. 运行修复模式解决8个可自动修复的问题
  2. 审核并更新4个需要手动处理的项
  3. 添加2个缺失的边缘情况场景以实现完整覆盖

**审核配置**:

```yaml
review_mode:
  enabled: true
  checks:
    - structure_validation      # 索引、章节、重定向
    - gherkin_syntax           # Given-When-Then合规性
    - tag_validation           # 累积标签、场景标签
    - threshold_references     # @threshold格式和有效性
    - v2_compliance            # 场景类型、优先级、WITHIN
    - coverage_analysis        # 5类别覆盖
    - score_calculation        # ADR就绪评分
  output:
    format: markdown           # markdown, json, html
    include_line_numbers: true
    include_fix_suggestions: true
  thresholds:
    pass: 90
    warning: 85
    fail: 0

Fix Mode (v2.1)

修复模式(v2.1)

Auto-repair existing BDD documents while preserving manual content.
Purpose: Apply automated fixes to BDD documents to improve quality scores and compliance.
Command:
bash
undefined
自动修复现有BDD文档,同时保留手动内容。
用途: 对BDD文档应用自动修复以提高质量评分和合规性。
命令:
bash
undefined

Fix single BDD suite

修复单个BDD套件

python ai_dev_flow/scripts/bdd_autopilot.py
--bdd docs/04_BDD/BDD-01_f1_iam/
--mode fix
python ai_dev_flow/scripts/bdd_autopilot.py
--bdd docs/04_BDD/BDD-01_f1_iam/
--mode fix

Fix with backup

修复并备份

python ai_dev_flow/scripts/bdd_autopilot.py
--bdd docs/04_BDD/BDD-01_f1_iam/
--mode fix
--backup
python ai_dev_flow/scripts/bdd_autopilot.py
--bdd docs/04_BDD/BDD-01_f1_iam/
--mode fix
--backup

Fix specific issue types only

仅修复特定类型的问题

python ai_dev_flow/scripts/bdd_autopilot.py
--bdd docs/04_BDD/BDD-01_f1_iam/
--mode fix
--fix-types "tags,thresholds,syntax"
python ai_dev_flow/scripts/bdd_autopilot.py
--bdd docs/04_BDD/BDD-01_f1_iam/
--mode fix
--fix-types "tags,thresholds,syntax"

Dry-run fix (preview changes)

试运行修复(预览更改)

python ai_dev_flow/scripts/bdd_autopilot.py
--bdd docs/04_BDD/BDD-01_f1_iam/
--mode fix
--dry-run

**Fix Process**:

```mermaid
flowchart TD
    A[Input: Existing BDD] --> B[Run Review Mode]
    B --> C[Identify Fixable Issues]
    C --> D{Backup Enabled?}
    D -->|Yes| E[Create Backup]
    D -->|No| F[Skip Backup]
    E --> G[Apply Fixes by Category]
    F --> G

    subgraph FixCategories["Fix Categories"]
        G --> H[Structure Fixes]
        G --> I[Tag Fixes]
        G --> J[Threshold Fixes]
        G --> K[Syntax Fixes]
        G --> L[v2.0 Compliance Fixes]
    end

    H --> M[Preserve Manual Content]
    I --> M
    J --> M
    K --> M
    L --> M

    M --> N[Re-validate]
    N --> O{Score Improved?}
    O -->|Yes| P[Generate Fix Report]
    O -->|No| Q[Log Warnings]
    Q --> P
    P --> R[Output: Fixed BDD + Report]
Fix Categories and Actions:
CategoryIssueAuto-Fix ActionPreserves Content
StructureMissing index fileGenerate from existing sections
StructureMissing redirect stubCreate redirect stub
TagsMissing @scenario-typeAdd based on scenario content analysis
TagsMissing @priorityAdd default @p2-medium
TagsTags in commentsMove to Gherkin-native position
TagsMissing cumulative tagsAdd with placeholder references
ThresholdsHardcoded numeric valuesReplace with @threshold:PRD.NN.xxx
ThresholdsInvalid threshold formatConvert to @threshold:PRD.NN.category.field
SyntaxMissing Given/When/ThenFlag for manual (content needed)N/A
SyntaxVague languageSuggest replacements in report
v2.0Missing WITHIN clauseAdd WITHIN @threshold for timed ops
v2.0Missing SHALL languageConvert "should" to "SHALL"
Content Preservation Rules:
  1. Never delete existing scenario content
  2. Never modify step definitions (Given/When/Then text)
  3. Never change Examples table data
  4. Only add missing tags and metadata
  5. Only replace hardcoded values with threshold references
  6. Backup first if
    --backup
    flag is set
Fix Report Structure:
markdown
undefined
python ai_dev_flow/scripts/bdd_autopilot.py
--bdd docs/04_BDD/BDD-01_f1_iam/
--mode fix
--dry-run

**修复流程**:

```mermaid
flowchart TD
    A[输入: 现有BDD] --> B[运行审核模式]
    B --> C[识别可修复的问题]
    C --> D{已启用备份?}
    D -->|是| E[创建备份]
    D -->|否| F[跳过备份]
    E --> G[按类别应用修复]
    F --> G

    subgraph FixCategories["修复类别"]
        G --> H[结构修复]
        G --> I[标签修复]
        G --> J[阈值修复]
        G --> K[语法修复]
        G --> L[v2.0合规性修复]
    end

    H --> M[保留手动内容]
    I --> M
    J --> M
    K --> M
    L --> M

    M --> N[重新验证]
    N --> O{评分已提升?}
    O -->|是| P[生成修复报告]
    O -->|否| Q[记录警告]
    Q --> P
    P --> R[输出: 修复后的BDD + 报告]
修复类别与操作:
类别问题自动修复操作是否保留内容
结构缺失索引文件从现有章节生成
结构缺失重定向存根创建重定向存根
标签缺失@scenario-type根据场景内容分析添加
标签缺失@priority添加默认@p2-medium
标签标签在注释中移动到Gherkin原生位置
标签缺失累积标签添加占位符引用
阈值硬编码数值替换为@threshold:PRD.NN.xxx
阈值无效阈值格式转换为@threshold:PRD.NN.category.field
语法缺失Given/When/Then标记为需要手动处理(需要内容)N/A
语法模糊语言在报告中建议替换
v2.0缺失WITHIN子句为定时操作添加WITHIN @threshold
v2.0缺失SHALL语言将"should"转换为"SHALL"
内容保留规则:
  1. 绝不删除现有场景内容
  2. 绝不修改步骤定义(Given/When/Then文本)
  3. 绝不修改Examples表格数据
  4. 仅添加缺失的标签和元数据
  5. 仅替换硬编码值为阈值引用
  6. 若设置
    --backup
    标志,先备份
修复报告结构:
markdown
undefined

BDD Fix Report: BDD-01_f1_iam

BDD修复报告: BDD-01_f1_iam

Summary

摘要

  • Before ADR-Ready Score: 87% 🟡
  • After ADR-Ready Score: 94% ✅
  • Issues Fixed: 8
  • Issues Remaining: 4 (manual review required)
  • 修复前ADR就绪评分: 87% 🟡
  • 修复后ADR就绪评分: 94% ✅
  • 已修复问题数: 8
  • 剩余问题数: 4(需要手动审核)

Fixes Applied

应用的修复

#IssueLocationFix Applied
1Missing @scenario-typeBDD-01.1:L45Added @scenario-type:success
2Hardcoded timeoutBDD-01.2:L78Replaced with @threshold:PRD.01.timeout.api.max
3Tags in commentsBDD-01.3:L12Moved to Gherkin-native position
............
#问题位置应用的修复
1缺失@scenario-typeBDD-01.1:L45添加@scenario-type:success
2硬编码超时BDD-01.2:L78替换为@threshold:PRD.01.timeout.api.max
3标签在注释中BDD-01.3:L12移动到Gherkin原生位置
............

Files Modified

修改的文件

  • docs/04_BDD/BDD-01_f1_iam/BDD-01.1_authentication.feature
  • docs/04_BDD/BDD-01_f1_iam/BDD-01.2_session.feature
  • docs/04_BDD/BDD-01_f1_iam/BDD-01.3_authorization.feature
  • docs/04_BDD/BDD-01_f1_iam/BDD-01.1_authentication.feature
  • docs/04_BDD/BDD-01_f1_iam/BDD-01.2_session.feature
  • docs/04_BDD/BDD-01_f1_iam/BDD-01.3_authorization.feature

Backup Location

备份位置

  • tmp/backup/BDD-01_f1_iam_20260209_143022/
  • tmp/backup/BDD-01_f1_iam_20260209_143022/

Remaining Issues (Manual Review)

剩余问题(需要手动审核)

#IssueLocationReason
1Ambiguous stepBDD-01.3:L102Requires domain knowledge
............
#问题位置原因
1步骤模糊BDD-01.3:L102需要领域知识
............

Next Steps

下一步

  1. Review manually flagged items
  2. Re-run validation to confirm score
  3. Commit changes if satisfied

**Fix Configuration**:

```yaml
fix_mode:
  enabled: true
  backup:
    enabled: true
    location: "tmp/backup/"
    retention_days: 7

  fix_categories:
    structure: true          # Index, redirects
    tags: true               # Scenario tags, cumulative tags
    thresholds: true         # @threshold references
    syntax: false            # Gherkin syntax (risky, disabled by default)
    v2_compliance: true      # Scenario types, priorities, WITHIN

  preservation:
    step_definitions: true   # Never modify step text
    examples_data: true      # Never modify Examples tables
    comments: true           # Preserve user comments
    custom_tags: true        # Preserve non-standard tags

  validation:
    re_validate_after_fix: true
    require_score_improvement: false
    max_fix_iterations: 3
Command Line Options (Review/Fix):
OptionModeDefaultDescription
--mode review
Review-Run review mode only
--mode fix
Fix-Run fix mode
--output-report
BothautoReport output path
--backup
FixtrueCreate backup before fixing
--fix-types
FixallComma-separated fix categories
--dry-run
FixfalsePreview fixes without applying
--preserve-all
FixfalseExtra cautious preservation
--min-score-gain
Fix0Minimum score improvement required

  1. 审核标记为手动处理的项
  2. 重新运行验证以确认评分
  3. 若满意则提交更改

**修复配置**:

```yaml
fix_mode:
  enabled: true
  backup:
    enabled: true
    location: "tmp/backup/"
    retention_days: 7

  fix_categories:
    structure: true          # 索引、重定向
    tags: true               # 场景标签、累积标签
    thresholds: true         # @threshold引用
    syntax: false            # Gherkin语法(风险高,默认禁用)
    v2_compliance: true      # 场景类型、优先级、WITHIN

  preservation:
    step_definitions: true   # 绝不修改步骤文本
    examples_data: true      # 绝不修改Examples表格
    comments: true           # 保留用户注释
    custom_tags: true        # 保留非标准标签

  validation:
    re_validate_after_fix: true
    require_score_improvement: false
    max_fix_iterations: 3
命令行选项(审核/修复):
选项模式默认值描述
--mode review
审核-仅运行审核模式
--mode fix
修复-运行修复模式
--output-report
两者自动报告输出路径
--backup
修复true修复前创建备份
--fix-types
修复全部逗号分隔的修复类别
--dry-run
修复false预览修复但不应用
--preserve-all
修复false额外谨慎的内容保留
--min-score-gain
修复0要求的最低评分提升

Configuration

配置

Default Configuration

默认配置

yaml
undefined
yaml
undefined

config/bdd_autopilot.yaml

config/bdd_autopilot.yaml

bdd_autopilot: version: "2.0"
scoring: bdd_ready_min: 90 adr_ready_min: 90 strict_mode: false # NEW: Visual score indicators score_display: pass_icon: "✅" # >= 90% warning_icon: "🟡" # 85-89% fail_icon: "❌" # < 85%
execution: max_parallel: 3 # HARD LIMIT - do not exceed chunk_size: 3 # Documents per chunk pause_between_chunks: true auto_fix: true continue_on_error: false timeout_per_ears: 300 # seconds
output: structure: sectioned # always sectioned for BDD size_threshold_lines: 500 max_scenarios_per_feature: 12 report_format: markdown
validation: skip_validation: false fix_iterations_max: 3 # NEW: Enhanced validation checks require_scenario_type_tags: true require_priority_tags: true require_within_constraints: true require_5_category_coverage: true
review: enabled: true check_gherkin: true check_thresholds: true check_coverage: true check_tags: true auto_fix_gherkin: true # NEW: SHALL+WITHIN enforcement check_timing_constraints: true
coverage: require_success_paths: true require_error_scenarios: true require_edge_cases: true require_data_driven: true require_quality_attributes: true # NEW: 5-Category Coverage categories: - success # Primary happy path - optional # Alternative paths - recovery # Failure recovery - parameterized # Data-driven - error # Negative cases

NEW: Scenario Classification

scenario_classification: type_tags: - "@scenario-type:success" - "@scenario-type:optional" - "@scenario-type:recovery" - "@scenario-type:parameterized" - "@scenario-type:error" priority_tags: - "@p0-critical" # MVP blocking - "@p1-high" # Sprint required - "@p2-medium" # Next iteration - "@p3-low" # Backlog

NEW: Threshold Reference Format

threshold_format: pattern: "@threshold:PRD.NN.category.field" examples: - "@threshold:PRD.01.perf.auth.p95_latency" - "@threshold:PRD.01.timeout.session.idle" - "@threshold:PRD.01.retry.max_attempts"
undefined
bdd_autopilot: version: "2.0"
scoring: bdd_ready_min: 90 adr_ready_min: 90 strict_mode: false # 新增: 可视化评分指示器 score_display: pass_icon: "✅" # >=90% warning_icon: "🟡" # 85-89% fail_icon: "❌" # <85%
execution: max_parallel: 3 # hard限制 - 请勿超过 chunk_size: 3 # 每个块的文档数量 pause_between_chunks: true auto_fix: true continue_on_error: false timeout_per_ears: 300 # 秒
output: structure: sectioned # BDD始终使用分章节结构 size_threshold_lines: 500 max_scenarios_per_feature: 12 report_format: markdown
validation: skip_validation: false fix_iterations_max: 3 # 新增: 增强验证检查 require_scenario_type_tags: true require_priority_tags: true require_within_constraints: true require_5_category_coverage: true
review: enabled: true check_gherkin: true check_thresholds: true check_coverage: true check_tags: true auto_fix_gherkin: true # 新增: SHALL+WITHIN强制要求 check_timing_constraints: true
coverage: require_success_paths: true require_error_scenarios: true require_edge_cases: true require_data_driven: true require_quality_attributes: true # 新增: 5类别覆盖 categories: - success # 主要正常路径 - optional # 备选路径 - recovery # 故障恢复 - parameterized # 数据驱动 - error # 负面场景

新增: 场景分类

scenario_classification: type_tags: - "@scenario-type:success" - "@scenario-type:optional" - "@scenario-type:recovery" - "@scenario-type:parameterized" - "@scenario-type:error" priority_tags: - "@p0-critical" # 阻塞MVP - "@p1-high" # 迭代内必须完成 - "@p2-medium" # 下一个迭代 - "@p3-low" # 待办项

新增: 阈值引用格式

threshold_format: pattern: "@threshold:PRD.NN.category.field" examples: - "@threshold:PRD.01.perf.auth.p95_latency" - "@threshold:PRD.01.timeout.session.idle" - "@threshold:PRD.01.retry.max_attempts"
undefined

Command Line Options

命令行选项

OptionDefaultDescription
--min-bdd-ready
90Minimum BDD-Ready score (EARS)
--min-adr-ready
90Minimum ADR-Ready score (BDD)
--no-auto-fix
falseDisable auto-fix (manual only)
--continue-on-error
falseContinue if one EARS fails
--dry-run
falsePreview execution plan only
--skip-review
falseSkip final review phase
--all-categories
trueRequire all 8 scenario categories

选项默认值描述
--min-bdd-ready
90最低BDD就绪评分(EARS)
--min-adr-ready
90最低ADR就绪评分(BDD)
--no-auto-fix
false禁用自动修复(仅手动)
--continue-on-error
false若一个EARS失败则继续
--dry-run
false仅预览执行计划
--skip-review
false跳过最终审核阶段
--all-categories
true要求覆盖所有8种场景类别

Context Management

上下文管理

Chunked Parallel Execution (MANDATORY)

分块并行执行(强制要求)

CRITICAL: To prevent conversation context overflow errors ("Prompt is too long", "Conversation too long"), all autopilot operations MUST follow chunked execution rules:
Chunk Size Limit: Maximum 3 documents per chunk
Chunking Rules:
  1. Chunk Formation: Group EARS documents into chunks of maximum 3 at a time
  2. Sequential Chunk Processing: Process one chunk at a time, completing all BDDs in a chunk before starting the next
  3. Context Pause: After completing each chunk, provide a summary and pause for user acknowledgment
  4. Progress Tracking: Display chunk progress (e.g., "Chunk 2/5: Processing EARS-04, EARS-05, EARS-06")
Execution Pattern:
text
EARS: EARS-01, EARS-02, EARS-03, EARS-04, EARS-05, EARS-06, EARS-07

Chunk 1: [EARS-01, EARS-02, EARS-03] → Process → Summary → Pause
Chunk 2: [EARS-04, EARS-05, EARS-06] → Process → Summary → Pause
Chunk 3: [EARS-07]                    → Process → Summary → Complete
Chunk Completion Summary Template:
text
Chunk N/M Complete:
├── Generated: BDD-01, BDD-02, BDD-03
├── ADR-Ready Scores: 94%, 92%, 91%
├── Status: All validated
└── Next: Continue with Chunk N+1? [Y/n]
Why Chunking is Required:
  • Prevents "Conversation too long" errors during batch processing
  • Allows context compaction between chunks
  • Enables recovery from failures without losing all progress
  • Provides natural checkpoints for user review

关键: 为防止对话上下文溢出错误("提示过长"、"对话过长"),所有自动生成器操作必须遵循分块执行规则:
分块大小限制: 每个块最多3个文档
分块规则:
  1. 块形成: 将EARS文档分组为最多3个一组的块
  2. 块顺序处理: 一次处理一个块,完成一个块中的所有BDD后再开始下一个块
  3. 上下文暂停: 完成每个块后,提供摘要并暂停等待用户确认
  4. 进度跟踪: 显示块进度(例如:"块2/5: 处理EARS-04, EARS-05, EARS-06")
执行模式:
text
EARS: EARS-01, EARS-02, EARS-03, EARS-04, EARS-05, EARS-06, EARS-07

块1: [EARS-01, EARS-02, EARS-03] → 处理 → 摘要 → 暂停
块2: [EARS-04, EARS-05, EARS-06] → 处理 → 摘要 → 暂停
块3: [EARS-07]                    → 处理 → 摘要 → 完成
块完成摘要模板:
text
块N/M完成:
├── 已生成: BDD-01, BDD-02, BDD-03
├── ADR就绪评分: 94%, 92%, 91%
├── 状态: 全部已验证
└── 下一步: 继续处理块N+1? [Y/n]
分块的必要性:
  • 防止批量处理时出现"对话过长"错误
  • 允许块之间的上下文压缩
  • 故障时可恢复而不丢失所有进度
  • 为用户提供自然的审核检查点

Output Artifacts

输出产物

Generated Files

生成的文件

All BDD suites use nested folders (
BDD-NN_{slug}/
). This keeps feature files and companion files (review reports, fix reports, drift cache) organized together.
FilePurposeLocation
BDD-NN_{slug}/BDD suite folder (ALWAYS created)
docs/04_BDD/
BDD-NN.0_index.mdSuite index
docs/04_BDD/BDD-NN_{slug}/
BDD-NN.S_{section}.featureSection files
docs/04_BDD/BDD-NN_{slug}/
BDD-NN_{slug}.featureRedirect stub
docs/04_BDD/
BDD-NN.R_review_report_v{VVV}.mdReview report
docs/04_BDD/BDD-NN_{slug}/
BDD-NN.F_fix_report_v{VVV}.mdFix report
docs/04_BDD/BDD-NN_{slug}/
.drift_cache.jsonDrift detection cache
docs/04_BDD/BDD-NN_{slug}/
所有BDD套件使用嵌套文件夹 (
BDD-NN_{slug}/
)。这样可以将Feature文件和配套文件(审核报告、修复报告、漂移缓存)组织在一起。
文件用途位置
BDD-NN_{slug}/BDD套件文件夹(始终创建)
docs/04_BDD/
BDD-NN.0_index.md套件索引
docs/04_BDD/BDD-NN_{slug}/
BDD-NN.S_{section}.feature章节文件
docs/04_BDD/BDD-NN_{slug}/
BDD-NN_{slug}.feature重定向存根
docs/04_BDD/
BDD-NN.R_review_report_v{VVV}.md审核报告
docs/04_BDD/BDD-NN_{slug}/
BDD-NN.F_fix_report_v{VVV}.md修复报告
docs/04_BDD/BDD-NN_{slug}/
.drift_cache.json漂移检测缓存
docs/04_BDD/BDD-NN_{slug}/

Section File Structure

章节文件结构

PatternExamplePurpose
Section-Only
BDD-01.1_authentication.feature
Standard section
Subsection
BDD-01.2.01_session_creation.feature
Large section split
Aggregator
BDD-01.2.00_session.feature
Organizing subsections (@redirect)
格式示例用途
仅章节
BDD-01.1_authentication.feature
标准章节
子章节
BDD-01.2.01_session_creation.feature
大章节拆分
聚合器
BDD-01.2.00_session.feature
组织子章节(@redirect)

Validation Reports

验证报告

ReportPurposeLocation
bdd_validation_report.jsonValidation results
tmp/
adr_ready_score.jsonADR-Ready breakdown
tmp/
autopilot_log.mdExecution log
tmp/

报告用途位置
bdd_validation_report.json验证结果
tmp/
adr_ready_score.jsonADR就绪评分细分
tmp/
autopilot_log.md执行日志
tmp/

Error Handling

错误处理

Error Categories

错误类别

CategoryHandlingExample
EARS MissingAbort with messageNo EARS document found
BDD-Ready Below 90%Auto-fix EARS, retryEARS score at 85%
Validation FailureAuto-fix, retryMissing required section
ADR-Ready Below 90%Enhance scenarios, retryScore at 88%
Max Retries ExceededFlag for manual reviewPersistent validation errors
类别处理方式示例
EARS缺失终止并提示信息未找到EARS文档
BDD就绪评分低于90%自动修复EARS,重试EARS评分为85%
验证失败自动修复,重试缺失必填章节
ADR就绪评分低于90%增强场景,重试评分为88%
超过最大重试次数标记为需要手动审核持续的验证错误

Recovery Actions

恢复操作

python
def handle_error(error_type: str, context: dict) -> Action:
    match error_type:
        case "EARS_MISSING":
            return Action.ABORT_WITH_MESSAGE
        case "BDD_READY_LOW":
            return Action.AUTO_FIX_EARS
        case "VALIDATION_FAILURE":
            if context["retry_count"] < 3:
                return Action.AUTO_FIX_RETRY
            return Action.FLAG_MANUAL_REVIEW
        case "ADR_READY_LOW":
            return Action.ENHANCE_SCENARIOS
        case _:
            return Action.FLAG_MANUAL_REVIEW

python
def handle_error(error_type: str, context: dict) -> Action:
    match error_type:
        case "EARS_MISSING":
            return Action.ABORT_WITH_MESSAGE
        case "BDD_READY_LOW":
            return Action.AUTO_FIX_EARS
        case "VALIDATION_FAILURE":
            if context["retry_count"] < 3:
                return Action.AUTO_FIX_RETRY
            return Action.FLAG_MANUAL_REVIEW
        case "ADR_READY_LOW":
            return Action.ENHANCE_SCENARIOS
        case _:
            return Action.FLAG_MANUAL_REVIEW

Integration Points

集成点

Pre-Execution Hooks

执行前钩子

bash
undefined
bash
undefined

Hook: pre_bdd_generation

钩子: pre_bdd_generation

Runs before BDD generation starts

BDD生成开始前运行

./hooks/pre_bdd_generation.sh
./hooks/pre_bdd_generation.sh

Example: Validate EARS exists and is ready

示例: 验证EARS存在且就绪

if [ ! -d "docs/03_EARS/EARS-01_*" ]; then echo "ERROR: EARS-01 required" exit 1 fi
undefined
if [ ! -d "docs/03_EARS/EARS-01_*" ]; then echo "错误: 需要EARS-01" exit 1 fi
undefined

Post-Execution Hooks

执行后钩子

bash
undefined
bash
undefined

Hook: post_bdd_generation

钩子: post_bdd_generation

Runs after BDD generation completes

BDD生成完成后运行

./hooks/post_bdd_generation.sh
./hooks/post_bdd_generation.sh

Example: Trigger ADR autopilot for validated BDD

示例: 为已验证的BDD触发ADR自动生成器

if [ "$BDD_VALIDATED" = "true" ]; then python ai_dev_flow/scripts/adr_autopilot.py
--bdd "$BDD_PATH"
--output docs/05_ADR/ fi
undefined
if [ "$BDD_VALIDATED" = "true" ]; then python ai_dev_flow/scripts/adr_autopilot.py
--bdd "$BDD_PATH"
--output docs/05_ADR/ fi
undefined

CI/CD Integration

CI/CD集成

yaml
undefined
yaml
undefined

.github/workflows/bdd_autopilot.yml

.github/workflows/bdd_autopilot.yml

name: BDD Autopilot
on: push: paths: - 'docs/03_EARS/**'
jobs: generate-bdd: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
  - name: Run BDD Autopilot
    run: |
      python ai_dev_flow/scripts/bdd_autopilot.py \
        --ears docs/03_EARS/ \
        --output docs/04_BDD/ \
        --validate

  - name: Upload Validation Report
    uses: actions/upload-artifact@v4
    with:
      name: bdd-validation
      path: tmp/bdd_validation_report.json

---
name: BDD自动生成器
on: push: paths: - 'docs/03_EARS/**'
jobs: generate-bdd: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
  - name: 运行BDD自动生成器
    run: |
      python ai_dev_flow/scripts/bdd_autopilot.py \
        --ears docs/03_EARS/ \
        --output docs/04_BDD/ \
        --validate

  - name: 上传验证报告
    uses: actions/upload-artifact@v4
    with:
      name: bdd-validation
      path: tmp/bdd_validation_report.json

---

Quality Gates

质量门

Phase Gates

阶段门

PhaseGateCriteria
Phase 1Input GateAt least one EARS document found
Phase 2Readiness GateEARS BDD-Ready Score >= 90%
Phase 3Generation GateAll scenario categories populated
Phase 4Validation GateADR-Ready Score >= 90%
Phase 5Review GateNo blocking issues remaining
阶段标准
阶段1输入门至少找到一个EARS文档
阶段2就绪门EARS的BDD就绪评分 >=90%
阶段3生成门所有场景类别已填充
阶段4验证门ADR就绪评分 >=90%
阶段5审核门无阻塞问题剩余

Blocking vs Non-Blocking

阻塞与非阻塞

Issue TypeBlockingAction
Missing required sectionYesMust fix before proceeding
ADR-Ready Score < 90%YesMust enhance scenarios
Invalid Gherkin syntaxYesMust correct step format
Tags in commentsYesMust move to Gherkin-native
Missing @threshold tagsNoLog warning, continue
Style/formatting issuesNoAuto-fix, continue

问题类型是否阻塞操作
缺失必填章节必须修复后继续
ADR就绪评分 <90%必须增强场景
无效Gherkin语法必须修正步骤格式
标签在注释中必须移动到Gherkin原生位置
缺失@threshold标签记录警告,继续
样式/格式问题自动修复,继续

Validation Checklist

验证检查清单

After autopilot completion:
  • All target BDD suites generated
  • Each BDD has ADR-Ready score >= 90%
  • Traceability matrix updated (
    BDD-00_TRACEABILITY_MATRIX.md
    )
  • Each BDD references upstream EARS with @ears tags
  • Each BDD references upstream PRD with @prd tags
  • Each BDD references upstream BRD with @brd tags
  • All scenarios use Given-When-Then structure
  • All quantitative values use @threshold references
  • Tags are Gherkin-native (not in comments)
  • Times include seconds (HH:MM:SS) with IANA timezone
  • All 8 scenario categories represented
  • No .feature file exceeds 500 lines
  • No Feature block exceeds 12 scenarios
  • Element IDs use BDD.NN.14.SS (scenarios), BDD.NN.15.SS (steps) format
  • Index file (BDD-NN.0_index.md) exists with section file map
  • Redirect stub exists at docs/04_BDD/ root

自动生成器完成后:
  • 所有目标BDD套件已生成
  • 每个BDD的ADR就绪评分 >=90%
  • 可追溯性矩阵已更新 (
    BDD-00_TRACEABILITY_MATRIX.md
    )
  • 每个BDD使用@ears标签引用上游EARS
  • 每个BDD使用@prd标签引用上游PRD
  • 每个BDD使用@brd标签引用上游BRD
  • 所有场景使用Given-When-Then结构
  • 所有量化值使用@threshold引用
  • 标签为Gherkin原生标签(不可在注释中)
  • 时间包含秒数(HH:MM:SS)和IANA时区
  • 覆盖所有8种场景类别
  • 无.feature文件超过500行
  • 无Feature块超过12个场景
  • 元素ID使用BDD.NN.14.SS(场景)、BDD.NN.15.SS(步骤)格式
  • 存在索引文件(BDD-NN.0_index.md),包含章节文件映射
  • docs/04_BDD/根目录存在重定向存根

Quick Reference

快速参考

InputOutputKey Metric
EARS(s)BDD(s)ADR-Ready >= 90%
Usage:
/doc-bdd-autopilot <EARS-LIST> [OPTIONS]
Common Commands:
bash
undefined
输入输出关键指标
EARS文档BDD文档ADR就绪评分 >=90%
用法:
/doc-bdd-autopilot <EARS列表> [选项]
常用命令:
bash
undefined

Single EARS

单个EARS

/doc-bdd-autopilot EARS-01
/doc-bdd-autopilot EARS-01

All EARS (automatic)

所有EARS(自动)

/doc-bdd-autopilot all --auto
/doc-bdd-autopilot all --auto

Preview only

仅预览

/doc-bdd-autopilot all --dry-run
/doc-bdd-autopilot all --dry-run

Resume after failure

从故障恢复

/doc-bdd-autopilot resume

---
/doc-bdd-autopilot resume

---

Related Resources

相关资源

Skills (Delegated)

技能(委托)

  • BDD Skill:
    .claude/skills/doc-bdd/SKILL.md
    - BDD creation rules and Gherkin syntax
  • BDD Validator Skill:
    .claude/skills/doc-bdd-validator/SKILL.md
    - Validation rules and error codes
  • EARS Validator Skill:
    .claude/skills/doc-ears-validator/SKILL.md
    - EARS BDD-Ready validation
  • Quality Advisor Skill:
    .claude/skills/quality-advisor/SKILL.md
    - Real-time quality feedback
  • Naming Standards Skill:
    .claude/skills/doc-naming/SKILL.md
    - Element ID format
  • BDD技能:
    .claude/skills/doc-bdd/SKILL.md
    - BDD创建规则和Gherkin语法
  • BDD验证器技能:
    .claude/skills/doc-bdd-validator/SKILL.md
    - 验证规则和错误代码
  • EARS验证器技能:
    .claude/skills/doc-ears-validator/SKILL.md
    - EARS BDD就绪验证
  • 质量顾问技能:
    .claude/skills/quality-advisor/SKILL.md
    - 实时质量反馈
  • 命名标准技能:
    .claude/skills/doc-naming/SKILL.md
    - 元素ID格式

Templates and Rules

模板与规则

  • BDD Template:
    ai_dev_flow/04_BDD/BDD-MVP-TEMPLATE.feature
  • Section Template:
    ai_dev_flow/04_BDD/BDD-SECTION-TEMPLATE.feature
  • Index Template:
    ai_dev_flow/04_BDD/BDD-SECTION-0-TEMPLATE.md
  • Aggregator Template:
    ai_dev_flow/04_BDD/BDD-AGGREGATOR-TEMPLATE.feature
  • BDD Schema:
    ai_dev_flow/04_BDD/BDD_SCHEMA.yaml
  • BDD Creation Rules:
    ai_dev_flow/04_BDD/BDD_CREATION_RULES.md
  • BDD Validation Rules:
    ai_dev_flow/04_BDD/BDD_VALIDATION_RULES.md
  • BDD Splitting Rules:
    ai_dev_flow/04_BDD/BDD_SPLITTING_RULES.md
  • BDD模板:
    ai_dev_flow/04_BDD/BDD-MVP-TEMPLATE.feature
  • 章节模板:
    ai_dev_flow/04_BDD/BDD-SECTION-TEMPLATE.feature
  • 索引模板:
    ai_dev_flow/04_BDD/BDD-SECTION-0-TEMPLATE.md
  • 聚合器模板:
    ai_dev_flow/04_BDD/BDD-AGGREGATOR-TEMPLATE.feature
  • BDD Schema:
    ai_dev_flow/04_BDD/BDD_SCHEMA.yaml
  • BDD创建规则:
    ai_dev_flow/04_BDD/BDD_CREATION_RULES.md
  • BDD验证规则:
    ai_dev_flow/04_BDD/BDD_VALIDATION_RULES.md
  • BDD拆分规则:
    ai_dev_flow/04_BDD/BDD_SPLITTING_RULES.md

Framework References

框架参考

  • SDD Workflow:
    ai_dev_flow/SPEC_DRIVEN_DEVELOPMENT_GUIDE.md
  • MVP Autopilot:
    ai_dev_flow/AUTOPILOT/MVP_AUTOPILOT.md
  • EARS Autopilot Skill:
    .claude/skills/doc-ears-autopilot/SKILL.md
  • ADR Autopilot Skill:
    .claude/skills/doc-adr-autopilot/SKILL.md

  • SDD工作流:
    ai_dev_flow/SPEC_DRIVEN_DEVELOPMENT_GUIDE.md
  • MVP自动生成器:
    ai_dev_flow/AUTOPILOT/MVP_AUTOPILOT.md
  • EARS自动生成器技能:
    .claude/skills/doc-ears-autopilot/SKILL.md
  • ADR自动生成器技能:
    .claude/skills/doc-adr-autopilot/SKILL.md

Review Document Standards (v2.2)

审核文档标准(v2.2)

IMPORTANT: Review reports generated by this autopilot are formal project documents.
See:
.claude/skills/REVIEW_DOCUMENT_STANDARDS.md
for complete standards.
重要: 该自动生成器生成的审核报告是正式项目文档。
参考:
.claude/skills/REVIEW_DOCUMENT_STANDARDS.md
获取完整标准。

Quick Reference

快速参考

RequirementValue
Storage LocationSame folder as reviewed BDD
File Name
BDD-NN.R_review_report.md
YAML FrontmatterMANDATORY - see shared standards
Parent ReferenceMANDATORY - link to BDD feature file
Example Location:
docs/04_BDD/
├── BDD-03_f3_observability.feature
└── BDD-03.R_review_report.md    # ← Review report stored here

要求
存储位置与被审核的BDD同一文件夹
文件名
BDD-NN.R_review_report.md
YAML前置元数据强制要求 - 参考共享标准
父文档引用强制要求 - 链接到BDD Feature文件
示例位置:
docs/04_BDD/
├── BDD-03_f3_observability.feature
└── BDD-03.R_review_report.md    # ← 审核报告存储在此处

Version History

版本历史

VersionDateChanges
2.22026-02-11Smart Document Detection: Added automatic document type recognition; Self-type input (BDD-NN) triggers review mode; Upstream-type input (EARS-NN) triggers generate-if-missing or find-and-review; Updated input patterns table with type-based actions
2.12026-02-10Review & Fix Cycle: Replaced Phase 5 (Final Review) with iterative Review -> Fix cycle using
doc-bdd-reviewer
and
doc-bdd-fixer
; Added
doc-bdd-fixer
skill dependency; Added iteration control with max 3 cycles and 90% target score; Added Review Document Standards
2.02026-02-09Added scenario type classification with 5 categories (@scenario-type:success/optional/recovery/parameterized/error); Added priority tagging (@p0-critical/@p1-high/@p2-medium/@p3-low); Added SHALL+WITHIN language support for timing constraints; Added enhanced threshold reference format (@threshold:PRD.NN.category.field); Added 5-category coverage matrix with priority distribution; Added visual score indicators; Added validation rules BDD-E050 to BDD-E055 for new features; Updated ADR-Ready Report with v2.0 compliance section; Added Review Mode for validating existing BDD documents; Added Fix Mode for auto-repairing BDD documents
1.02026-02-08Initial skill creation with 5-phase workflow; Integrated doc-naming, doc-bdd, doc-bdd-validator, quality-advisor skills; Added scenario category reference (8 categories); Added section-based structure requirements; Added Gherkin-native tag enforcement
版本日期变更
2.22026-02-11智能文档检测: 添加自动文档类型识别;自身类型输入(BDD-NN)触发审核模式;上游类型输入(EARS-NN)触发缺失则生成或查找并审核;更新输入格式表格,添加基于类型的操作
2.12026-02-10审核与修复循环: 将阶段5(最终审核)替换为迭代式审核→修复循环,使用
doc-bdd-reviewer
doc-bdd-fixer
;添加
doc-bdd-fixer
技能依赖;添加迭代控制,最多3次循环,目标评分90%;添加审核文档标准
2.02026-02-09添加场景类型分类,包含5个类别(@scenario-type:success/optional/recovery/parameterized/error);添加优先级标签(@p0-critical/@p1-high/@p2-medium/@p3-low);添加SHALL+WITHIN语言支持时间约束;添加增强的阈值引用格式(@threshold:PRD.NN.category.field);添加5类别覆盖矩阵和优先级分布;添加可视化评分指示器;添加新功能的验证规则BDD-E050至BDD-E055;更新ADR就绪报告,添加v2.0合规性章节;添加审核模式以验证现有BDD文档;添加修复模式以自动修复BDD文档
1.02026-02-08初始技能创建,包含5阶段工作流;集成doc-naming、doc-bdd、doc-bdd-validator、quality-advisor技能;添加场景类别参考(8个类别);添加基于章节的结构要求;添加Gherkin原生标签强制要求