with one click
doc-bdd-validator
// Validate Behavior-Driven Development (BDD) documents against Layer 4 schema standards
// Validate Behavior-Driven Development (BDD) documents against Layer 4 schema standards
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | doc-bdd-validator |
| description | Validate Behavior-Driven Development (BDD) documents against Layer 4 schema standards |
| metadata | {"tags":["sdd-workflow","layer-4-artifact","quality-assurance"],"custom_fields":{"layer":4,"artifact_type":"BDD","architecture_approaches":["ai-agent-based","traditional-8layer"],"priority":"shared","development_status":"active","skill_category":"quality-assurance","upstream_artifacts":["BDD"],"downstream_artifacts":[],"version":"1.2","last_updated":"2026-02-27"},"versioning_policy":"tracks BDD-MVP-TEMPLATE schema_version"} |
Validate Behavior-Driven Development (BDD) documents against Layer 4 schema standards.
Invoke when user requests validation of BDD documents or after creating/modifying BDD artifacts.
Schema: ai_dev_ssd_flow/04_BDD/BDD_MVP_SCHEMA.yaml
Layer: 4
Artifact Type: BDD
Nested Folder Rule: ALL BDD documents MUST be in nested folders regardless of size.
Required Structure:
| BDD Type | Required Location |
|---|---|
| Markdown | docs/04_BDD/BDD-NN_{slug}/BDD-NN_{slug}.md |
| Feature | docs/04_BDD/BDD-NN_{slug}/BDD-NN_{slug}.feature |
Validation:
1. Check document is inside a nested folder: docs/04_BDD/BDD-NN_{slug}/
2. Verify folder name matches BDD ID pattern: BDD-NN_{slug}
3. Verify file name matches folder: BDD-NN_{slug}.md or .feature
4. Parent path must be: docs/04_BDD/
Example Valid Structure:
docs/04_BDD/
āāā BDD-01_f1_iam/
ā āāā BDD-01_f1_iam.md ā Valid
ā āāā BDD-01_f1_iam.feature ā Valid (optional companion)
ā āāā BDD-01.A_audit_report_v001.md
ā āāā BDD-01.R_review_report_v001.md (legacy)
ā āāā .drift_cache.json
āāā BDD-02_f2_session/
ā āāā BDD-02_f2_session.md ā Valid
Invalid Structure:
docs/04_BDD/
āāā BDD-01_f1_iam.md ā NOT in nested folder
Error Codes:
| Code | Severity | Description |
|---|---|---|
| BDD-E020 | ERROR | BDD not in nested folder (BLOCKING) |
| BDD-E021 | ERROR | Folder name doesn't match BDD ID |
| BDD-E022 | ERROR | File name doesn't match folder name |
| VAL-H001 | ERROR | Drift cache missing hash for upstream document |
| VAL-H002 | ERROR | Invalid hash format (must be sha256:<64 hex chars>) |
This check is BLOCKING - BDD must pass folder structure validation before other checks proceed.
Required custom_fields:
- document_type: ["bdd", "template"]
- artifact_type: "BDD"
- layer: 4
- architecture_approaches: [array format]
- priority: ["primary", "shared", "fallback"]
- development_status: ["active", "draft", "deprecated", "reference"]
Required tags:
- bdd (or bdd-template)
- layer-4-artifact
Forbidden tag patterns:
- "^behavior-driven$"
- "^bdd-\\d{3}$"
Required Sections:
# BDD-NNN: TitleDocument Control Required Fields:
File Naming:
Pattern: BDD-NNN_descriptive_name.md
Gherkin Syntax:
Feature: [Feature Name]
As a [role]
I want [feature]
So that [benefit]
Scenario: [Scenario Name]
Given [context]
When [action]
Then [expected outcome]
And [additional outcome]
Scenario Format:
Scenario: DescriptionScenario Outline Format:
Scenario Outline: [Description]
Given [context with <variable>]
When [action with <variable>]
Then [outcome with <variable>]
Examples:
| variable | value |
| data1 | val1 |
ADR-Ready Score:
Layer 4 Cumulative Tags:
Downstream Expected:
Same-Type References:
| Code | Severity | Description |
|---|---|---|
| BDD-E001 | error | Missing required tag 'bdd' |
| BDD-E002 | error | Missing required tag 'layer-4-artifact' |
| BDD-E003 | error | Invalid document_type |
| BDD-E004 | error | Invalid architecture_approaches format |
| BDD-E005 | error | Forbidden tag pattern detected |
| BDD-E006 | error | Missing required section |
| BDD-E007 | error | Multiple H1 headings detected |
| BDD-E008 | error | Section numbering not sequential |
| BDD-E009 | error | Document Control missing required fields |
| BDD-E010 | error | Invalid Gherkin syntax |
| BDD-E011 | error | Scenario missing Given-When-Then |
| BDD-E012 | error | Missing Traceability (Section 8) |
| BDD-E013 | warning | File name does not match format |
| BDD-W001 | warning | Scenario missing Then step |
| BDD-W002 | warning | Missing upstream tags (@brd, @prd, @ears) |
| BDD-W003 | warning | ADR-Ready Score below 90% |
| BDD-W004 | warning | Scenario Outline missing Examples |
| BDD-W005 | warning | Test data incomplete |
| BDD-I001 | info | Consider adding Background steps |
| BDD-I002 | info | Consider adding negative scenarios |
# Validate single BDD document
python ai_dev_ssd_flow/04_BDD/scripts/validate_bdd.py docs/04_BDD/BDD-001_example.md
# Validate all BDD documents
python ai_dev_ssd_flow/04_BDD/scripts/validate_bdd.py docs/04_BDD/
# Validate .feature files
python ai_dev_ssd_flow/04_BDD/scripts/validate_bdd.py tests/bdd/features/
# Check with verbose output
python ai_dev_ssd_flow/04_BDD/scripts/validate_bdd.py docs/04_BDD/ --verbose
patterns = {
'feature': r'^Feature:\s+.+',
'scenario': r'^Scenario:\s+.+',
'scenario_outline': r'^Scenario Outline:\s+.+',
'given': r'^\s*Given\s+.+',
'when': r'^\s*When\s+.+',
'then': r'^\s*Then\s+.+',
'and': r'^\s*And\s+.+',
'but': r'^\s*But\s+.+',
'background': r'^Background:',
'examples': r'^\s*Examples:'
}
BDD Validation Report
=====================
Document: BDD-001_example.md
Status: PASS/FAIL
Scenario Summary:
- Total Scenarios: N
- With Given-When-Then: N
- Scenario Outlines: N
- With Examples: N
Errors: N
Warnings: N
Info: N
[Details listed by severity]
| Version | Date | Changes | Author |
|---|---|---|---|
| 1.2 | 2026-02-27 | Migrated frontmatter to metadata; updated valid structure example for preferred BDD-NN.A_audit_report_vNNN.md with legacy reviewer compatibility; corrected validator command paths to ai_dev_ssd_flow/04_BDD/scripts | System |
| 1.1 | 2026-02-11 | Nested Folder Rule: Added Section 0 Folder Structure Validation (BLOCKING); BDD must be in docs/04_BDD/BDD-NN_{slug}/ folders; Added error codes BDD-E020, BDD-E021, BDD-E022 | |
| 1.0 | 2026-02-08 | Initial validator skill definition with YAML frontmatter | System |
--iplan > --ref > --prompt.docs-v2.0/00_REF.