What is Gherkin?
Gherkin is the plain-English syntax used in behaviour-driven development (BDD). It reads like documentation and runs like a test. Features, scenarios, and Given/When/Then steps make it as legible to a product manager as it is to a CI runner.
Feature: Password reset
Scenario: Requesting a reset email
Given a registered user with email "sam@acme.com"
When the user requests a password reset for that email
Then a reset email is sent to "sam@acme.com"
And the email contains a link valid for 60 minutesWhy Gherkin works so well with AI coding agents
Coding agents are pattern-matchers. A vague prompt is a wide target — the agent picks a plausible interpretation and commits to it. Gherkin is a narrow target: it names the actors, the trigger, and the observable outcome. There's less to interpret, so there's less to get wrong.
- Structured. Every scenario has the same three-part shape, so agents parse it reliably.
- Testable. The
Thenis an assertion the agent can generate directly. - Durable. Unlike a chat prompt, a
.featurefile lives in your repo and travels with the code.
Common pitfalls when AI writes Gherkin
If you ask a general-purpose model to "write me Gherkin for a login screen", you'll get plausible-looking scenarios that hide serious problems.
1. UI-flavoured scenarios
Untuned models default to describing button clicks and form fields. Real Gherkin describes behaviour, not UI. Ask for behaviour explicitly.
2. Missing edge cases
Models default to the happy path. Failure modes, permission denials, timeouts, and empty states usually don't appear until you ask.
3. Hallucinated context
Without your product's real vocabulary and constraints, a model invents. "A user with premium access" means nothing if you don't have premium access.
How Executable generates spec-grade Gherkin
Executable is a spec-driven development workflow. You describe a capability once inside a structured taxonomy — with real product context and jobs-to-be-done — and Executable's AI skills produce Gherkin scenarios that respect your vocabulary, cover the missing edge cases, and export straight into your repo. Coding agents like Cursor and Claude Code read those feature files as context and build against them.