User Story (Mike Cohn + Gherkin)
Translate user needs into testable, outcome-focused user stories combining Mike Cohn's "As a / I want / so that" with Gherkin Given/When/Then acceptance criteria.
Your sprint board has 30 "As a user, I want to click the save button so that I can save my work" tickets — and engineering still ships features QA can't verify. "As a user" is a tell that you skipped the persona; restated actions in "so that" are a tell that you skipped the why. The fix is specific personas, real motivations, and Given/When/Then criteria a tester can actually execute.
Who it's for: PMs writing backlog items, BAs translating requirements, engineering teams adopting INVEST, QA building test cases from stories
Example
"Write a story for Google login" → "As a trial user / I want to log in with Google / so that I can access the app without creating a new password" → Given login page, Given Google account → When I click Sign in with Google and authorize → Then I'm redirected to onboarding
New here? 3-minute setup guide → | Already set up? Copy the template below.
# User Story (Mike Cohn + Gherkin)
Create user stories combining Mike Cohn's "As a / I want / so that" with Gherkin "Given/When/Then" acceptance criteria. Translate user needs into actionable, testable, outcome-focused work.
Not a feature spec — a conversation starter capturing *who* benefits, *what* they want, *why*, and *how* you know it works.
## The Format
**Use Case (Mike Cohn):**
- **As a** [persona/role]
- **I want to** [action]
- **so that** [outcome]
**Acceptance Criteria (Gherkin):**
- **Scenario:** [brief description]
- **Given:** [precondition]
- **and Given:** [more preconditions]
- **When:** [trigger event — aligns with "I want to"]
- **Then:** [expected outcome — aligns with "so that"]
## Why This Works
- User-centric: forces who/why focus
- Outcome-focused: "so that" surfaces value
- Testable: Gherkin is concrete + verifiable
- Conversational: opens discussion, not the final spec
- Shared language across product/eng/QA
## Application
### Step 1: Gather Context
- Persona (`proto-persona`)
- Problem (`problem-statement`)
- Desired outcome
- Constraints
### Optional Helper Script
```bash
python3 scripts/user-story-template.py --persona "trial user" --action "log in with Google" --outcome "access without creating a new password"
```
### Step 2: Write the Use Case
```markdown
### User Story [ID]:
- **Summary:** [Memorable, value-focused title]
#### Use Case:
- **As a** [specific persona]
- **I want to** [action]
- **so that** [outcome]
```
Quality checks:
- Specific persona, not generic "user"
- Action user takes, not feature you build
- "So that" = motivation, not restated action
### Step 3: Write Acceptance Criteria
```markdown
#### Acceptance Criteria:
- **Scenario:** [description]
- **Given:** [precondition]
- **and Given:** [more]
- **When:** [trigger]
- **Then:** [outcome]
```
Quality checks:
- Multiple Givens OK (preconditions stack)
- One When + one Then (multiple = split the story)
- "When" matches "I want to"
- "Then" matches "so that"
### Step 4: Validate
- Read aloud: does the team understand who/what/why?
- Can QA write tests from this?
- Too big? See `user-story-splitting`.
- Is "Then" provable?
## Example
```markdown
### User Story 042:
- **Summary:** Enable Google login for trial users to reduce signup friction
#### Use Case:
- **As a** trial user visiting the app for the first time
- **I want to** log in using my Google account
- **so that** I can access the app without creating and remembering a new password
#### Acceptance Criteria:
- **Scenario:** First-time trial user logs in via Google OAuth
- **Given:** I am on the login page
- **and Given:** I have a Google account
- **When:** I click "Sign in with Google" and authorize the app
- **Then:** I am logged in and redirected to onboarding
```
## Common Pitfalls
1. **Tech tasks disguised as stories** — "As a developer, refactor the API" = engineering task.
2. **"As a user" (too generic)** — use specific personas.
3. **"So that" restates "I want to"** — dig for the real motivation.
4. **Multiple When/Then** — story too big. Split it.
5. **Untestable Then** — "better experience." Make it concrete: "page loads in under 2s."
## References
- `skills/user-story-splitting` — break large stories down
- `skills/proto-persona` — defines the persona
- `skills/problem-statement` — validate problem first
- `skills/epic-hypothesis` — epics decompose to stories
- Mike Cohn, *User Stories Applied* (2004)
- Gherkin (Cucumber) Given/When/Then
- INVEST criteria
What This Does
Generates Mike Cohn-format user stories paired with Gherkin Given/When/Then acceptance criteria, then validates against INVEST and "When/Then aligns with want/so-that" rules. Includes optional Python helper to scaffold a stub from CLI inputs.
Pairs with user-story-splitting, proto-persona, problem-statement, and epic-hypothesis.
Quick Start
mkdir -p ~/Documents/UserStories
mv ~/Downloads/CLAUDE.md ~/Documents/UserStories/
cd ~/Documents/UserStories
claude
Provide persona, action, and outcome (plus context). Claude writes a full story with Given/When/Then and flags whether it should be split.
The Format
| Section | Fields |
|---|---|
| Use Case | As a / I want to / so that |
| Acceptance Criteria | Scenario / Given(s) / When / Then |
| Summary | Memorable, value-focused title |
Tips & Best Practices
- Specific personas. "Trial user" beats "user."
- "I want to" = action. Not the feature you're building.
- "So that" = real motivation. Not a restated action.
- One When + one Then. Multiple = the story should be split.
- Testable Then. "Page loads in under 2s" beats "feels faster."
Common Pitfalls
- Engineering tasks pretending to be user stories
- "As a user" applied to every persona
- "So that I can save" right after "I want to save"
- 3+ When/Then pairs jammed into one story
- Acceptance criteria nobody can test ("better UX")