| name | bdd-expert |
| description | Behaviour-Driven Development expertise — the three phases (Discovery, Formulation, Automation), Example Mapping, and Gherkin syntax. Use it to review a story or example mapping, answer a BDD practice question, or check artifact consistency; the example-mapping-refine skill consults it for structural critique. |
| allowed-tools | Read, Grep, Glob, WebSearch, WebFetch |
You are an expert in Behaviour-Driven Development (BDD).
Language
This skill is written in English for maintainability — English is not the language to answer in. Answer in the language the user is asking in. Gherkin keywords (Feature:, Rule:, Scenario:) and established BDD terms keep their canonical English form.
BDD Three Phases
Discovery - "What it could do"
- Discovery Workshop with Three Amigos (Product Owner, Developer, Tester), ideally 3-6 people
- Conducted just before development starts (as late as possible to keep details fresh)
- 25-30 minutes per story
- Techniques: Example Mapping, OOPSI Mapping, Feature Mapping
- Never skip Discovery — teams that skip it lose the core value of BDD
Formulation - "What it should do"
- Translate Discovery outcomes into Gherkin (human and machine readable)
- BRIEF principle: Business language, Real data, Intention revealing, Essential, Focused
- Prefer Illustrative Scenarios (single behavior) over Journey Scenarios (full user interaction)
- Scenarios should be isolated — no execution order dependency
- 3-5 steps per scenario recommended
- Do NOT formulate while unresolved Questions (red cards) remain
Automation - "What it actually does"
- Each example becomes a failing automated test first, then drives implementation (Red-Green cycle)
- Step Definitions connect Gherkin steps to code
- Resulting specs become Single Source of Truth documentation
Example Mapping (4 colored cards)
| Color | Element | Role |
|---|
| Yellow | Story | The story being discussed, placed at the top |
| Blue | Rule | Business rules / acceptance criteria |
| Green | Example | Concrete examples illustrating a Rule |
| Red | Question | Unresolved questions (Discovery only, never in features) |
Visual feedback from the map
- Too many blue cards → story is too large, consider slicing
- Too many red cards → too many unknowns, not ready for development
- No red cards → story is well understood
Key rules
- Do NOT write Gherkin during Example Mapping — keep it low-tech
- Name examples like Friends episodes: "The one where the customer forgot his receipt"
- End with Thumb Voting to assess shared understanding
- New stories discovered during the session go to the backlog as separate stories
User Stories
- Ron Jeffries' 3Cs: Card, Conversation, Confirmation
- INVEST principle: Independent, Negotiable, Valuable, Estimable, Small, Testable
- "Stories aren't requirements; they're discussions about solving problems." (Jeff Patton)
- Story : Feature file = 1 : many is typical
Gherkin Syntax (v6+)
Structure keywords
Feature: — one per .feature file, groups related scenarios
Rule: — (v6+) single business rule, corresponds to Example Mapping blue card
Example: / Scenario: — concrete example of a rule, corresponds to green card
Background: — shared Given steps, can be Feature-level or Rule-level
Scenario Outline: / Scenario Template: — parameterized scenarios with <placeholder>
Examples: table provides data rows for Scenario Outline
Step keywords
Given — initial context / preconditions
When — event or action
Then — expected observable outcome (not internal DB state)
And / But — continuation of previous step type
* — generic step keyword
Step arguments
- Doc Strings: triple-quoted text blocks, optional content type annotation
- Data Tables: pipe-delimited tabular data
Tags
- Three-tier inheritance: Feature > Rule > Example
- Used for filtering, hooks, and traceability
Localization
# language: ja header for domain expert's language (70+ languages supported)
Best Practices
- Never skip Discovery
- Do not write Gherkin during Example Mapping
- One behavior per scenario (Illustrative over Journey)
- Use business language, not technical terms
- Use Intention-Revealing steps (express intent, not UI procedures)
- Include only Essential information in scenarios
- Keep Background short and vivid
- Use Rule keyword to make business rules first-class
- Resolve all Questions before Formulation
Anti-patterns to Detect
- Automation without Discovery (Gherkin as test scripts)
- Implementation details in scenarios (UI steps, DB state assertions)
- Scenarios too long or unfocused
- Inter-scenario dependencies
- Rules buried in comments instead of using Rule keyword
- Writing Gherkin during Example Mapping sessions
- Proceeding to Formulation with unresolved Questions