/skraft:bdd-methodologyfrom skraft
Guides writing, reviewing, and structuring BDD scenarios in Gherkin format. Covers Given/When/Then conventions, scenario outlines, backgrounds, tags, and domain language alignment.
Ships in skraft. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Behaviour-Driven Development translates acceptance criteria into executable specifications. Gherkin scenarios are the contract between the business (what it expects) and the engineer (what to implement).
Core rule: Every word in a Gherkin scenario must be understood by a domain expert who has never seen code.
Each acceptance criterion produces one or more scenarios. The mapping is explicit and traceable.
| AC type | Gherkin pattern |
|---|---|
| Happy path | Scenario: {persona} {action} successfully |
| Boundary condition | Scenario: {persona} {action} at the limit |
| Rejection / business rule violation | Scenario: {persona} is rejected when {condition} |
| Multiple inputs (parametrized) | Scenario Outline with Examples table |
Mapping process:
Feature: Eligibility Check
@eligibility @happy-path
Scenario: Driver with a clean record obtains eligibility
Given a driver with 5 years of experience and no accidents
When the driver requests an eligibility check
Then the driver is declared eligible
And the eligibility certificate is valid for 30 days
@eligibility @edge-case
Scenario Outline: Driver eligibility varies by accident count
Given a driver with <accidents> accidents in the past 3 years
When the driver requests an eligibility check
Then the driver is <result>
Examples:
| accidents | result |
| 0 | eligible |
| 1 | eligible |
| 2 | not eligible |
| 3 | not eligible |
Background:
Given the eligibility service is operational
Scenario: Driver below minimum age is rejected
Given a driver aged 17
When the driver requests an eligibility check
Then the driver is rejected with reason "below minimum age"
Scenario: Driver obtains eligibility with vehicle restrictions
Given a driver with a B1 licence
When the driver requests an eligibility check
Then the driver is eligible
And coverage is limited to vehicles under 3.5 tonnes
But commercial transport is excluded
| Element | Convention | Example |
|---|---|---|
| Feature file | {bounded-context}-{feature}.feature | eligibility-check.feature |
| Feature title | Business name of the feature | Eligibility Check |
| Scenario title | {Persona} {business action} {outcome} | Driver with clean record obtains eligibility |
| Steps | Business verb + domain noun | the driver requests an eligibility check |
| Scenario Outline | Same as Scenario, state the variable | Driver eligibility varies by accident count |
@{feature} @{type}
Scenario: ...
| Tag | Usage |
|---|---|
@{feature-name} | One per bounded context feature (e.g., @eligibility) |
@happy-path | The primary success scenario |
@edge-case | Boundary values, limit conditions |
@error-case | System errors, missing data, invalid state |
@smoke | Minimal set for walking skeleton validation (mark ≤3 per feature) |
@visual | Marks a scenario whose AC is expressed in visual/positional/style terms — requires a companion Playwright E2E test with a real measurement, see Visual AC Rule below |
@frontend @backend @api @http @ui @infrastructure @database @persistence | ❌ FORBIDDEN — layer leak: embed implementation vocabulary in the Gherkin layer |
Gherkin operates at Layer 1. No technical leak is tolerated.
| Layer | Owner | Language |
|---|---|---|
| Layer 1 — Gherkin | Business | Pure domain vocabulary. Zero technical terms. |
| Layer 2 — Step methods | Engineer (test code) | Translate Gherkin nouns/verbs to use case calls |
| Layer 3 — Application | Engineer (production code) | Use cases, repositories, domain objects |
Violations at Layer 1:
When I call POST /api/eligibility → HTTP detailWhen I invoke the EligibilityApplicationService → class nameWhen I set isEligible to true → implementationGiven the database contains a record → infrastructureWhen the driver requests an eligibility check → business action| Anti-pattern | Problem | Fix |
|---|---|---|
| UI testing in Gherkin | When I click Submit | When the driver submits the application |
| Too many steps | >7 steps in one scenario | Split into smaller, focused scenarios |
| Multiple When | When … And When … | One trigger per scenario. Two behaviours = two scenarios. |
| Incidental details | Irrelevant data in Given | Use named personas or abstractions |
| Vague Then | Then it works | Assert specific, observable business outcome |
| Technical identifiers | Given the DTO is populated | Given a driver with complete profile |
| Implementation leaking | Then the repository returns null | Then no eligibility result is found |
| Passive voice outcome | Then eligibility is checked | Then the driver is declared eligible |
Before handing any .feature file to the engineer, scan every scenario against this checklist.
Each violation is a BLOCKER — do not proceed until the step is rewritten in domain language.
| Pattern | Example violation | Domain rewrite |
|---|---|---|
URL path (any route segment: /api/, /v1/, /{word}/{id}) | When the user accesses /contract/12345 | When the user views the contract details |
HTTP verb in step text (POST, GET, PUT, DELETE, PATCH) | When I call POST /api/eligibility | When the driver requests an eligibility check |
Class or service name (*Service, *Repository, *Controller, *Handler, *UseCase) | When I invoke the EligibilityService | When the driver requests an eligibility check |
Infrastructure vocabulary (database, table, record, queue, topic, container, DTO, schema) | Given the database contains a record | Given a driver with a completed profile |
@frontend @backend @api @http @ui @infrastructure @database — these tags embed
implementation vocabulary in the Gherkin layer. Use behavior tags (@happy-path, @error-case)
or domain-feature tags (@eligibility) instead.
Scan instruction: read every step and every tag of every scenario. If a hit is found, rewrite in domain language before handoff. A clean pass is the exit criterion for DISTILL phase. See the 3-Layer Abstraction Rule above for the vocabulary boundary.
Any acceptance criterion expressed in visual, positional, or style terms (pixel position, full-page
width, background colour, relative alignment between two elements) MUST be tagged @visual and
CANNOT be closed by a jsdom/unit test alone.
Why: jsdom has no real layout engine — getBoundingClientRect() returns zeros unconditionally, so
a passing unit assertion on position/size is structurally a proxy (DOM order, CSS class presence),
never proof of the rendered result. A contributor following only the unit TDD loop can legitimately
believe the AC is verified when the real regression risk (broken CSS, wrong mount point, wrong
z-index) is uncaught.
Rule: a @visual scenario is closed only when at least one Playwright E2E test performs a real
measurement (boundingBox(), getComputedStyle() colour, computed layout) against a real browser
engine. See test-design-mandates Mandate 5 for the coverage-matrix rule and
acceptance-review-criteria Gate G9 for the review-time check.
One scenario = one observable behaviour.
If removing one step breaks the meaning, the scenario has the right granularity. If a step can be removed without affecting the scenario's meaning, it is incidental — remove it.
Scenario ordering per feature:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
bdd, gherkin, scenario-writing, acceptance-criteria, testing-methodology
npx claudepluginhub sebastiendegodez/skraft-plugin --plugin skraft44 skills in this plugin
/acceptance-review-criteriaUse when reviewing DISTILL artefacts (Gherkin scenarios, test plans, implementation plans) for quality, completeness, and alignment. Contains the gate definitions and scoring rubric for the acceptance-designer-reviewer lenses./adr-eligibility-gateUse when deciding WHETHER a candidate architectural choice deserves an architecture decision record, before any record is drafted: a story enters DESIGN with a list of candidate choices, a reviewer flags ADR inflation, or someone asks "should I write an ADR for X?", "how many ADRs does this story need?", "is this ADR-worthy?", "this feels like too many ADRs", "disambiguate baseline from decision". Runs a baseline-vs-decision gate over each candidate and returns ELIGIBLE or NOT ELIGIBLE with the baseline, convention or architecture test that already covers it. Do NOT use when the decision is already settled and the user asks for the record to be written, when the request is about the ADR template, status transitions, superseding or lifecycle, or when the question is which pattern to adopt — those belong to architecture-decisions and architecture-patterns.
/adversarial-review-lensesUse when reviewing a phase artifact — a discovery brief, a plan, a design, an acceptance specification, or a slice reported as delivered — and the review has to end in a defensible pass-or-block verdict rather than a list of remarks. Covers judging whether the artifact covers everything that fed into it, whether it matches the business intent, whether it holds together internally, and what it puts at risk downstream, then weighing those into a single call. Not for routine code review of an ordinary change./architecture-decisionsUse when documenting architecture decisions as ADRs, evaluating trade-offs between alternatives, or managing the lifecycle of existing decisions. Covers ADR template, status transitions, consequence analysis, and quality criteria./architecture-patternsUse when selecting architecture patterns for a new feature, performing Event Modeling, defining bounded contexts, choosing DDD tactical patterns, evaluating pattern fitness, or understanding how patterns compose. Covers Event Modeling methodology, DDD strategic design, DDD tactical patterns, Clean Architecture, CQRS, and Event Sourcing./architecture-review-criteriaUse when reviewing DESIGN artefacts (event models, ADRs, component diagrams, context maps, interface contracts) for quality, DDD compliance, and architectural correctness. Contains gate definitions and scoring rubric for the solution-architect-reviewer lenses.Other plugins' skills for the same job