doc-bdd-autopilot
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesedoc-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:
| Skill | Purpose | Phase |
|---|---|---|
| Element ID format (BDD.NN.14.SS, BDD.NN.15.SS), scenario/step codes | All Phases |
| Validate EARS BDD-Ready score | Phase 2: EARS Readiness |
| BDD creation rules, Gherkin syntax, section-based structure | Phase 3: BDD Generation |
| Real-time quality feedback during BDD generation | Phase 3: BDD Generation |
| Validate BDD structure, content, ADR-Ready score | Phase 4: BDD Validation |
| Content review, link validation, quality scoring | Phase 5: Review |
| Apply fixes from review report, create missing files | Phase 5: Fix |
Delegation Principle: The autopilot orchestrates workflow but delegates:
- BDD structure/content rules -> skill
doc-bdd - Real-time quality feedback -> skill
quality-advisor - BDD validation logic -> skill
doc-bdd-validator - Content review and scoring -> skill
doc-bdd-reviewer - Issue resolution and fixes -> skill
doc-bdd-fixer - EARS validation logic -> skill
doc-ears-validator - Element ID standards -> skill
doc-naming
该自动生成器编排以下技能:
| 技能 | 用途 | 阶段 |
|---|---|---|
| 元素ID格式(BDD.NN.14.SS, BDD.NN.15.SS)、场景/步骤编码 | 所有阶段 |
| 验证EARS的BDD就绪评分 | 阶段2:EARS就绪检查 |
| BDD创建规则、Gherkin语法、基于章节的结构 | 阶段3:BDD生成 |
| BDD生成过程中的实时质量反馈 | 阶段3:BDD生成 |
| 验证BDD结构、内容、ADR就绪评分 | 阶段4:BDD验证 |
| 内容审核、链接验证、质量评分 | 阶段5:审核 |
| 应用审核报告中的修复建议、创建缺失文件 | 阶段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
输入类型识别
| Input | Detected As | Action |
|---|---|---|
| Self type | Review existing BDD document |
| Upstream type | Generate if missing, review if exists |
| 输入 | 识别类型 | 操作 |
|---|---|---|
| 自身类型 | 审核现有BDD文档 |
| 上游类型 | 缺失则生成,存在则审核 |
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
undefinedbash
undefinedCheck for nested folder structure (mandatory)
检查嵌套文件夹结构(必填)
ls docs/04_BDD/BDD-{NN}_*/
undefinedls docs/04_BDD/BDD-{NN}_*/
undefinedExamples
示例
bash
undefinedbash
undefinedReview 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
undefinedAction 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-reviewerWhen to Use This Skill
何时使用该技能
Use when:
doc-bdd-autopilot- 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 directly)
doc-bdd - 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 Section | BDD Content | Mapping |
|---|---|---|
| Event-Driven Statements (001-099) | User action scenarios | Success/Error scenarios |
| State-Driven Statements (101-199) | System state scenarios | State validation scenarios |
| Unwanted Behavior Statements (201-299) | Error handling scenarios | Negative/Recovery scenarios |
| Ubiquitous Statements (401-499) | Cross-cutting scenarios | Quality attribute scenarios |
| Quality Attributes Section | Performance/Security tests | Quality attribute scenarios |
| Threshold References | Parameterized values | @threshold tags in steps |
Analysis Process:
bash
undefined分析EARS文档,提取用于BDD场景生成的需求。
输入来源(来自EARS):
| EARS章节 | BDD内容 | 映射关系 |
|---|---|---|
| 事件驱动语句(001-099) | 用户操作场景 | 成功/错误场景 |
| 状态驱动语句(101-199) | 系统状态场景 | 状态验证场景 |
| 异常行为语句(201-299) | 错误处理场景 | 负面/恢复场景 |
| 通用语句(401-499) | 跨领域场景 | 质量属性场景 |
| 质量属性章节 | 性能/安全测试 | 质量属性场景 |
| 阈值引用 | 参数化值 | 步骤中的@threshold标签 |
分析流程:
bash
undefinedCheck 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 fromskill. See:doc-ears-validatorfor complete EARS validation rules..claude/skills/doc-ears-validator/SKILL.md
BDD-Ready Scoring Criteria (100%):
| Category | Weight | Criteria |
|---|---|---|
| Requirements Clarity | 40% | EARS syntax compliance, statement atomicity, quantifiable constraints |
| Testability | 35% | BDD translation readiness, observable verification, edge cases specified |
| Quality Attributes | 15% | Performance targets, security requirements, reliability targets |
| Strategic Alignment | 10% | Business objective links, implementation paths |
Minimum Score: 90% (configurable)
Auto-Fix Actions:
| Issue | Auto-Fix Action |
|---|---|
| Missing WHEN-THE-SHALL syntax | Reformat statement |
| Non-atomic statements | Split into multiple statements |
| Missing quantifiable constraints | Add placeholder constraints |
| Missing edge case specifications | Flag for manual review |
| Incomplete quality attributes | Add 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获取完整的EARS验证规则。.claude/skills/doc-ears-validator/SKILL.md
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-fixPhase 3: BDD Generation
阶段3: BDD生成
Generate BDD scenarios from validated EARS with real-time quality feedback.
Skill Delegation: This phase follows rules defined inskill. See:doc-bddfor complete BDD creation guidance..claude/skills/doc-bdd/SKILL.mdQuality Guidance: Usesskill for real-time feedback during generation. See:quality-advisorfor quality monitoring..claude/skills/quality-advisor/SKILL.md
Generation Process:
-
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 -
Create Suite Directory:bash
mkdir -p docs/04_BDD/BDD-NN_{slug}/ -
Plan Section Structure:Section Planning Based on EARS Scope:
EARS Statement Count BDD Structure Rationale 1-10 statements 2-3 sections Compact coverage 11-30 statements 4-8 sections Standard grouping 31+ statements 9+ sections with subsections Complex domain -
Generate Index File ():
BDD-NN.0_index.mdField Value BDD ID BDD-NN Version 0.1.0 Date Created Current date (YYYY-MM-DD) Last Updated Current date (YYYY-MM-DD) Status Draft Priority From EARS priority Source Document @ears: EARS.NN.25.SS (single value) ADR-Ready Score Calculated after generation -
Generate Feature Files by Section:Section File Pattern:
BDD-NN.S_{section_name}.featureSubsection Pattern (if >500 lines):BDD-NN.S.SS_{subsection_name}.feature -
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_latencyError 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 returnedEdge 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_throughputIntegration 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.maxFailure 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 -
Real-Time Quality Feedback (viaskill):
quality-advisor- 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
-
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 NameLayer 4 Cumulative Tag Requirement: @brd, @prd, @ears (3+ tags) -
Generate Redirect Stub:bash
# Create redirect stub at docs/04_BDD/ root touch docs/04_BDD/BDD-NN_{slug}.featureRedirect 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 -
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获取完整的BDD创建指南。.claude/skills/doc-bdd/SKILL.md质量指导: 使用技能在生成过程中提供实时反馈。 参考:quality-advisor获取质量监控相关内容。.claude/skills/quality-advisor/SKILL.md
生成流程:
-
预留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 -
创建套件目录:bash
mkdir -p docs/04_BDD/BDD-NN_{slug}/ -
规划章节结构:基于EARS范围的章节规划:
EARS语句数量 BDD结构 理由 1-10条语句 2-3个章节 紧凑覆盖 11-30条语句 4-8个章节 标准分组 31+条语句 9+个章节(含子章节) 复杂领域 -
生成索引文件 ():
BDD-NN.0_index.md字段 值 BDD ID BDD-NN 版本 0.1.0 创建日期 当前日期(YYYY-MM-DD) 最后更新日期 当前日期(YYYY-MM-DD) 状态 草稿 优先级 来自EARS优先级 源文档 @ears: EARS.NN.25.SS(单个值) ADR就绪评分 生成后计算 -
按章节生成Feature文件:章节文件格式:
BDD-NN.S_{section_name}.feature子章节格式(若超过500行):BDD-NN.S.SS_{subsection_name}.feature -
按类别生成场景:成功路径场景 (@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 -
实时质量反馈(通过技能):
quality-advisor- 在场景生成过程中监控Gherkin语法合规性
- 检测反模式(缺失Given/When/Then、硬编码值)
- 验证@threshold标签格式和引用
- 检查元素ID格式合规性(BDD.NN.14.SS, BDD.NN.15.SS)
- 提前标记问题以减少生成后的返工
-
添加累积可追溯性标签:每个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个标签) -
生成重定向存根: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 -
更新索引文件:
- 列出所有章节文件及其场景数量和行数
- 添加将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 fromskill. See:doc-bdd-validatorfor complete validation rules..claude/skills/doc-bdd-validator/SKILL.md
Validation Command:
bash
python ai_dev_flow/scripts/validate_bdd.py docs/04_BDD/BDD-NN_{slug}/ --verboseValidation Checks:
| Check | Requirement | Error Code |
|---|---|---|
| Section Structure | Index file exists, valid patterns | CHECK 9.1-9.7 |
| Document Control | All required fields in index | BDD-E001 to BDD-E009 |
| Gherkin Syntax | Valid Given-When-Then structure | BDD-E010, BDD-E011 |
| Element ID Format | BDD.NN.14.SS (scenarios), BDD.NN.15.SS (steps) | BDD-E008 |
| Tags Placement | Gherkin-native, not in comments | BDD-E041 |
| Cumulative Tags | @brd, @prd, @ears present | BDD-W002 |
| ADR-Ready Score | >= 90% | BDD-W003 |
| File Size | < 500 lines per .feature file | CHECK 9.4 |
| Scenario Count | <= 12 per Feature block | CHECK 9.4 |
| Scenario Type Tag | @scenario-type present on each scenario | BDD-E050 |
| Priority Tag | @p0/@p1/@p2/@p3 present on each scenario | BDD-E051 |
| Timing Constraint Format | WITHIN @threshold format for timed ops | BDD-E052 |
| 5-Category Coverage | success, optional, recovery, parameterized, error | BDD-E053 |
| Threshold Format | @threshold:PRD.NN.category.field syntax | BDD-E054 |
| WITHIN Constraint | Required for performance scenarios | BDD-E055 |
Auto-Fix Actions:
| Issue | Auto-Fix Action |
|---|---|
| Missing Given-When-Then | Add template step structure |
| Invalid element ID format | Convert to BDD.NN.14.SS format |
| Tags in comments | Move to Gherkin-native position |
| Missing @threshold tags | Add placeholder tags |
| Hardcoded numeric values | Replace with @threshold references |
| Missing ADR-Ready Score | Calculate 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 reviewBDD生成后,验证结构和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、@ears | BDD-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 --> E5.1 Initial Review
5.1 初始审核
Run to identify issues.
doc-bdd-reviewerbash
/doc-bdd-reviewer BDD-NNOutput:
BDD-NN.R_review_report_v001.mdReview Checks:
-
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
-
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
-
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)
-
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-reviewerbash
/doc-bdd-reviewer BDD-NN输出:
BDD-NN.R_review_report_v001.md审核检查项:
-
Gherkin语法合规性:
- 所有场景使用Given-When-Then结构
- 无模糊语言(如"快速"、"高效"、"用户友好")
- 所有步骤都是原子且可执行的
- 背景步骤设置合理
-
阈值引用一致性:
- 所有@threshold标签引用有效的PRD阈值
- 阈值值与PRD源一致
- 无孤立的阈值引用
- 步骤中无硬编码数值
-
累积标签验证:
- @brd标签引用有效的BRD元素
- @prd标签引用有效的PRD元素
- @ears标签引用有效的EARS元素
- 标签为Gherkin原生标签(不可在注释中)
-
场景覆盖率:
- 涵盖所有8种场景类别
- 每个EARS事件驱动语句都有成功路径场景
- 每个EARS异常行为语句都有错误场景
- 边界条件有边缘情况场景
- 参数化需求有数据驱动场景
5.2 Fix Cycle
5.2 修复循环
If review score < 90%, invoke .
doc-bdd-fixerbash
/doc-bdd-fixer BDD-NN --revalidateFix Categories:
| Category | Fixes Applied |
|---|---|
| Missing Files | Create index, redirect stubs |
| Broken Links | Update paths, create targets |
| Element IDs | Convert legacy patterns to BDD.NN.14.SS/BDD.NN.15.SS |
| Tags | Move comment tags to Gherkin-native, add missing tags |
| Thresholds | Replace hardcoded values with @threshold references |
| v2.0 Compliance | Add @scenario-type, @priority, WITHIN constraints |
Output:
BDD-NN.F_fix_report_v001.md若审核评分 < 90%,调用。
doc-bdd-fixerbash
/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.md5.3 Re-Review
5.3 重新审核
After fixes, automatically re-run reviewer.
bash
/doc-bdd-reviewer BDD-NNOutput:
BDD-NN.R_review_report_v002.md修复后自动重新运行审核。
bash
/doc-bdd-reviewer BDD-NN输出:
BDD-NN.R_review_report_v002.md5.4 Iteration Control
5.4 迭代控制
| Parameter | Default | Description |
|---|---|---|
| 3 | Maximum fix-review cycles |
| 90 | Minimum passing score |
| false | Stop 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)| 参数 | 默认值 | 描述 |
|---|---|---|
| 3 | 最大修复-审核循环次数 |
| 90 | 最低通过评分 |
| 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:
-
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 -
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
通过修复循环后:
-
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生成 -
可追溯性矩阵更新: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.p95Coverage 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_ttlCoverage 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 loggedCoverage 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-authenticateCoverage 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_timeoutCoverage 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 timeoutCoverage 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_timeCoverage 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 tag for classification:
@scenario-type| Tag | Purpose | Priority Default | Coverage Requirement |
|---|---|---|---|
| Primary happy path | @p0-critical | Required for all EARS event-driven |
| Alternative workflows | @p2-medium | Optional parameters |
| Failure recovery | @p1-high | Resilience patterns |
| Data-driven | @p2-medium | Multi-value validation |
| Negative cases | @p1-high | Error handling |
所有场景必须包含标签用于分类:
@scenario-type| 标签 | 用途 | 默认优先级 | 覆盖要求 |
|---|---|---|---|
| 主要正常路径 | @p0-critical | 所有EARS事件驱动需求必填 |
| 备选工作流 | @p2-medium | 可选参数 |
| 故障恢复 | @p1-high | 弹性模式 |
| 数据驱动 | @p2-medium | 多值验证 |
| 负面场景 | @p1-high | 错误处理 |
Priority Classification
优先级分类
All scenarios MUST include a priority tag:
| Tag | Definition | Impact |
|---|---|---|
| MVP blocking - must pass for release | Blocks deployment |
| Sprint required - must pass within sprint | Sprint scope |
| Next iteration - important but deferrable | Next planning cycle |
| Backlog - nice to have | Future consideration |
所有场景必须包含优先级标签:
| 标签 | 定义 | 影响 |
|---|---|---|
| 阻塞MVP - 发布前必须通过 | 阻塞部署 |
| 迭代内必须完成 - 迭代内必须通过 | 迭代范围 |
| 下一个迭代 - 重要但可推迟 | 下一个规划周期 |
| 待办项 - 锦上添花 | 未来考虑 |
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_latencyWITHIN Constraint Rules:
- All performance-related scenarios MUST include WITHIN clauses
- WITHIN values MUST reference threshold registry (no hardcoded values)
- 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_latencyWITHIN约束规则:
- 所有性能相关场景必须包含WITHIN子句
- WITHIN值必须引用阈值注册表(不可硬编码)
- 格式:
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类别覆盖矩阵
| Category | Minimum Scenarios | Priority Distribution |
|---|---|---|
| Success | 1 per EARS event-driven | 100% @p0-critical or @p1-high |
| Error | 1 per EARS unwanted behavior | 80% @p1-high, 20% @p2-medium |
| Recovery | 1 per circuit breaker pattern | 100% @p1-high |
| Parameterized | 1 per multi-value requirement | 50% @p1-high, 50% @p2-medium |
| Optional | 1 per optional parameter | 100% @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
undefinedExample: 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
--ears docs/03_EARS/EARS-01_f1_iam/
--output docs/04_BDD/
--id 01
--slug f1_iam_scenarios
undefinedpython 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
--ears docs/03_EARS/EARS-01_f1_iam/
--output docs/04_BDD/
--id 01
--slug f1_iam_scenarios
undefinedBatch Mode
批量模式
Generate BDD from multiple EARS in sequence.
bash
undefined从多个EARS依次生成BDD。
bash
undefinedExample: 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 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: truepython ai_dev_flow/scripts/bdd_autopilot.py
--batch config/bdd_batch.yaml
--output docs/04_BDD/
--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: trueDry 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-runReview 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
undefinedReview single BDD suite
审核单个BDD套件
python ai_dev_flow/scripts/bdd_autopilot.py
--bdd docs/04_BDD/BDD-01_f1_iam/
--mode review
--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
--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
--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 --> KReview Report Structure:
markdown
undefinedpython ai_dev_flow/scripts/bdd_autopilot.py
--bdd docs/04_BDD/
--mode review
--output-report tmp/bdd_review_report.md
--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
undefinedBDD 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
评分细分
| Category | Score | Status |
|---|---|---|
| Scenario Completeness | 32/35 | 🟡 |
| Testability | 28/30 | ✅ |
| Architecture Requirements | 20/25 | 🟡 |
| Business Validation | 7/10 | ❌ |
| 类别 | 评分 | 状态 |
|---|---|---|
| 场景完整性 | 32/35 | 🟡 |
| 可测试性 | 28/30 | ✅ |
| 架构需求 | 20/25 | 🟡 |
| 业务验证 | 7/10 | ❌ |
v2.0 Compliance
v2.0合规性
| Check | Status | Details |
|---|---|---|
| Scenario Type Tags | ❌ | 5 scenarios missing @scenario-type |
| Priority Tags | 🟡 | 3 scenarios missing priority |
| SHALL+WITHIN Language | ❌ | 8 timed scenarios lack WITHIN |
| 5-Category Coverage | ✅ | All categories present |
| Threshold Format | 🟡 | 2 hardcoded values found |
| 检查项 | 状态 | 详情 |
|---|---|---|
| 场景类型标签 | ❌ | 5个场景缺失@scenario-type |
| 优先级标签 | 🟡 | 3个场景缺失优先级 |
| SHALL+WITHIN语言 | ❌ | 8个定时场景缺少WITHIN |
| 5类别覆盖 | ✅ | 所有类别都已覆盖 |
| 阈值格式 | 🟡 | 发现2个硬编码值 |
Auto-Fixable Issues
可自动修复的问题
| # | Issue | Location | Fix Action |
|---|---|---|---|
| 1 | Missing @scenario-type tag | BDD-01.1:L45 | Add @scenario-type:success |
| 2 | Hardcoded timeout value | BDD-01.2:L78 | Replace with @threshold |
| ... | ... | ... | ... |
| # | 问题 | 位置 | 修复操作 |
|---|---|---|---|
| 1 | 缺失@scenario-type标签 | BDD-01.1:L45 | 添加@scenario-type:success |
| 2 | 硬编码超时值 | BDD-01.2:L78 | 替换为@threshold |
| ... | ... | ... | ... |
Manual Review Required
需要手动审核的项
| # | Issue | Location | Reason |
|---|---|---|---|
| 1 | Ambiguous step definition | BDD-01.3:L102 | Requires domain knowledge |
| 2 | Missing edge case scenario | BDD-01.1 | Content decision needed |
| ... | ... | ... | ... |
| # | 问题 | 位置 | 原因 |
|---|---|---|---|
| 1 | 步骤定义模糊 | BDD-01.3:L102 | 需要领域知识 |
| 2 | 缺失边缘情况场景 | BDD-01.1 | 需要内容决策 |
| ... | ... | ... | ... |
Recommendations
建议
- Run fix mode to address 8 auto-fixable issues
- Review and update 4 items requiring manual attention
- 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- 运行修复模式解决8个可自动修复的问题
- 审核并更新4个需要手动处理的项
- 添加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: 0Fix 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
undefinedFix single BDD suite
修复单个BDD套件
python ai_dev_flow/scripts/bdd_autopilot.py
--bdd docs/04_BDD/BDD-01_f1_iam/
--mode fix
--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
--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
--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
--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"
--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"
--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
--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:
| Category | Issue | Auto-Fix Action | Preserves Content |
|---|---|---|---|
| Structure | Missing index file | Generate from existing sections | ✅ |
| Structure | Missing redirect stub | Create redirect stub | ✅ |
| Tags | Missing @scenario-type | Add based on scenario content analysis | ✅ |
| Tags | Missing @priority | Add default @p2-medium | ✅ |
| Tags | Tags in comments | Move to Gherkin-native position | ✅ |
| Tags | Missing cumulative tags | Add with placeholder references | ✅ |
| Thresholds | Hardcoded numeric values | Replace with @threshold:PRD.NN.xxx | ✅ |
| Thresholds | Invalid threshold format | Convert to @threshold:PRD.NN.category.field | ✅ |
| Syntax | Missing Given/When/Then | Flag for manual (content needed) | N/A |
| Syntax | Vague language | Suggest replacements in report | ✅ |
| v2.0 | Missing WITHIN clause | Add WITHIN @threshold for timed ops | ✅ |
| v2.0 | Missing SHALL language | Convert "should" to "SHALL" | ✅ |
Content Preservation Rules:
- Never delete existing scenario content
- Never modify step definitions (Given/When/Then text)
- Never change Examples table data
- Only add missing tags and metadata
- Only replace hardcoded values with threshold references
- Backup first if flag is set
--backup
Fix Report Structure:
markdown
undefinedpython ai_dev_flow/scripts/bdd_autopilot.py
--bdd docs/04_BDD/BDD-01_f1_iam/
--mode fix
--dry-run
--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" | ✅ |
内容保留规则:
- 绝不删除现有场景内容
- 绝不修改步骤定义(Given/When/Then文本)
- 绝不修改Examples表格数据
- 仅添加缺失的标签和元数据
- 仅替换硬编码值为阈值引用
- 若设置标志,先备份
--backup
修复报告结构:
markdown
undefinedBDD 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
应用的修复
| # | Issue | Location | Fix Applied |
|---|---|---|---|
| 1 | Missing @scenario-type | BDD-01.1:L45 | Added @scenario-type:success |
| 2 | Hardcoded timeout | BDD-01.2:L78 | Replaced with @threshold:PRD.01.timeout.api.max |
| 3 | Tags in comments | BDD-01.3:L12 | Moved to Gherkin-native position |
| ... | ... | ... | ... |
| # | 问题 | 位置 | 应用的修复 |
|---|---|---|---|
| 1 | 缺失@scenario-type | BDD-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)
剩余问题(需要手动审核)
| # | Issue | Location | Reason |
|---|---|---|---|
| 1 | Ambiguous step | BDD-01.3:L102 | Requires domain knowledge |
| ... | ... | ... | ... |
| # | 问题 | 位置 | 原因 |
|---|---|---|---|
| 1 | 步骤模糊 | BDD-01.3:L102 | 需要领域知识 |
| ... | ... | ... | ... |
Next Steps
下一步
- Review manually flagged items
- Re-run validation to confirm score
- 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: 3Command Line Options (Review/Fix):
| Option | Mode | Default | Description |
|---|---|---|---|
| Review | - | Run review mode only |
| Fix | - | Run fix mode |
| Both | auto | Report output path |
| Fix | true | Create backup before fixing |
| Fix | all | Comma-separated fix categories |
| Fix | false | Preview fixes without applying |
| Fix | false | Extra cautious preservation |
| Fix | 0 | Minimum score improvement required |
- 审核标记为手动处理的项
- 重新运行验证以确认评分
- 若满意则提交更改
**修复配置**:
```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命令行选项(审核/修复):
| 选项 | 模式 | 默认值 | 描述 |
|---|---|---|---|
| 审核 | - | 仅运行审核模式 |
| 修复 | - | 运行修复模式 |
| 两者 | 自动 | 报告输出路径 |
| 修复 | true | 修复前创建备份 |
| 修复 | 全部 | 逗号分隔的修复类别 |
| 修复 | false | 预览修复但不应用 |
| 修复 | false | 额外谨慎的内容保留 |
| 修复 | 0 | 要求的最低评分提升 |
Configuration
配置
Default Configuration
默认配置
yaml
undefinedyaml
undefinedconfig/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"
undefinedbdd_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"
undefinedCommand Line Options
命令行选项
| Option | Default | Description |
|---|---|---|
| 90 | Minimum BDD-Ready score (EARS) |
| 90 | Minimum ADR-Ready score (BDD) |
| false | Disable auto-fix (manual only) |
| false | Continue if one EARS fails |
| false | Preview execution plan only |
| false | Skip final review phase |
| true | Require all 8 scenario categories |
| 选项 | 默认值 | 描述 |
|---|---|---|
| 90 | 最低BDD就绪评分(EARS) |
| 90 | 最低ADR就绪评分(BDD) |
| false | 禁用自动修复(仅手动) |
| false | 若一个EARS失败则继续 |
| false | 仅预览执行计划 |
| false | 跳过最终审核阶段 |
| 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:
- Chunk Formation: Group EARS documents into chunks of maximum 3 at a time
- Sequential Chunk Processing: Process one chunk at a time, completing all BDDs in a chunk before starting the next
- Context Pause: After completing each chunk, provide a summary and pause for user acknowledgment
- 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 → CompleteChunk 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个文档
分块规则:
- 块形成: 将EARS文档分组为最多3个一组的块
- 块顺序处理: 一次处理一个块,完成一个块中的所有BDD后再开始下一个块
- 上下文暂停: 完成每个块后,提供摘要并暂停等待用户确认
- 进度跟踪: 显示块进度(例如:"块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 (). This keeps feature files and companion files (review reports, fix reports, drift cache) organized together.
BDD-NN_{slug}/| File | Purpose | Location |
|---|---|---|
| BDD-NN_{slug}/ | BDD suite folder (ALWAYS created) | |
| BDD-NN.0_index.md | Suite index | |
| BDD-NN.S_{section}.feature | Section files | |
| BDD-NN_{slug}.feature | Redirect stub | |
| BDD-NN.R_review_report_v{VVV}.md | Review report | |
| BDD-NN.F_fix_report_v{VVV}.md | Fix report | |
| .drift_cache.json | Drift detection cache | |
所有BDD套件使用嵌套文件夹 ()。这样可以将Feature文件和配套文件(审核报告、修复报告、漂移缓存)组织在一起。
BDD-NN_{slug}/| 文件 | 用途 | 位置 |
|---|---|---|
| BDD-NN_{slug}/ | BDD套件文件夹(始终创建) | |
| BDD-NN.0_index.md | 套件索引 | |
| BDD-NN.S_{section}.feature | 章节文件 | |
| BDD-NN_{slug}.feature | 重定向存根 | |
| BDD-NN.R_review_report_v{VVV}.md | 审核报告 | |
| BDD-NN.F_fix_report_v{VVV}.md | 修复报告 | |
| .drift_cache.json | 漂移检测缓存 | |
Section File Structure
章节文件结构
| Pattern | Example | Purpose |
|---|---|---|
| Section-Only | | Standard section |
| Subsection | | Large section split |
| Aggregator | | Organizing subsections (@redirect) |
| 格式 | 示例 | 用途 |
|---|---|---|
| 仅章节 | | 标准章节 |
| 子章节 | | 大章节拆分 |
| 聚合器 | | 组织子章节(@redirect) |
Validation Reports
验证报告
| Report | Purpose | Location |
|---|---|---|
| bdd_validation_report.json | Validation results | |
| adr_ready_score.json | ADR-Ready breakdown | |
| autopilot_log.md | Execution log | |
| 报告 | 用途 | 位置 |
|---|---|---|
| bdd_validation_report.json | 验证结果 | |
| adr_ready_score.json | ADR就绪评分细分 | |
| autopilot_log.md | 执行日志 | |
Error Handling
错误处理
Error Categories
错误类别
| Category | Handling | Example |
|---|---|---|
| EARS Missing | Abort with message | No EARS document found |
| BDD-Ready Below 90% | Auto-fix EARS, retry | EARS score at 85% |
| Validation Failure | Auto-fix, retry | Missing required section |
| ADR-Ready Below 90% | Enhance scenarios, retry | Score at 88% |
| Max Retries Exceeded | Flag for manual review | Persistent 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_REVIEWpython
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_REVIEWIntegration Points
集成点
Pre-Execution Hooks
执行前钩子
bash
undefinedbash
undefinedHook: 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
undefinedif [ ! -d "docs/03_EARS/EARS-01_*" ]; then
echo "错误: 需要EARS-01"
exit 1
fi
undefinedPost-Execution Hooks
执行后钩子
bash
undefinedbash
undefinedHook: 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
--bdd "$BDD_PATH"
--output docs/05_ADR/ fi
undefinedif [ "$BDD_VALIDATED" = "true" ]; then
python ai_dev_flow/scripts/adr_autopilot.py
--bdd "$BDD_PATH"
--output docs/05_ADR/ fi
--bdd "$BDD_PATH"
--output docs/05_ADR/ fi
undefinedCI/CD Integration
CI/CD集成
yaml
undefinedyaml
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
阶段门
| Phase | Gate | Criteria |
|---|---|---|
| Phase 1 | Input Gate | At least one EARS document found |
| Phase 2 | Readiness Gate | EARS BDD-Ready Score >= 90% |
| Phase 3 | Generation Gate | All scenario categories populated |
| Phase 4 | Validation Gate | ADR-Ready Score >= 90% |
| Phase 5 | Review Gate | No blocking issues remaining |
| 阶段 | 门 | 标准 |
|---|---|---|
| 阶段1 | 输入门 | 至少找到一个EARS文档 |
| 阶段2 | 就绪门 | EARS的BDD就绪评分 >=90% |
| 阶段3 | 生成门 | 所有场景类别已填充 |
| 阶段4 | 验证门 | ADR就绪评分 >=90% |
| 阶段5 | 审核门 | 无阻塞问题剩余 |
Blocking vs Non-Blocking
阻塞与非阻塞
| Issue Type | Blocking | Action |
|---|---|---|
| Missing required section | Yes | Must fix before proceeding |
| ADR-Ready Score < 90% | Yes | Must enhance scenarios |
| Invalid Gherkin syntax | Yes | Must correct step format |
| Tags in comments | Yes | Must move to Gherkin-native |
| Missing @threshold tags | No | Log warning, continue |
| Style/formatting issues | No | Auto-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
快速参考
| Input | Output | Key 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
undefinedSingle 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: - BDD creation rules and Gherkin syntax
.claude/skills/doc-bdd/SKILL.md - BDD Validator Skill: - Validation rules and error codes
.claude/skills/doc-bdd-validator/SKILL.md - EARS Validator Skill: - EARS BDD-Ready validation
.claude/skills/doc-ears-validator/SKILL.md - Quality Advisor Skill: - Real-time quality feedback
.claude/skills/quality-advisor/SKILL.md - Naming Standards Skill: - Element ID format
.claude/skills/doc-naming/SKILL.md
- BDD技能: - BDD创建规则和Gherkin语法
.claude/skills/doc-bdd/SKILL.md - BDD验证器技能: - 验证规则和错误代码
.claude/skills/doc-bdd-validator/SKILL.md - EARS验证器技能: - EARS BDD就绪验证
.claude/skills/doc-ears-validator/SKILL.md - 质量顾问技能: - 实时质量反馈
.claude/skills/quality-advisor/SKILL.md - 命名标准技能: - 元素ID格式
.claude/skills/doc-naming/SKILL.md
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: for complete standards.
.claude/skills/REVIEW_DOCUMENT_STANDARDS.md重要: 该自动生成器生成的审核报告是正式项目文档。
参考: 获取完整标准。
.claude/skills/REVIEW_DOCUMENT_STANDARDS.mdQuick Reference
快速参考
| Requirement | Value |
|---|---|
| Storage Location | Same folder as reviewed BDD |
| File Name | |
| YAML Frontmatter | MANDATORY - see shared standards |
| Parent Reference | MANDATORY - 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同一文件夹 |
| 文件名 | |
| YAML前置元数据 | 强制要求 - 参考共享标准 |
| 父文档引用 | 强制要求 - 链接到BDD Feature文件 |
示例位置:
docs/04_BDD/
├── BDD-03_f3_observability.feature
└── BDD-03.R_review_report.md # ← 审核报告存储在此处Version History
版本历史
| Version | Date | Changes |
|---|---|---|
| 2.2 | 2026-02-11 | Smart 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.1 | 2026-02-10 | Review & Fix Cycle: Replaced Phase 5 (Final Review) with iterative Review -> Fix cycle using |
| 2.0 | 2026-02-09 | Added 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.0 | 2026-02-08 | Initial 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.2 | 2026-02-11 | 智能文档检测: 添加自动文档类型识别;自身类型输入(BDD-NN)触发审核模式;上游类型输入(EARS-NN)触发缺失则生成或查找并审核;更新输入格式表格,添加基于类型的操作 |
| 2.1 | 2026-02-10 | 审核与修复循环: 将阶段5(最终审核)替换为迭代式审核→修复循环,使用 |
| 2.0 | 2026-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.0 | 2026-02-08 | 初始技能创建,包含5阶段工作流;集成doc-naming、doc-bdd、doc-bdd-validator、quality-advisor技能;添加场景类别参考(8个类别);添加基于章节的结构要求;添加Gherkin原生标签强制要求 |