Gherkin
Skill andrey-learning-machines/swe-harness/plugins/swe-harness/skills/gherkin
Draft, review, refactor, and explain Cucumber Gherkin `.feature` files and executable specifications. Use when Codex needs to write or validate Given/When/Then scenarios, Scenario Outlines, Backgrounds, Rules, Examples tables, tags, Doc Strings, Data Tables, localized Gherkin keywords, or step-organization guidance for Cucumber projects.From its SKILL.md
npx -y skills add andrey-learning-machines/swe-harness --skill gherkinAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
- fetches URLsInstructs the agent to fetch 6 URLs, including https://cucumber.io/docs/gherkin/ and 5 more.
SKILL.md
8.0 KB, ~1.7k tokens by cl100k_base, as published. Nobody here has run it
Gherkin
Overview
Use this skill to write precise, readable Cucumber Gherkin and to review existing feature files for syntax errors, ambiguity, and anti-patterns.
Treat the official Cucumber documentation as the source of truth. Use this skill as a distilled working guide, not as a replacement for the live documentation. If syntax, keyword support, localization behavior, or tag behavior is uncertain, open the official docs before finalizing:
- Gherkin overview
- Gherkin reference
- Gherkin localisation
- Step organization
- Anti-patterns
- Cucumber reference: tags and hooks
Workflow
- Identify the task:
- write a new
.featurefile - review or refactor an existing
.featurefile - explain Gherkin syntax or Cucumber authoring choices
- propose or review step-definition organization
- write a new
- Inspect the repository before drafting:
- detect whether the repo uses English or localized keywords
- inspect existing
.featurefiles, tags, and step definitions - preserve repo conventions unless they contradict official syntax or create an obvious anti-pattern
- Draft or review the feature file using the core rules in this file.
- Open references/gherkin-reference.md for exact keyword behavior, multiline arguments, Scenario Outline rules, tags, or localization details.
- Open references/cucumber-writing-and-anti-patterns.md for step-definition organization, reuse strategy, and refactoring guidance.
- Re-open the official Cucumber docs whenever there is uncertainty. Do not guess on syntax.
- Finalize only after the review checklist passes.
Codex Execution Notes
- Load the reference files selectively to preserve context. Do not load both unless the task genuinely needs both.
- Cite the official Cucumber URLs in user-facing responses when the user asks for the rule source, an explanation of syntax, or the most up-to-date guidance.
- Inspect the repo’s existing Gherkin and step-definition style before normalizing phrasing or file structure.
- Keep feature files business-facing. Put implementation detail, framework detail, and code reuse in step definitions and helper methods.
- Treat this skill as syntax and authoring guidance, not as a substitute for reading the local test harness.
Core Authoring Rules
- Start each
.featurefile with a singleFeature:block. Keep exactly oneFeatureper file. - Use
Rule:when a feature contains distinct business rules that deserve separate scenario groupings. - Use
Scenario:orExample:for a concrete behavior example. Treat them as synonyms. - Prefer 3 to 5 steps per scenario when possible. Split oversized scenarios instead of narrating an entire workflow.
- Use
Givenfor initial context or preconditions. - Use
Whenfor the event or action. - Use
Thenfor an observable outcome. - Use
AndandButto improve readability when repeating the same step type. - Use
*only when a list-style rhythm is clearer than repeated conjunctions. - Use free-form descriptions under
Feature,Rule,Background,Scenario, orScenario Outlineonly when they clarify business intent. - Use
Scenario Outlinewith one or moreExamplestables when the same behavior repeats with varying values. - Use
Backgroundonly for incidental shared context that truly applies to every scenario in the containingFeatureorRule. - Use
Doc StringsorData Tablesinstead of packing large structured payloads into step text. - Use tags intentionally for grouping, filtering, or metadata. Mirror the repo’s existing tag strategy if one exists.
Language And Tone
- Write scenarios in domain language that a product owner, analyst, tester, or user can follow.
- Hide implementation details in step definitions, not in feature files.
- Prefer observable outcomes over internal implementation checks.
- Prefer stable domain vocabulary over selector names, route names, endpoint names, or database names unless the team explicitly treats those as user-facing concepts.
- Prefer behavior phrased independently of a specific interface unless the interface itself is the behavior under test.
Do Not
- Do not assume this skill is more current than the official Cucumber documentation.
- Do not guess on syntax, keyword aliases, localization details, or tag placement when the official docs can answer it.
- Do not put more than one
Featurein a.featurefile. - Do not add a colon after keywords that should not have one. Incorrect colons can cause tests to be ignored.
- Do not use block comments. Gherkin supports line comments only.
- Do not write a
Givenstep for the user action under test. - Do not write a
Thenstep that checks hidden internal state such as raw database rows unless that state is itself the observable outcome for an external system. - Do not duplicate step text across
Given,When,Then,And, orBut. Cucumber matches step definitions without considering the keyword. - Do not bundle several distinct behaviors into one conjunction-heavy step when
AndorButshould split the meaning. - Do not leak selectors, clicks, DOM details, HTTP plumbing, or other implementation mechanics into Gherkin unless the product language genuinely depends on them.
- Do not overuse
Background, especially for long or complicated setup. - Do not write step definitions for hypothetical scenarios that do not exist yet.
- Do not couple step-definition file names or organization to individual feature files.
- Do not create near-duplicate step definitions when a parameterized step or shared helper method would keep the language cleaner.
- Do not call one step from another step definition as a reuse strategy when ordinary helper methods in the implementation language would be clearer.
- Do not invent nonstandard syntax or unsupported keyword combinations.
Review Checklist
- Confirm the file has exactly one
Feature. - Confirm each scenario expresses one business example clearly.
- Confirm step roles follow
Givencontext,Whenaction,Thenobservable outcome. - Confirm no duplicate step text exists across different step keywords.
- Confirm
Backgroundis short, memorable, and truly shared, or remove it. - Confirm
Scenario Outlineactually removes duplication and that each placeholder has a matching column. - Confirm
Doc StringsandData Tablesare a better fit than overlong steps. - Confirm wording is domain-facing rather than implementation-facing.
- Confirm the result is compatible with the repo’s existing step-definition and tag strategy.
- Confirm any uncertain rule against the official Cucumber docs before presenting the result as final.
References
- Read references/gherkin-reference.md for syntax, keyword behavior, multiline arguments, tags, and localization guidance.
- Read references/cucumber-writing-and-anti-patterns.md for step organization, reuse guidance, anti-patterns, and refactoring heuristics.
- Use the official Cucumber docs as the canonical source:
What ships with it: 3 files
10.6 KB alongside SKILL.md
agents/
- openai.yaml269 B