xiaohongshu
xiaohongshu
doc-bdd
Layer 4 artifact for Behavior-Driven Development test scenarios using Gherkin Given-When-Then format
Full skill instructions
Create BDD (Behavior-Driven Development) test scenarios - Layer 4 artifact in the SDD workflow that defines executable test scenarios using Gherkin syntax.
Layer: 4
Upstream: BRD (Layer 1), PRD (Layer 2), EARS (Layer 3)
Downstream: ADR (Layer 5), SYS (Layer 6), REQ (Layer 7)
Before creating this document, you MUST:
List existing upstream artifacts:
ls docs/BRD/ docs/PRD/ docs/EARS/ docs/BDD/ 2>/dev/null
Reference only existing documents in traceability tags
Use null only when upstream artifact type genuinely doesn't exist
NEVER use placeholders like BRD-XXX or TBD
Do NOT create missing upstream artifacts - skip functionality instead
Before creating BDD, read:
.claude/skills/doc-flow/SHARED_CONTENT.mdai_dev_flow/BDD/BDD-SECTION-TEMPLATE.featureai_dev_flow/BDD/BDD_CREATION_RULES.mdai_dev_flow/BDD/BDD_VALIDATION_RULES.mdai_dev_flow/BDD/BDD_SPLITTING_RULES.mdUse doc-bdd when:
All BDD suites MUST use section-based structure. No backward compatibility with legacy formats.
docs/BDD/
├── BDD-02_knowledge_engine/ # Suite folder
│ ├── BDD-02.0_index.md # Index file (MANDATORY)
│ ├── BDD-02.1_ingest.feature # Section 1
│ ├── BDD-02.2_query.feature # Section 2
│ ├── BDD-02.3.00_learning.feature # Aggregator (if 5+ subsections)
│ ├── BDD-02.3.01_learning_path.feature # Subsection 1
│ ├── BDD-02.3.02_bias_detection.feature # Subsection 2
│ ├── BDD-02_README.md # Optional companion
│ └── BDD-02_TRACEABILITY.md # Optional companion
└── BDD-02_knowledge_engine.feature # Redirect stub (0 scenarios)
| Pattern | Example | Use When |
|---|---|---|
| Section-Only | BDD-02.14_query_result_filtering.feature | Standard section (≤500 lines, ≤12 scenarios) |
| Subsection | BDD-02.24.01_quality_performance.feature | Section requires splitting |
| Aggregator | BDD-02.12.00_query_graph_traversal.feature | Organizing multiple subsections (@redirect, 0 scenarios) |
| Pattern | Example | Fix |
|---|---|---|
| _partN suffix | BDD-02_query_part1.feature | Use BDD-02.2.01_query.feature |
| Single-file | BDD-02_knowledge_engine.feature (with scenarios) | Use section-based format |
| features/ subdirectory | BDD-02_slug/features/ | Put .feature files at suite folder root |
.feature files in suite folder - No features/ subdirectoryBDD-NN.0_index.md for all suites.feature file (soft limit: 400)@section, @parent_doc, @index# Traceability Tags (Gherkin-native, NOT in comments)
@section: 2.14
@parent_doc: BDD-02
@index: BDD-02.0_index.md
@brd:BRD.02.01.03
@prd:PRD.02.07.02
@ears:EARS.02.14.01
Feature: BDD-02.14: Query Result Filtering
As a data analyst
I want filtered query results
So that I can focus on relevant data
Background:
Given the system timezone is "America/New_York"
And the current time is "09:30:00" in "America/New_York"
@primary @functional
Scenario: Successful filter application
Given valid filter criteria
When user applies filter
Then filtered results are returned
And response time is less than @threshold:PRD.02.perf.api.p95_latency
Tags MUST be Gherkin-native, NOT in comments.
# INVALID (frameworks cannot parse comment-based tags):
# @brd: BRD.01.01.01
# @prd: PRD.01.01.01
Feature: My Feature
# VALID (Gherkin-native tags before Feature):
@brd:BRD.01.01.01
@prd:PRD.01.01.01
@ears:EARS.01.24.01
Feature: My Feature
HH:MM:SSAmerica/New_York, America/Los_AngelesGiven the current time is "14:30:00" in "America/New_York"
And the system timezone is "America/New_York"
Pattern: BDD.{DOC_NUM}.{ELEM_TYPE}.{SEQ} (4 segments, dot-separated)
| Element Type | Code | Example |
|---|---|---|
| Test Scenario | 14 | BDD.02.14.01 |
| Step | 15 | BDD.02.15.01 |
REMOVED PATTERNS - Do NOT use:
SCENARIO-XXX,TS-XXX→ UseBDD.NN.14.SSSTEP-XXX→ UseBDD.NN.15.SSTC-XXX→ UseBDD.NN.14.SS
Purpose: Measures BDD maturity and readiness for ADR progression.
Format in Document Control:
| **ADR-Ready Score** | ✅ 95% (Target: ≥90%) |
| ADR-Ready Score | Required Status |
|---|---|
| ≥90% | Approved |
| 70-89% | In Review |
| <70% | Draft |
Scenario Completeness (35%):
Testability (30%):
Architecture Requirements Clarity (25%):
Business Validation (10%):
Quality Gate: Score <90% blocks ADR artifact creation.
All quantitative values MUST use @threshold: keys. No hardcoded magic numbers.
# INVALID (hardcoded):
Then response time is less than 200ms
# VALID (threshold reference):
Then response time is less than @threshold:PRD.035.perf.api.p95_latency
@threshold:PRD.NN.perf.api.p95_latency
Scenario: API responds within performance threshold
| Category | BDD Usage | Example Key |
|---|---|---|
perf.* | Performance validation | perf.api.p95_latency |
sla.* | SLA validation | sla.uptime.target |
limit.* | Rate limit testing | limit.api.requests_per_second |
timeout.* | Timeout validation | timeout.request.sync |
Layer 4 (BDD): Must include tags from Layers 1-3 (BRD, PRD, EARS)
Tag Count: 3+ tags (@brd, @prd, @ears)
Format (Gherkin-native tags before Feature):
@brd:BRD.01.01.03
@prd:PRD.01.07.02
@ears:EARS.01.24.01
Feature: Feature Name
| Notation | Format | Artifacts | Purpose |
|---|---|---|---|
| Dash | TYPE-NN | ADR, SPEC, CTR | Technical artifacts - document references |
| Dot | TYPE.NN.TT.SS | BRD, PRD, EARS, BDD, SYS, REQ | Hierarchical artifacts - element references |
All 8 categories should be represented:
| Category | Tag | Description |
|---|---|---|
| Success Path | @primary | Happy path scenarios |
| Alternative Path | @alternative | Optional parameters, different workflows |
| Error Conditions | @negative | Invalid inputs, error handling |
| Edge Cases | @edge_case, @boundary | Boundary conditions, limits |
| Data-Driven | @data_driven | Parameterized with Examples tables |
| Integration | @integration | External system interactions |
| Quality Attributes | @quality_attribute | Performance, security, reliability |
| Failure Recovery | @failure_recovery | Error recovery, circuit breakers |
@primary @functional
Scenario: User logs in successfully
Given valid credentials
When user submits login
Then user is authenticated
@negative @error_handling
Scenario: Trade rejected due to insufficient funds
Given account balance is $1000
When trade requires $5000
Then trade is rejected
And error code "INSUFFICIENT_FUNDS" is returned
@edge_case @boundary
Scenario: Trade at exact position limit
Given current delta is 0.499
And position limit is 0.50
When trade increases delta to 0.50
Then trade is accepted
@data_driven
Scenario Outline: Validate price precision
Given instrument <symbol>
When price is <price>
Then precision should be <decimals> decimal places
Examples:
| symbol | price | decimals |
| SPY | 450.25 | 2 |
| AMZN | 3250.5 | 1 |
All .feature files MUST include section metadata tags:
@section: NN.SS # Section number (e.g., 2.1, 2.14)
@parent_doc: BDD-NN # Parent BDD suite (e.g., BDD-02)
@index: BDD-NN.0_index.md # Index file reference
@brd:BRD.NN.EE.SS # Upstream BRD element
@prd:PRD.NN.EE.SS # Upstream PRD element
@ears:EARS.NN.SS.RR # Upstream EARS requirement
For subsections, add:
@parent_section: NN.SS # Parent section number
Feature Title Format:
Feature: BDD-NN.SS: Domain Description
Use when: Section has 5+ subsections
Requirements:
@redirect tag MUST be present@redirect
@section: 2.12.00
@parent_doc: BDD-02
@index: BDD-02.0_index.md
Feature: BDD-02.12: Query Graph Traversal (Aggregator)
This is a redirect stub. Test scenarios are in subsections:
- BDD-02.12.01_depth_first.feature - Depth-first traversal tests
- BDD-02.12.02_breadth_first.feature - Breadth-first traversal tests
Background:
Given the system timezone is "America/New_York"
# No scenarios in aggregator - redirect only
Mandatory: BDD-NN.0_index.md for each suite
# BDD-02.0: Knowledge Engine Test Suite Index
## Suite Overview
**Purpose**: Test scenarios for Knowledge Engine functionality
**Scope**: Ingest, Query, Learning, Performance Monitoring
## Section File Map
| Section | File | Scenarios | Lines | Status | Description |
|---------|------|-----------|-------|--------|-------------|
| 02.1 | BDD-02.1_ingest.feature | 8 | 350 | Active | Ingest tests |
| 02.2 | BDD-02.2_query.feature | 10 | 420 | Active | Query tests |
## Traceability Matrix
| BDD Section | Upstream Source | Description |
|-------------|----------------|-------------|
| BDD-02.1 | EARS.02.01-05 | Ingest requirements |
| BDD-02.2 | EARS.02.06-12 | Query requirements |
Read BRD, PRD, and EARS to understand requirements to test.
Check docs/BDD/ for next available ID (e.g., BDD-01, BDD-02).
ID Numbering Convention: Start with 2 digits and expand only as needed.
mkdir -p docs/BDD/BDD-02_knowledge_engine/
cp ai_dev_flow/BDD/BDD-SECTION-0-TEMPLATE.md docs/BDD/BDD-02_knowledge_engine/BDD-02.0_index.md
cp ai_dev_flow/BDD/BDD-SECTION-TEMPLATE.feature docs/BDD/BDD-02_knowledge_engine/BDD-02.1_ingest.feature
@section, @parent_doc, @index@brd, @prd, @earsFor each requirement from EARS/PRD:
@threshold:PRD.NN.category.key format# Create redirect stub at docs/BDD/ root
touch docs/BDD/BDD-02_knowledge_engine.feature
Add minimal content with @redirect tag and 0 scenarios.
python3 scripts/validate_bdd_suite.py --root BDD
Commit suite folder and redirect stub together.
| Code | Description | Severity |
|---|---|---|
| E001 | Document Control fields missing | ERROR |
| E002 | Gherkin syntax invalid | ERROR |
| E003 | ADR-Ready Score format invalid | ERROR |
| E004 | Upstream traceability tags missing | ERROR |
| E041 | Tags in comments (not Gherkin-native) | ERROR |
| E008 | Element ID format invalid | ERROR |
| CHECK 9.1 | File naming pattern invalid | ERROR |
| CHECK 9.2 | Prohibited pattern detected | ERROR |
| CHECK 9.3 | Aggregator requirements not met | ERROR |
| CHECK 9.4 | File size exceeds limits | ERROR |
| CHECK 9.5 | Section metadata tags missing | ERROR |
| CHECK 9.6 | Index file missing | ERROR |
| CHECK 9.7 | Non-Gherkin content in .feature file | ERROR |
File Structure:
.feature files in suite folder (no features/ subdirectory)BDD-NN.0_index.mddocs/BDD/BDD-NN_slug.feature (0 scenarios)File Naming:
Tags and Metadata:
@section, @parent_doc, @index@brd, @prd, @ears@threshold: keysScenarios:
Aggregators (if applicable):
@redirect tag| Mistake | Correction |
|---|---|
Tags in comments # @brd: | Use Gherkin-native @brd: before Feature |
ADR-Ready Score: 95% | Use ✅ 95% (Target: ≥90%) |
response time < 200ms (hardcoded) | Use @threshold:PRD.NN.perf.api.p95_latency |
.feature in features/ subdir | Put at suite folder root |
BDD-02_query_part1.feature | Use BDD-02.2.01_query.feature |
| Missing @ears tag | All 3 upstream tags are MANDATORY |
| Only success scenarios | Include all 8 scenario categories |
Status: Approved (with <90% score) | Use Status: In Review or Draft |
| File >500 lines | Split into subsections |
09:30 (no seconds) | Use 09:30:00 |
EST timezone | Use America/New_York |
CRITICAL: Execute validation loop IMMEDIATELY after document creation.
LOOP:
1. Run: python scripts/validate_bdd_suite.py --root BDD
2. IF errors fixed: GOTO LOOP (re-validate)
3. IF warnings fixed: GOTO LOOP (re-validate)
4. IF unfixable issues: Log for manual review
5. IF clean: Mark VALIDATED, proceed
Blocking: YES - Cannot proceed to ADR creation until validation passes with 0 errors.
Pattern: BDD-00_*.md or BDD-00_*.feature
Scope: Documents with reserved ID 000 are FULLY EXEMPT from validation.
Document Types:
BDD-00_index.md)After creating BDD, use:
doc-adr - Create Architecture Decision Records (Layer 5)
The ADR will:
@brd, @prd, @ears, @bdd tags (cumulative)ai_dev_flow/BDD/BDD-SECTION-TEMPLATE.featureai_dev_flow/BDD/BDD-SECTION-0-TEMPLATE.mdai_dev_flow/BDD/BDD-SUBSECTION-TEMPLATE.featureai_dev_flow/BDD/BDD-AGGREGATOR-TEMPLATE.featureai_dev_flow/BDD/BDD_CREATION_RULES.mdai_dev_flow/BDD/BDD_VALIDATION_RULES.mdai_dev_flow/BDD/BDD_SPLITTING_RULES.md.claude/skills/doc-flow/SHARED_CONTENT.mdai_dev_flow/ID_NAMING_STANDARDS.md| Item | Value |
|---|---|
| Purpose | Define executable test scenarios |
| Layer | 4 |
| Tags Required | @brd, @prd, @ears (3 tags) |
| ADR-Ready Score | ≥90% required for "Approved" status |
| Element ID Format | BDD.NN.14.SS (scenarios), BDD.NN.15.SS (steps) |
| File Structure | Nested suite folder: docs/BDD/BDD-NN_{slug}/ |
| Max File Size | 500 lines (soft: 400) |
| Max Scenarios | 12 per Feature block |
| Time Format | HH:MM:SS with IANA timezone |
| Quantitative Values | Use @threshold:PRD.NN.category.key |
| Next Skill | doc-adr |
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience