step-def-generator·codegen·active

Step Definition Generator

Converts Gherkin steps into Cucumber/TypeScript step definitions. Wires parameters, expression types, and shared world state automatically.

EVANcursorclaude-codetrigger · ide
Step Definition Generator
Converts Gherkin Given/When/Then steps into Cucumber + TypeScript step definitions, wiring parameter types, expression syntax, and shared world state.
When this skill fires
·An engineer opens a .feature file in Cursor or Claude Code, and EVAN detects unbound steps
·An engineer runs evan generate against a TARA-authored Gherkin spec
·A pre-commit hook detects new scenarios without matching step defs
Cucumber Expressions vs regex
EVAN defaults to Cucumber Expressions ({string}, {int}, custom parameter types) over raw regex. Why:
·They're tree-shakeable for tooling — IDE jump-to-definition works reliably
·Type inference flows automatically into TypeScript
·New engineers can read them without regex fluency
Regex is used only when a step contains genuinely irregular structure that Expressions can't capture.
World state
Each generated step def takes a World parameter (the Cucumber world). EVAN inspects the surrounding .feature file and other step defs in the project to discover which world fields are in use, then references them by name.
EVAN never invents new world fields silently. If a step needs state that doesn't exist, EVAN adds the field to the World class definition explicitly and surfaces the change in the generated diff.
Parameter typing
For each {string} and {int} parameter, EVAN reads the Given/When/Then text and chooses the most narrow TypeScript type that still compiles:
·"jordan.lee@nexaq.io"Email (a custom parameter type)
·200HttpStatus (a numeric union type, if defined)
·"Valid#2026"string (no narrower type available)
What it produces
A TypeScript step def file with:
·Properly-imported Given, When, Then, World from @cucumber/cucumber
·One step def per unique Gherkin step in the feature
·World state reads via this. references
·Inline JSDoc on the world state changes each step makes
Example
Gherkin: `Given a registered user "jordan.lee@nexaq.io" with password "Valid#2026"`
Generated:
Given("a registered user {string} with password {string}", async function (this: World, email: string, password: string) { this.user = await db.users.create({ email, password }); });
The async is automatic — EVAN detects DB or HTTP I/O in the step body and adds it without prompting.