Use when writing user stories, defining acceptance criteria, or specifying user behaviors. Also triggers on 'user stories', 'as a user I want', 'acceptance criteria', 'Given/When/Then', 'BDD scenarios', or 'behavioral specifications'.
From pmnpx claudepluginhub etusdigital/etus-plugins --plugin pmThis skill uses the workspace's default tool permissions.
knowledge/guide.mdknowledge/template.mdSearches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Guides agent creation for Claude Code plugins with file templates, frontmatter specs (name, description, model), triggering examples, system prompts, and best practices.
Reference: .claude/skills/orchestrator/dependency-graph.yaml
BLOCKS (required — auto-invoke if missing):
docs/ets/projects/{project-slug}/planning/prd.md — Provides the PRD-F-# features to decompose into stories. Without features, there is nothing to write stories for.docs/ets/projects/{project-slug}/planning/solution-discovery.md — Stories should derive from the selected solution direction, not only from the abstract requirement list.ENRICHES (improves output — warn if missing):
docs/ets/projects/{project-slug}/discovery/product-vision.md — Personas and BO-# context makes stories more specific and grounded in real user needs.docs/ets/projects/{project-slug}/discovery/opportunity-pack.md — Upstream actors, JTBDs,
journeys, use cases, and edge cases should be reflected in story coverage.docs/ets/projects/{project-slug}/state/coverage-matrix.yaml — Helps ensure stories do not
skip critical scenarios already identified during ideation.Resolution protocol:
dependency-graph.yaml → user-stories.requires: [prd]prd.md exist, non-empty, not DRAFT?prd skill → wait → continueproduct-vision.md → warn if missing, proceedBLOCKS (required — auto-invoke if missing):
docs/ets/projects/{project-slug}/features/{feature-slug}/feature-brief.md — Provides the FB-# items to decompose into stories. Replaces prd.md as upstream in Feature mode.docs/ets/projects/{project-slug}/features/{feature-slug}/solution-discovery.md — Feature-mode stories should trace back to the chosen solution direction.docs/ets/projects/{project-slug}/features/{feature-slug}/feature-status.md — Canonical feature state for slug, tracking mode, next step, and linked docs.ENRICHES (improves output — warn if missing):
docs/ets/projects/{project-slug}/discovery/product-vision.md — Personas and BO-# context.docs/ets/projects/{project-slug}/planning/prd.md — If exists, provides broader product context.docs/ets/projects/{project-slug}/discovery/opportunity-pack.md — Source of upstream feature
problem-space coverage.docs/ets/projects/{project-slug}/state/coverage-matrix.yaml — Source of upstream feature
coverage commitments.Resolution protocol:
docs/ets/projects/{project-slug}/state/project-status.yaml or infer from $ARGUMENTS (if path contains features/ and feature-brief.md)dependency-graph.yaml → Feature mode: user-stories.requires: [feature-brief]features/{feature-slug}/feature-brief.md exist, non-empty, not DRAFT?feature-brief skill → wait → continueDetermine mode using this priority:
$ARGUMENTS contains a features/ path or a feature-status.md path → Feature modedocs/ets/projects/{project-slug}/state/project-status.yaml exists with "mode": "feature" → Feature modedocs/ets/projects/{project-slug}/features/*/feature-brief.md exists but docs/ets/projects/{project-slug}/planning/prd.md does not → Feature modeWhy this matters: user-stories.md is the Single Source of Truth for all Given/When/Then acceptance criteria. If it only exists in chat, QA teams cannot generate BDD tests, and the feature-spec and implementation skills cannot reference US-# IDs.
mkdir -p if neededIf the Write fails: Report the error to the user and do not proceed — downstream documents depend on US-# references in this file.
This skill follows the ETUS interaction standard. Your role is a thinking partner, not an interviewer — suggest alternatives, challenge assumptions, and explore what-ifs instead of only extracting information.
One question per message — Ask one question, wait for the answer, then ask the next. Use the AskUserQuestion tool when available for structured choices. Batching questions leads to shallow stories with generic acceptance criteria.
3-4 suggestions for choices — When the user needs to choose a direction (e.g., which scenarios to include, story point estimate), present 3-4 concrete options with a brief description of each. Highlight your recommendation.
Generate stories one at a time — Present each US-# with its story statement and acceptance criteria. Ask "Does this capture the behavior correctly? Anything to adjust?" before generating the next story.
Propose Given/When/Then scenarios before writing — For each story, propose 2-3 scenarios (happy path, edge case, error case) and ask which to include. Then write the approved scenarios.
Track outstanding questions — If something cannot be answered now, classify it:
Present story groups for approval — After completing all stories for one PRD-F-#, present the group summary and ask for approval before moving to the next feature.
Multiple handoff options — At completion, present 3-4 next steps as options (see CLOSING SUMMARY).
Resume existing work — Before starting, check if the target artifact already exists at the expected path. If it does, ask the user: "I found an existing user-stories.md at [path]. Should I continue from where it left off, or start fresh?" If resuming, read the document, summarize the current state, and continue from outstanding gaps.
Assess if full process is needed — If the user's input is already detailed with clear requirements, specific acceptance criteria, and defined scope, don't force the full interview. Confirm understanding briefly and offer to skip directly to document generation. Only run the full interactive process when there's genuine ambiguity to resolve.
This skill reads and writes persistent memory to maintain context across sessions.
On start (before any interaction):
docs/ets/.memory/project-state.md — know where the project isdocs/ets/.memory/decisions.md — don't re-question closed decisionsdocs/ets/.memory/preferences.md — apply user/team preferences silentlydocs/ets/.memory/patterns.md — apply discovered patternsOn finish (after saving artifact, before CLOSING SUMMARY):
project-state.md is updated automatically by the PostToolUse hook — do NOT edit it manually.python3 .claude/hooks/memory-write.py decision "<decision>" "<rationale>" "<this-skill-name>" "<phase>" "<tag1,tag2>"python3 .claude/hooks/memory-write.py preference "<preference>" "<this-skill-name>" "<category>"python3 .claude/hooks/memory-write.py pattern "<pattern>" "<this-skill-name>" "<applies_to>"The .memory/*.md files are read-only views generated automatically from memory.db. Never edit them directly.
Before generating content, challenge the framing with these questions (ask the most relevant 1-2, not all):
The goal is to sharpen the problem framing, not to block progress. If the user's framing is solid, acknowledge it and move on quickly. Only dig deeper when genuine misframing signals appear.
Translate features into testable user stories with acceptance criteria in Gherkin Given/When/Then format. This is the Single Source of Truth for all behavioral specifications. If an actor, journey, use case, or edge case mattered upstream during ideation, it should either appear here or be explicitly deferred.
Load context in this order of priority:
docs/ets/projects/{project-slug}/planning/solution-discovery.md first.[upstream-path], read that file directly (typically prd.md).docs/ets/projects/{project-slug}/state/reports/ for any upstream planning artifacts.docs/ets/projects/{project-slug}/planning/ for existing prd.md to extract PRD-F-#.Load context in this order of priority:
docs/ets/projects/{project-slug}/features/{feature-slug}/feature-status.md first.docs/ets/projects/{project-slug}/features/{feature-slug}/solution-discovery.md first.features/{feature-slug}/feature-brief.md path, read that file directly.docs/ets/projects/{project-slug}/state/project-status.yaml for Feature mode context and slug.docs/ets/projects/{project-slug}/features/ for existing feature-brief.md files to extract FB-#.prd.md or product-vision.md exist, read them for broader context but do NOT require them.Each user story follows a simple template:
As a [persona], I want [action], so that [benefit/motivation]
Example:
Validate with user: "Is this persona correct? Does the action match the benefit?"
Each US-# must go beyond the basic story statement. The difference between a shallow story and a production-ready story:
Shallow (insufficient):
US-1: As a user, I want to log in, so that I can access my account. Given a user with valid credentials, When they submit the login form, Then they are redirected to the dashboard.
Production-ready (target depth):
US-1: As a freelancer with an existing account, I want to log in with email/password or Google SSO, so that I can access my invoicing dashboard within 3 seconds.
Given a freelancer with valid email/password credentials When they submit the login form Then they are redirected to the invoicing dashboard within 3 seconds And their last-viewed client is pre-selected
Given a freelancer clicking "Sign in with Google" When Google OAuth completes successfully Then their account is linked (first time) or they are logged in (returning) And session persists for 30 days with "Remember me" checked
Given 3 consecutive failed login attempts When the freelancer tries a 4th attempt Then the account is temporarily locked for 15 minutes And an email notification is sent to the account owner
Dependencies: Upstream: PRD-F-2 (Authentication). Downstream: None (simple). Technical Notes: Requires OAuth 2.0 with Google. Rate limiting on login endpoint. Session management via JWT with 30-day refresh token. Design Notes: Login page with email/password + Google SSO button. Error states: invalid credentials, locked account, network error. Mobile-responsive (min 320px).
Each story has 1-3 acceptance criteria in Gherkin Given/When/Then format:
Given [pre-conditions / initial state]
When [user action]
Then [expected result]
Example:
Given a freelancer logged in with previous clients
When clicking "New Invoice"
Then they see a pre-filled form with the most recent client selected
And suggested line items from previous invoices appear
Given a draft invoice unsaved for >5 minutes
When the user navigates away
Then they see a prompt "Discard unsaved changes?"
Given an invoice overdue by >30 days
When freelancer views the dashboard
Then the invoice is highlighted in red with "Overdue" label
Quality Guidelines for Given/When/Then:
Given/When/Then acceptance criteria live only in this document.
Why this matters: if acceptance criteria are scattered across user-stories.md, feature-spec files, and implementation plans, QA teams get conflicting definitions of "done" and BDD tests diverge from the actual spec. By keeping all Given/When/Then here, there is exactly one place to look for behavioral expectations.
This is the Single Source of Truth for:
Downstream documents (feature-spec-*.md, implementation-plan.md) may elaborate on business rules and logic but should not modify or override the Given/When/Then scenarios defined here.
US-# Pattern: User Stories. Format: US-1, US-2, etc. Each US-# must:
Maintain traceability:
BO-# → PRD-F-# → US-# → acceptance criteriaACT/JTBD/JOUR/UC/EDGE -> FB-# → US-# → impl-#The generated docs/ets/projects/{project-slug}/planning/user-stories.md contains:
The generated docs/ets/projects/{project-slug}/features/{feature-slug}/user-stories.md contains:
feature-brief.md and solution-discovery.md as primary upstreamFB-# replacing PRD-F-# in the Feature fieldBoth modes share the same per-US-# structure:
### US-[NN]: [Descriptive Title]
**Feature:** PRD-F-[NN] — [Feature name]
**Persona:** [Persona name]
**Priority:** [Must/Should/Could — inherited from PRD-F-#]
**Story Points:** [S/M/L/XL — relative effort estimate]
> As a [persona], I want [action], so that [benefit/motivation].
#### Acceptance Criteria
```gherkin
Given [specific pre-condition with context]
When [single concrete user action]
Then [observable, testable outcome]
Given [another scenario]
When [action]
Then [result]
- **Coverage Matrix**:
- **Product mode:** Table showing PRD-F-# × US-# mapping
- **Feature mode:** Table showing FB-# × US-# mapping
- **Statistics**: Total US-#, breakdown by priority (Must/Should/Could), by story points
- **Traceability**:
- **Product mode:** Visual chain: BO-# → PRD-F-# → US-# → [FS-# if applicable]
- **Feature mode:** Visual chain: FB-# → US-# → impl-#
## COMPLEXITY THRESHOLD
After writing a user story, check: Does this feature have >3 business rules, state transitions, or intricate validation?
If YES → Flag for feature-spec-[name].md creation. The feature-spec will detail the complex logic while user-stories.md remains the SST for acceptance criteria.
If NO → Leave as-is. Simple user story is sufficient.
## KNOWLEDGE POINTERS
- Read `references/template.md` for the user-stories.md document template and structure.
- Read `references/guide.md` for story writing best practices: writing from user perspective, avoiding vagueness, making Given/When/Then specific and executable.
---
**Upon completion, evaluate each US-# for the complexity threshold. Flag features exceeding 3 business rules for feature-spec creation. Then present handoff options to the user (see CLOSING SUMMARY). Planning Gate validation: All PRD-F-# covered by US-# and feature-specs? Scope achievable in estimated time?**
## INPUT VALIDATION
### Product Mode
**prd.md** (BLOCKS):
- Needs at least 3 `PRD-F-#` identifiers — fewer than 3 features suggests the PRD is incomplete
- Needs a `## Features` section — this is where PRD-F-# definitions live
- Each PRD-F-# should have a MoSCoW priority — stories inherit priority from their parent feature
**product-vision.md** (ENRICHES):
- Should contain personas with goals — these drive the "As a [persona]" part of each story
### Feature Mode
**features/{feature-slug}/feature-brief.md** (BLOCKS):
- Needs at least 1 `FB-#` identifier — the items to decompose into stories
- Needs a clear problem statement and scope definition
- Each FB-# should have priority/importance indication
**prd.md** (ENRICHES):
- If exists, provides broader product context and existing PRD-F-# for cross-reference
**product-vision.md** (ENRICHES):
- If exists, provides personas and BO-# context
## OUTPUT VALIDATION
Before marking this document as COMPLETE:
### Common checks (both modes)
- [ ] Each US-# has 1-3 Given/When/Then acceptance criteria (not boilerplate)
- [ ] All Given/When/Then are specific and testable (concrete personas, measurable outcomes)
- [ ] Each US-# includes Dependencies section (upstream/downstream)
- [ ] Each US-# includes Technical Notes (at least 1 technical consideration)
- [ ] Each US-# includes Design Notes (at least 1 UI/UX requirement)
- [ ] Source Documents section present at top
### Product Mode checks
- [ ] At least 1 US-# per Must Have PRD-F-# (coverage)
- [ ] Each US-# references which PRD-F-# it implements (traceability)
- [ ] No orphan US-# without PRD-F-# reference
- [ ] Coverage matrix present (PRD-F-# × US-# table)
### Feature Mode checks
- [ ] At least 1 US-# per FB-# item (coverage)
- [ ] Each US-# references which FB-# it implements (traceability)
- [ ] No orphan US-# without FB-# reference
- [ ] Coverage matrix present (FB-# × US-# table)
If any check fails → mark document as DRAFT with `<!-- STATUS: DRAFT -->` at top.
## CLOSING SUMMARY
After saving and validating, display the summary and offer multiple next steps:
```text
user-stories.md saved to `docs/ets/projects/{project-slug}/planning/user-stories.md`
Status: [COMPLETE | DRAFT]
IDs generated: [list US-# IDs, e.g., US-1, US-2, US-3, ... US-N]
Features flagged for detailed spec: [list any, or "None"]
What would you like to do next?
1. Proceed to Feature Specs (Recommended if features were flagged) — Detail complex features with >3 business rules
2. Skip Feature Specs, proceed to Planning Gate — If no features need detailed specs
3. Refine these stories — Review and improve specific stories
4. Pause for now — Save and return later
Wait for the user's choice before proceeding. Do not auto-advance to the next skill.
Product mode:
prd.md (BLOCKS), product-vision.md (ENRICHES)Feature mode:
features/{feature-slug}/feature-brief.md (BLOCKS), product-vision.md (ENRICHES if exists)For each PRD-F-# (Must Have first, then Should Have):
2a. Feature introduction:
2b. Story drafting (one US-# per turn):
2c. Acceptance criteria — propose scenarios before writing:
2d. Edge case suggestions for Must Have stories:
2e. Story completion:
2f. Feature group approval:
docs/ets/projects/{project-slug}/planning/ — create if missingdocs/ets/projects/{project-slug}/planning/user-stories.md using the Write tooldocs/ets/projects/{project-slug}/features/{feature-slug}/ — create if missingdocs/ets/projects/{project-slug}/features/{feature-slug}/user-stories.md using the Write tooldocs/ets/projects/{project-slug}/planning/user-stories.md) + paths to upstream documents (BLOCKS: docs/ets/projects/{project-slug}/planning/prd.md)"Document saved to
docs/ets/projects/{project-slug}/planning/user-stories.md. The spec reviewer approved it. Please review and let me know if you want any changes before we proceed." Wait for the user's response. If they request changes, make them and re-run the spec review. Only proceed to validation after user approval.
| Error | Severity | Recovery | Fallback |
|---|---|---|---|
| BLOCKS dep missing (prd.md) | Critical | Auto-invoke prd skill | Block execution |
| prd.md has no PRD-F-# | Critical | Re-invoke prd with feedback | Block — stories need features |
| Feature too vague for stories | Medium | Ask user to clarify feature scope | Generate generic story with TODO |
| Output validation fails | High | Mark as DRAFT | Proceed with DRAFT status |
This skill supports iterative quality improvement when invoked by the orchestrator or user.
| Condition | Action | Document Status |
|---|---|---|
| Completeness ≥ 90% | Exit loop | COMPLETE |
| Improvement < 5% between iterations | Exit loop (diminishing returns) | DRAFT + notes |
| Max 3 iterations reached | Exit loop | DRAFT + iteration log |
--quality-loop on any skill invocation--no-quality-loop to disable (generates once, validates once)When the self-evaluation identifies a weakness (score < 7/10 on any criterion):
Example: If "acceptance criteria lack edge cases" is identified:
After saving the artifact and displaying the CLOSING SUMMARY, offer optional execution adapter projection:
"User stories saved. Would you like me to project these stories into an execution adapter?"
If the user says yes:
Check which execution_adapter is active in state/project-status.yaml.
If execution_adapter = none, explain that projection is optional and disabled for this project.
If an adapter is active:
docs/ets/projects/{project-slug}/state/execution-status.yamldocs/ets/projects/{project-slug}/state/execution-sync.yamlpython3 .claude/hooks/memory-write.py linear ...If the user says no, skip silently and proceed to handoff options.
Linear mapping layers:
# Linear Issue Mapping
| ETUS ID | Linear ID | Title | Status |
|---------|-----------|-------|--------|
| US-1 | LIN-123 | [title] | created |
docs/ets/.memory/linear-mapping.md — human-readable memory viewdocs/ets/projects/{project-slug}/state/execution-sync.yaml — operational sync state and local projectionTogether they bridge ETUS docs and the chosen execution adapter without losing the ETUS documentation core.