aks-builds/quality-skills/cucumber-gherkin
Claude Code and agent skill by aks-builds/quality-skills
- community
Checking that the SKILL.md file is still in the repository.
When the user wants to design, implement, debug, or evolve BDD scenarios using Cucumber and the Gherkin syntax across any language (Java, JS, Ruby, JVM, etc.). Use when the user mentions "Cucumber," "Gherkin," "Given/When/Then," ".feature file," "step definitions," "scenario outline," "data tables," "Cucumber hooks," "World," "Cucumber-JVM," "Cucumber.js," "Cucumber-Ruby," or "tag expressions." For .NET BDD see specflow-reqnroll. For Python BDD see behave. For Karate's BDD-flavored DSL see karate. For the catalog of what NOT to do in Gherkin see bdd-anti-patterns.
Install
npx vskill@latest install aks-builds/quality-skills/cucumber-gherkinSKILL.md
The same SKILL.md was published earlier as aks-builds/quality-skills/cucumber-gherkin.
Cucumber & Gherkin
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.
Initial Assessment
Check .agents/qa-context.md (fallback: .claude/qa-context.md) before answering. Pay attention to:
- Is BDD actually the right tool? — Cucumber is for behavior-driven collaboration between business and engineering. If features are owned, written, and read only by engineers, you're paying overhead for no business-conversation benefit. Consider plain unit / integration tests in the host language.
- Runtime — Cucumber-JVM (Java/Kotlin/Scala/Groovy), Cucumber.js (Node), Cucumber-Ruby, SpecFlow / Reqnroll (.NET), behave (Python — different runtime, same Gherkin).
- Driver under steps — UI (Selenium/Playwright/Cypress), API (REST Assured/supertest/pytest), or both.
- Who writes features? — Product / BA / engineers? The answer determines style. If engineers-only, scenarios drift into UI scripts.
- Test pyramid — Cucumber scenarios at the slow / E2E end of the pyramid. Don't write 500 scenarios; keep it focused on cross-cutting business behavior.
If the file does not exist, ask: runtime, language under test, who authors features, and whether scenarios drive UI / API / both.
Why Cucumber (when it's the right tool)
- Shared vocabulary — features are readable by non-engineers; the same file is the spec and the test.
- Outside-in driver — write scenario first → red → wire step defs → green. Encourages designing from behavior.
- Plain text, version-controllable — diffs in Git, code reviewable.
- Tag-driven test selection —
@smoke,@regression,@wip.
When not to use Cucumber:
- Engineers-only team — the abstraction tax exceeds the readability benefit.
- Unit-level testing — use the host language's runner (cross-reference jest-vitest / pytest / junit-testng).
- Heavy parameterization that's clearer as a table-driven unit test — don't fight the tool.
Gherkin syntax
| 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). |
Step definitions
Each step in the feature maps to a step definition in the host language. The runtime matches by regex or string pattern.
Cucumber-JVM (Java)
Cucumber-JVM uses parameter types ({int}, {string}, {bigdecimal}, {word}, custom types) to extract values.
Cucumber.js (Node / TypeScript)
this is the World — a per-scenario context object Cucumber provides.
Cucumber-Ruby
Instance variables persist across steps within a scenario; cleared between scenarios.
The World (scenario context)
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:
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.
Hooks
Tag-filtered hooks (Before({ tags: '@db' }, ...)) keep setup focused. Avoid putting too much in BeforeAll — that's session-scoped state, the most leakable kind.
Tags and selection
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 and doc strings
Data tables pass multi-row data to a step:
Doc strings ("""...""") pass a multi-line string — useful for payload literals, HTML, JSON.
Reports
| 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.
Parallel execution
Cucumber runners support parallel scenarios:
- Cucumber-JVM:
mvn -Dcucumber.execution.parallel.enabled=trueor test-runner-level parallelism. - Cucumber.js:
cucumber-js --parallel 4. - Cucumber-Ruby:
parallel_cucumber(gem).
Parallel scenarios require:
- Per-scenario state (World) — no shared mutable state.
- Independent test data — unique IDs per scenario.
- Database isolation if scenarios touch DB.
CI integration
Pin Cucumber versions. Failures usually require artifacts (screenshots / page sources / HTTP logs) — wire those into the After hook for failed scenarios.
Common Pitfalls
- Scenarios as UI scripts —
When I click the button with id #submitis not Gherkin; it's a recorded Selenium script wearing a costume. Write intent:When I submit the order. Step defs encapsulate "click #submit". - Every implementation detail in the feature — long, brittle, unreadable.
- Engineers writing features for engineers — the abstraction tax has no payoff. Consider plain xUnit-style tests.
- `Background:` doing too much — every scenario pays the cost. Move scenario-specific setup back into the scenario.
- Shared step definitions across unrelated features — one regex change breaks dozens of scenarios. Keep step defs cohesive.
- Tags as a forever-quarantine —
@flaky,@wipleft for months. Add a tracking issue or remove. - Implicit state in step defs — relying on the order of method calls across step classes. Use the World / DI for explicit context.
- Mixing data tables with comma-separated strings — pick one style per project.
- One mega feature file — split by behavior / domain.
- Asserting on UI text in `Then` — fragile to localization. Assert on outcomes.
- No After hook for failure artifacts — every failure is a black box.
Task-Specific Questions
When helping with Cucumber, ask:
- Runtime — Cucumber-JVM, Cucumber.js, Cucumber-Ruby, SpecFlow/Reqnroll (.NET), behave (Python)?
- Who writes features — product, BA, engineers, mix?
- UI, API, or both?
- Tag taxonomy —
@smoke,@regression,@wip? - Parallelism strategy?
- Existing step-def organization — by domain, by screen, by API?
- Reports — JUnit, JSON, Cucumber Reports / Allure?
Related Skills
- bdd-anti-patterns — the catalog of what not to do; read this alongside.
- specflow-reqnroll — .NET BDD specifics.
- behave — Python BDD specifics.
- karate — Karate uses Gherkin syntax but with its own DSL (no step defs); cross-reference for comparison.
- playwright / cypress / selenium — common UI drivers under Cucumber steps.
- rest-assured / supertest / pytest-api — API drivers under Cucumber steps.
- ci-test-orchestration — for parallel runners and matrix runs.
- flaky-test-management — when scenarios randomly fail.
- test-strategy — for where BDD fits in the pyramid.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/cucumber-gherkin/SKILL.md
Popularity
- Repository stars
- 4
- 7-day trend score
- 8
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/aks-builds/quality-skills/cucumber-gherkin)