Write BDD Feature Files with Claude
Gherkin feature files are living documentation that non-technical stakeholders can read and developers can run as tests. Claude can generate them from a feature description and then produce the matching step definitions.
Write Gherkin feature files for our user registration flow. Cover: successful registration,
duplicate email rejection, weak password rejection, and the email verification step.
Use Given/When/Then format compatible with Behat.
Claude produces clean, readable scenarios:
Feature: User Registration
Scenario: Successful registration
Given I am on the registration page
When I fill in "email" with "user@example.com"
And I fill in "password" with "Str0ngP@ss!"
And I submit the form
Then I should see "Check your email to verify your account"
And a verification email should be queued
Once the feature files look right, ask Claude to wire them up:
Generate Behat step definitions for these scenarios using our existing PageObject
classes and the DatabaseTransactions trait.
For non-PHP projects, Claude knows Cucumber (Ruby, Java, JavaScript) and Behave (Python) just as well.
The real payoff is using Claude to generate feature files before writing any code — it forces clarity on what you're actually building before a line is written.
Feature files are the spec and the test in one — Claude writes them faster than you can argue about the wording.
Log in to leave a comment.
The /security-review command scans your uncommitted changes for injection vectors, auth gaps, hardcoded secrets, and other common vulnerabilities.
The SessionStart hook fires when any session begins or resumes, making it ideal for loading environment variables and running one-time setup scripts.
Ask Claude to write property-based tests for your functions using fast-check — it identifies the mathematical invariants in your code and generates tests that cover inputs you'd never enumerate by hand.