AI coding agents following BDD (Behavior-Driven Development) principles can write great Gherkin scenarios if they are given the proper rules. Without explicit rules, AI-generated Gherkin often drifts into vague Then steps, UI-heavy scripts, multi-behavior scenarios, and placeholder examples that read like filler. That is not a model problem alone; it is a missing context problem.
I have written Gherkin Guidelines for AI, an open-source context file created to become a default BDD reference for AI-assisted scenario writing, AI code review, and Gherkin-based test automation. It is one Markdown file you can attach to Cursor, Claude, Copilot, Codex, or any tool that accepts project context.
The context file is gherkin-guidelines.md, located in the GitHub repository at https://github.com/AutomationPanda/gherkin-guidelines-for-ai.
To add these guidelines to your project:
- Download gherkin-guidelines.md from the GitHub repository.
- Place it in your own project alongside your specs or context files.
- Wire it up to your project’s rules, skills, or sub-agents so your AI coding agents will abide by it.
Please review the repository’s README for full setup and usage instructions.
When you are ready, try it on your next user story: load the guidelines, ask your agent for scenarios, and see how it feels when everyone is reading from the same playbook. Good specs are a team sport, and this file is here to make your first pass a little lighter and a lot clearer. Whether you want to simply code the vibes or do all-out Spec-Driven Development, I hope that my Gherkin guidelines can help!