skills/swe-gherkin-dev/SKILL.md
TDD from Gherkin specs. Takes a .feature file or SPEC_* memory, builds a coverage map, implements both functionality and tests to achieve 100% compliance. Builds missing functionality, creates real tests (no fixme), follows all dev standards.
npx skillsauth add earthmanweb/serena-workflow-engine swe-gherkin-devInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
If starting a new session, first read workflow initialization:
mcp__plugin_swe_serena__read_memory("wf/WF_INIT")
Follow WF_INIT instructions before executing this skill.
Implement functionality AND tests from a Gherkin .feature spec.
Full TDD — if the functionality doesn't exist, build it.
/swe-gherkin-dev # List available specs, pick one
/swe-gherkin-dev auth-login # Find spec by slug
/swe-gherkin-dev auth-login.feature # Find spec by filename
/swe-gherkin-dev SPEC_AUTH_LOGIN # Find spec by memory name
test.fixme() or test.skip() — implement real tests with real functionality.feature fileExtract the slug from $ARGUMENTS by stripping .feature or .spec.* extensions.
Strategy 1: Check SPEC_ memories*
mcp__plugin_swe_serena__list_memories(topic="spec")
If a SPEC_* memory matches the argument, read it to get the .feature file path.
Strategy 2: Glob for .feature files
Glob(pattern="tests/specs/**/*{slug}*.feature")
Glob(pattern="test/specs/**/*{slug}*.feature")
Glob(pattern="spec/**/*{slug}*.feature")
If a single match → proceed to Step 1. If multiple matches → present them and ask user to pick.
List all available .feature files:
Glob(pattern="**/*.feature")
Present them grouped by directory:
Available Gherkin specs:
tests/specs/:
1. auth-login-flow.feature
2. auth-registration.feature
...
Which spec should I develop?
Stop and wait for user input.
Read the .feature file:
Read(file_path="[spec_path]")
Parse into a structured coverage map:
| # | Type | Line | Covered | Implementation Exists | |---|------|------|---------|-----------------------| | 1 | Given | user is on the login page | No | ? | | 2 | When | user enters valid credentials | No | ? | | 3 | Then | user is redirected to dashboard | No | ? | | 4 | And | session token is stored | No | ? |
Every Given/When/Then/And line becomes a row. Nothing is skipped.
For Scenario Outlines, each example row generates its own coverage entries.
Exhaust all codebase research BEFORE asking the user anything.
Determine which feature(s) the spec targets from file paths, domain terms, or explicit feature references in the spec.
mcp__plugin_swe_serena__read_memory("index/INDEX_FEATURES")
mcp__plugin_swe_serena__read_memory("feature/FEATURE_[KEY]")
Load ALL supporting memories referenced in the feature:
DOM_* — domain patternsSYS_* — system architectureREF_* — coding standardsINDEX_* — file/symbol indexesFor each Given/When/Then line, search the codebase:
mcp__plugin_swe_serena__search_for_pattern(substring_pattern="...", relative_path="...")
mcp__plugin_swe_serena__find_symbol(name_path_pattern="...", relative_path="...")
Update the coverage map column "Implementation Exists" with:
Glob for matching test files:
Glob(pattern="tests/**/*{slug}*.*")
Read every matched test file to understand:
Update the coverage map:
fixme, skip, todo) → Covered: NoYou MUST read development standards before writing ANY code:
mcp__plugin_swe_serena__read_memory("feature/FEATURE_DEV_STANDARDS")
mcp__plugin_swe_serena__read_memory("feature/FEATURE_TESTS")
Load language-specific standards based on what needs building:
mcp__plugin_swe_serena__list_memories(topic="dev")
Read all DEV_* memories relevant to the affected languages.
Before writing ANY test setup code, check existing test helpers and fixtures.
Read FEATURE_TESTS for documented helpers. Then explore the test directory:
mcp__plugin_swe_serena__get_symbols_overview("[test_root]/", depth=1)
Rules:
Only ask the user questions that could NOT be answered from the spec or codebase.
Valid questions:
Invalid questions (answer from codebase):
Present questions grouped:
## Questions Before Implementation
### Behavior Clarification
1. [question] — researched [what you found], but spec is ambiguous about [specific gap]
### Architecture Decision
2. [question] — two valid approaches: [A] vs [B], spec doesn't indicate preference
If no questions needed, skip directly to Step 4.
Present a structured plan before writing code:
## Implementation Plan for [SPEC_NAME]
### Functionality to Build (TDD RED phase)
| # | Component | File | Type | Description |
|---|-----------|------|------|-------------|
| 1 | [name] | [path] | [language] | [what it does] |
### Tests to Create (TDD GREEN phase)
| # | Test Name | Spec Lines | File |
|---|-----------|------------|------|
| 1 | [test description] | Given #1, When #2, Then #3 | [path] |
### Existing Tests to Preserve
| # | Test Name | File | Status |
|---|-----------|------|--------|
| 1 | [existing test] | [path] | Keep as-is / Extend |
### Execution Order
1. [first thing to build/test]
2. [second thing]
...
Wait for user approval before proceeding.
For each group of related spec lines:
Create the test that will fail because functionality doesn't exist yet.
Test Standards (from FEATURE_TESTS and DEV_*):
// Spec: Given [line], When [line], Then [line]
test('[description from spec line]', async () => {
// Given: [setup from spec]
// ...
// When: [action from spec]
// ...
// Then: [assertion from spec]
// ...
});
Adapt the test structure to the project's framework (pytest, jest, playwright, phpunit, etc.).
Implement the minimal functionality to make the test pass.
Follow existing patterns:
find_symbol, get_symbols_overview) to locate insertion pointsUse the test command from FEATURE_TESTS to run the specific test.
Continue the RED/GREEN cycle until ALL spec lines are covered.
You are NOT done until every test passes. No exceptions.
Run every new or modified test one at a time using the project's test runner.
For EACH test:
When a test fails:
Rules:
Only after ALL individual tests pass, run the full test file:
Re-check the coverage map — every row must show:
Any row with "No" is a failure. Go back and implement.
Update the SPEC_* memory with final coverage status:
mcp__plugin_swe_serena__edit_memory(
"spec/SPEC_[KEY]_[SLUG]",
"**Status** | draft",
"**Status** | complete",
"literal"
)
Update all coverage map rows to show Implemented: Yes, Tested: Yes.
test.fixme() or test.skip() in any new tests## Gherkin Dev Complete: [SPEC_NAME]
### Coverage Map (Final)
| # | Type | Line | Covered | Implementation |
|---|------|------|---------|---------------|
| 1 | Given | ... | Yes | Built / Existed |
| ... |
### Files Created/Modified
| File | Action | Description |
|------|--------|-------------|
| [path] | Created/Modified | [what changed] |
### Test Results
- New tests: [count] passing
- Full file: all passing
- Spec coverage: 100%
Load ALL affected feature memories. Follow cross-feature patterns from ARCH_INDEX.
Keep the existing test. Add a comment mapping it to the spec line.
Extend the test with additional assertions. Never remove existing assertions.
Write the test. Verify it passes. If it fails, the functionality has a bug — fix the bug (TDD).
Stop and inform the user. FEATURE_TESTS must be configured with a test runner before TDD can proceed. Suggest running /swe-feature-onboard or manually updating FEATURE_TESTS.
## Skill Return
- **Skill**: swe-gherkin-dev
- **Status**: [success|needs_clarification|blocked]
- **Spec File**: [path to .feature file]
- **Coverage**: [N/N steps covered — 100%]
- **Tests Created**: [count]
- **Files Modified**: [count]
- **Next Step Hint**: WF_VERIFY
> **Skill /swe-gherkin-dev complete** - [spec name] at 100% coverage
testing
Write Gherkin BDD specs for a feature. Creates .feature files in tests/specs/ from requirements, user stories, or free-form descriptions.
testing
Verify implementation against requirements and standards
development
Code exploration and research without making changes
development
Test-driven debugging for failing tests or bugs