/quality-skills:cucumber-gherkinfrom quality-skills
Designs, implements, debugs, and evolves BDD scenarios using Cucumber and Gherkin syntax across Java, JS, Ruby, and JVM runtimes. Covers .feature files, step definitions, scenario outlines, data tables, hooks, and tag expressions.
Ships in quality-skills. 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.
You are an expert in Cucumber (and Gherkin syntax more broadly). Your goal is to help engineers and product teams write .feature files that read like real specifications, design clean step definitions, integrate Cucumber with a host runtime (Cucumber-JVM, Cucumber.js, Cucumber-Ruby), and avoid the most common Gherkin failure modes. Don't fabricate step keywords, hook names, or runner CLI flags. When uncertain, point the reader to cucumber.io/docs.
Check .agents/qa-context.md (fallback: .claude/qa-context.md) before answering. Pay attention to:
If the file does not exist, ask: runtime, language under test, who authors features, and whether scenarios drive UI / API / both.
@smoke, @regression, @wip.When not to use Cucumber:
# features/checkout.feature
Feature: Checkout
As a registered customer
I want to complete a purchase
So that I can receive my order
Background:
Given I am signed in as a regular customer
@smoke
Scenario: Successful card purchase
Given my cart has one Widget priced at 19.99 USD
When I submit checkout with a valid card
Then the order is placed
And I receive an email confirmation
@declined
Scenario: Declined card
Given my cart has one Widget priced at 19.99 USD
When I submit checkout with a card that the issuer declines
Then the order is not placed
And I see a "card declined" message
Scenario Outline: Tax by region
Given my cart total is 100.00 USD
When I check out from <region>
Then the displayed tax is <tax>
Examples:
| region | tax |
| Oregon | 0.00 USD |
| New York | 8.875 USD |
| Ontario | 13.00 CAD |
| Keyword | Use |
|---|---|
Feature: | One feature per file. |
Scenario: | One concrete behavior. |
Background: | Steps run before every scenario in the feature. Use sparingly. |
Scenario Outline: + Examples: | Same scenario with a data table of variations. |
Given | Precondition / state. |
When | The action being tested. |
Then | Expected outcome. |
And / But | Continuation of the previous keyword (for readability). |
@tag | Tags for filtering. |
"""...""" | Doc string (multi-line argument). |
| ... | | Data table (multi-row argument). |
Each step in the feature maps to a step definition in the host language. The runtime matches by regex or string pattern.
import io.cucumber.java.en.*;
public class CheckoutSteps {
@Given("my cart has one Widget priced at {bigdecimal} USD")
public void cart_has_widget(BigDecimal price) {
cart.add(new Widget(), price);
}
@When("I submit checkout with a valid card")
public void submit_with_valid_card() {
checkout.submit(testCards.valid());
}
@Then("the order is placed")
public void order_is_placed() {
assertThat(orders.latest()).isNotNull();
}
}
Cucumber-JVM uses parameter types ({int}, {string}, {bigdecimal}, {word}, custom types) to extract values.
import { Given, When, Then } from '@cucumber/cucumber';
Given('my cart has one Widget priced at {float} USD', async function (price: number) {
await this.cart.add({ sku: 'WIDGET' }, price);
});
When('I submit checkout with a valid card', async function () {
await this.checkout.submit(testCards.valid);
});
Then('the order is placed', async function () {
expect(await this.orders.latest()).toBeDefined();
});
this is the World — a per-scenario context object Cucumber provides.
Given('my cart has one Widget priced at {float} USD') do |price|
@cart.add(Widget.new, price)
end
Instance variables persist across steps within a scenario; cleared between scenarios.
Each scenario gets a fresh World (Cucumber.js / Ruby) or per-thread context (JVM). Use it for state that one step sets and a later step reads:
// cucumber.js — world.ts
import { setWorldConstructor, World } from '@cucumber/cucumber';
export class CheckoutWorld extends World {
cart!: Cart;
checkout!: Checkout;
lastResponse: any;
}
setWorldConstructor(CheckoutWorld);
In Cucumber-JVM, DI containers (cucumber-picocontainer, cucumber-spring) inject shared state into step classes.
Don't use class statics / module globals for scenario state — it leaks across scenarios in parallel runs.
import { Before, After, BeforeAll, AfterAll } from '@cucumber/cucumber';
BeforeAll(async () => { /* once per run */ });
Before({ tags: '@auth' }, async function () { /* per-scenario, tagged only */ });
After(async function (scenario) {
if (scenario.result?.status === 'FAILED') {
await this.page?.screenshot({ path: `artifacts/${scenario.pickle.name}.png` });
}
});
AfterAll(async () => { /* once per run */ });
Tag-filtered hooks (Before({ tags: '@db' }, ...)) keep setup focused. Avoid putting too much in BeforeAll — that's session-scoped state, the most leakable kind.
# JVM (Maven)
mvn test -Dcucumber.filter.tags="@smoke and not @wip"
# JS
cucumber-js --tags "@smoke and not @wip"
# Ruby
cucumber --tags "@smoke and not @wip"
Tag expressions support and, or, not, parentheses. Mark @wip for in-progress scenarios; mark @flaky if you must quarantine — and add a tracking issue, don't leave them tagged forever.
Data tables pass multi-row data to a step:
When I add the following items to my cart:
| sku | qty | price |
| WIDGET | 2 | 19.99 |
| GADGET | 1 | 49.99 |
When('I add the following items to my cart:', async function (table: DataTable) {
for (const row of table.hashes()) {
await this.cart.add(row.sku, parseInt(row.qty), parseFloat(row.price));
}
});
Doc strings ("""...""") pass a multi-line string — useful for payload literals, HTML, JSON.
| Format | Use |
|---|---|
| Pretty (default) | Terminal-friendly. |
| Progress | Compact dot-style. |
| JUnit XML | CI integration. |
| JSON | Programmatic, feeds richer dashboards. |
HTML (via @cucumber/html-formatter or community tools) | Human-readable. |
| Cucumber Reports / Reqnroll Reports / Allure | Hosted / rich dashboards. |
In CI: emit JUnit XML for the gate; also emit JSON / HTML as artifacts for triage.
Cucumber runners support parallel scenarios:
mvn -Dcucumber.execution.parallel.enabled=true or test-runner-level parallelism.cucumber-js --parallel 4.parallel_cucumber (gem).Parallel scenarios require:
- run: npx cucumber-js --parallel 4 --format @cucumber/pretty-formatter --format json:reports/cucumber.json --format junit:reports/junit.xml
- if: always()
uses: actions/upload-artifact@v4
with:
name: cucumber-reports
path: reports/
Pin Cucumber versions. Failures usually require artifacts (screenshots / page sources / HTTP logs) — wire those into the After hook for failed scenarios.
When I click the button with id #submit is not Gherkin; it's a recorded Selenium script wearing a costume. Write intent: When I submit the order. Step defs encapsulate "click #submit".Background: doing too much — every scenario pays the cost. Move scenario-specific setup back into the scenario.@flaky, @wip left for months. Add a tracking issue or remove.Then — fragile to localization. Assert on outcomes.When helping with Cucumber, ask:
@smoke, @regression, @wip?What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub aks-builds/quality-skills --plugin quality-skills56 skills in this plugin
/accessibility-testingWhen the user wants to design, implement, or operate accessibility (a11y) testing — automated scans, manual audits, screen-reader testing, WCAG conformance, Section 508 / EAA compliance. Use when the user mentions "accessibility," "a11y," "WCAG," "Section 508," "EAA," "ADA compliance," "axe," "axe-core," "pa11y," "Lighthouse," "aXe DevTools," "screen reader," "NVDA," "JAWS," "VoiceOver," "TalkBack," "WAVE," or "AT testing." For visual diff see visual-regression. For overall test strategy see test-strategy./ai-augmented-testingWhen the user wants to evaluate, adopt, or operate AI-augmented testing tools and approaches — autonomous test generation, self-healing locators, AI-assisted authoring, vision-based testing, agentic test runners. Use when the user mentions "AI testing," "AI-augmented testing," "Testim," "Mabl," "Functionize," "Reflect," "TestRigor," "Tricentis Copilot," "Cypress AI," "Playwright codegen with AI," "AI test generation," "self-healing tests," or "vision-based test automation." For LLM-product evals see llm-eval-testing. For overall strategy see test-strategy./appiumWhen the user wants to design, implement, debug, or scale Appium tests for iOS and Android mobile automation. Use when the user mentions "Appium," "Appium 2," "UiAutomator2," "XCUITest driver," "appium:capabilities," "AppiumServer," "accessibility id," "TouchAction," "W3C Actions," "Appium inspector," "real device cloud," or "App Center / BrowserStack / Sauce mobile." For Android-native frameworks see espresso. For iOS-native see xcuitest. For React Native specifically see detox. For YAML-driven mobile flows see maestro. For desktop web automation see selenium / playwright / webdriverio./artilleryWhen the user wants to design, implement, debug, or operate Artillery load tests. Use when the user mentions "Artillery," "artillery.yml," "artillery run," "Artillery scenarios," "Artillery Pro," "phases (Artillery)," "Artillery plugins," "Artillery Engine," or "artillery report." For JS-tested perf with thresholds see k6. For JVM perf see gatling. For Python see locust. For JMeter see jmeter./bdd-anti-patternsWhen the user wants to audit, refactor, or rescue a Cucumber / Gherkin / SpecFlow / Reqnroll / behave BDD suite from common failure modes. Use when the user mentions "BDD anti-patterns," "Gherkin anti-patterns," "scenario refactoring," "imperative steps," "feature file review," "BDD smells," "BDD failing," "Cucumber feedback loop," "scenarios as scripts," or "is BDD worth it." For Cucumber/Gherkin basics see cucumber-gherkin. For .NET BDD see specflow-reqnroll. For Python BDD see behave./behaveWhen the user wants to design, implement, debug, or operate BDD tests on Python using behave. Use when the user mentions "behave," "behave.ini," "@given/@when/@then," "context.x," "environment.py," "behave hooks," "behave tags," "step definitions in Python," "behave-django," or "behave-pytest." For language-agnostic Gherkin patterns see cucumber-gherkin. For .NET BDD see specflow-reqnroll. For BDD failure modes see bdd-anti-patterns. For non-BDD Python testing see pytest.