User story writing

From FerroxLabs/wayland · View interactive version

User story writing is an AI agent skill from the GitHub repository FerroxLabs/wayland. Writes agile user stories in standard format with acceptance criteria, definition of done, story point estimation guidance, and sprint-ready breakdown. Use when the user asks about user stories, writing user stories, acceptance criteria, agile story format, or backlog grooming. Do NOT use for full P

How to use this skill

Skill file

User Story Writing

When to Use

Use this skill when:

Do NOT use this skill when:


Process

1. Gather Context Before Writing Anything

Before producing a single story, collect the inputs that determine story quality. Skipping this step produces generic, low-value stories that will be rewritten in refinement.

2. Identify the User Flows and Decompose Vertically

Map the complete user journey for the feature before writing individual stories. This prevents missing stories and ensures each story delivers a true vertical slice.

3. Write Each Story in the Standard Format

The three-clause format ("As a / I want to / So that") is a communication tool, not a bureaucratic template. Every word choice matters.

4. Write Acceptance Criteria Using Given/When/Then

Acceptance criteria are the contractual definition of "done" for a specific story. They must be precise enough for a QA engineer to write test cases directly from them.

5. Apply the INVEST Test as a Quality Gate

After drafting stories, run each one through INVEST. This is not a checkbox exercise -- it is a diagnostic tool that reveals structural problems.

6. Define or Confirm the Definition of Done

The Definition of Done (DoD) is a team-level contract, not story-level -- but it must be confirmed or established before finalizing stories.

7. Estimate with Relative Story Points

If the user requests estimation guidance, apply the Fibonacci-relative approach. Do not assign hours.

8. Organize and Deliver the Story Set

The final deliverable is a coherent, prioritized, sprint-ready story set -- not a list of disconnected items.


Output Format

## User Stories: [Feature/Epic Name]

### Epic Summary
[1-2 sentences describing the overall feature, the user problem it solves, and the business outcome expected.]

### Definition of Done (Team Standard)
- [ ] Code written, peer-reviewed (≥1 approver), and merged to main branch
- [ ] Unit tests passing; ≥80% line coverage for new code paths
- [ ] Acceptance criteria verified in staging environment by PO or QA
- [ ] No open critical (P0) or high (P1) severity bugs on this story
- [ ] User-visible changes reflected in changelog or release notes
- [ ] Accessibility criteria verified for all UI changes (WCAG 2.1 AA)
- [ ] Security review completed if story touches authentication, payments, or PII

---

### Story Map (for epics with 5+ stories)

| User Flow Step         | P0 (MVP)           | P1 (Next Sprint)   | P2 (Future)        |
|------------------------|--------------------|--------------------|---------------------|
| [Flow Step 1]          | Story 1            | Story 6            |                     |
| [Flow Step 2]          | Story 2, Story 3   | Story 7            | Story 10            |
| [Flow Step 3]          | Story 4, Story 5   |                    | Story 11            |

---

### Stories

---

#### Story [N]: [Short, active-noun-phrase title]
**Priority:** [P0 / P1 / P2]
**Estimate:** [1 / 2 / 3 / 5 / 8] points
**Depends on:** [Story X, or "None"]

**As a** [specific, named persona or role in context],
**I want to** [concrete, user-initiated action],
**So that** [business or user outcome that explains the value].

**Acceptance Criteria:**
- [ ] **[Happy Path]** Given [preconditions], when [user action], then [observable system outcome]
- [ ] **[Happy Path]** Given [preconditions], when [user action], then [observable system outcome]
- [ ] **[Alternative Path]** Given [edge condition], when [user action], then [expected behavior]
- [ ] **[Error State]** Given [invalid or failure condition], when [user action], then [error behavior and recovery path]
- [ ] **[Performance / Security / Accessibility]** [Specific measurable criterion]

**Open Questions:** [Any unresolved design, business rule, or technical question blocking finalization -- or "None"]
**Notes:** [Implementation hints, design references, constraints, or dependencies worth flagging -- keep these brief and optional]

---

*(Repeat Story block for each story)*

---

### Spike (if applicable)

#### Spike: [Investigation Title]
**Time Box:** [X hours]
**Question to Answer:** [The specific decision or uncertainty this spike resolves]
**Output:** [Document, decision log, ADR, or set of estimable stories]
**Acceptance:** Team can produce point estimates for dependent stories after spike is complete.

---

### Backlog Summary Table

| Story # | Title                        | Priority | Estimate | Depends On |
|---------|------------------------------|----------|----------|------------|
| 1       | [Story title]                | P0       | 3 pts    | None       |
| 2       | [Story title]                | P0       | 5 pts    | Story 1    |
| 3       | [Story title]                | P1       | 2 pts    | Story 2    |
| Total   |                              |          | XX pts   |            |

Rules

  1. Never write a story without acceptance criteria. A story without AC is a wish list item, not a requirement. Any story entered into a sprint without AC will generate scope debate mid-sprint. If AC cannot be written yet, the story is not refinement-ready -- create a spike instead.
  1. Always use the most specific persona the context supports. "User" is the last resort. "Returning customer with saved payment methods" is a persona. "Enterprise IT admin with tenant management permissions" is a persona. Specificity drives better AC and prevents the team from building for an imaginary average user.
  1. The "So that" clause must survive the "so what?" challenge. Read it aloud and ask "so what?" If the answer is obvious or adds more value, the clause is too shallow. "So that I can log in faster" barely passes. "So that I can access my dashboard without re-entering credentials every session, reducing friction for daily active use" passes clearly.
  1. Acceptance criteria must be binary pass/fail. "The UI looks clean" is not a criterion. "All form inputs have a 4px border-radius and match the design system token border-radius-sm" is a criterion. If a QA engineer cannot mark it green or red in a test run, rewrite it.
  1. Stories must represent vertical slices, not horizontal layers. A database migration, an API endpoint, or a React component are tasks -- they do not deliver user value in isolation. Every story must touch every layer needed to deliver a visible user outcome, even if those layers are thin. "User can view their account email address" is a thin vertical slice. "Build the user profile API endpoint" is a horizontal layer.
  1. Stories estimated above 8 points must be split before sprint entry. There are no legitimate exceptions to this rule for sprint-level planning. If a story "cannot be split," it is not a story -- it is a design failure. Apply the SPIDR model to find the split axis.
  1. Include at least one error state or failure scenario in every story's acceptance criteria. Happy-path-only stories produce happy-path-only implementations. Engineers build what is specified. If error handling is not in the AC, it will not be built, tested, or consistent.
  1. Never embed implementation decisions in the story narrative. "User can search products" is a story. "User can search products using an Elasticsearch full-text query with a BM25 relevance scorer" is a story with a technical constraint embedded in the narrative. Move technology decisions to Notes or the technical specification. The story describes the what and why; the team decides the how.
  1. Mark every story with a priority label (P0/P1/P2) before handing it to the team. Unprioritized backlogs turn refinement sessions into priority debates. P0 means the sprint or release fails without it. P1 means it is important but the sprint is still valuable if it slips. P2 means it is a planned enhancement that can be deferred without user impact.
  1. Flag every cross-story dependency explicitly using a "Depends on" field. Implicit dependencies are the leading cause of blocked sprint work. If a story cannot start because another story's API does not exist yet, that dependency must be surfaced in writing at story creation time -- not discovered during the sprint when it becomes a blocker.
  1. Do not conflate the Definition of Done with acceptance criteria. DoD applies to every story uniformly (code review, tests passing, deployed to staging). AC is story-specific (this particular behavior works this particular way). Mixing them produces stories where "tests must pass" appears as AC -- which is redundant noise that obscures the actual behavioral requirements.
  1. Accessibility and security criteria are not optional in UI and auth stories. For any story touching form inputs, user authentication, PII display, payment data, or navigation: add the relevant WCAG 2.1 AA criterion and the relevant security criterion explicitly. "Accessibility will be handled separately" is a deferral that becomes technical debt within one release.

Edge Cases

API-Only or Headless System Stories

When writing stories for backend services, data pipelines, or integrations with no direct human-facing UI, replace the human persona with the consuming system or downstream user. "As the order management service, I want to receive a webhook notification when payment is confirmed, so that I can initiate the fulfillment workflow without polling the payment service." The value clause explains why this integration matters at the system level. Acceptance criteria should cover payload structure, retry behavior on failed delivery, and idempotency requirements ("Given the same webhook fires twice, when the service processes it, then only one fulfillment workflow is created").

Stories Written for Compliance or Regulatory Requirements

Compliance stories (GDPR right-to-erasure, HIPAA audit logging, ADA accessibility, PCI DSS cardholder data isolation) have mandatory, non-negotiable acceptance criteria. Do not mark these as P1 or P2 -- they are P0 by legal obligation. The AC must reference the specific standard and clause: "Given a user submits a data deletion request, when the request is processed, then all PII is permanently deleted from primary storage within 30 days per GDPR Article 17." Include compliance reference numbers in the Notes field for traceability to audit requirements.

Migrating Legacy Functionality to a New System

When a story describes re-implementing existing behavior in a new platform, add a "behavioral parity" acceptance criterion explicitly: "Given the user performs [action X], when the new system processes it, then the result matches the behavior of the legacy system for all data that existed before [migration date]." Also write a parallel "migration story" for data transition if applicable. Treat regression of existing behavior as a P0 defect, not a P1 enhancement.

Stories With High Business Rule Complexity

When a single user action triggers five or more distinct business rules (pricing engine calculations, multi-tier approval workflows, eligibility checks), the story will exceed 7 AC and should be decomposed. Use the SPIDR "Rules" axis: write one story per business rule variant. "User can apply a standard discount code" is one story. "User can apply a stacked loyalty + promotional discount" is a separate story. Each will have its own AC covering the specific rule logic. If the rules are not yet documented, create a spike to extract and document them before writing stories.

Bug Fix as a User Story

Reframe bugs as user stories from the affected user's perspective rather than as technical fix descriptions. "Fix null pointer exception in cart total calculation" is a task. "As a customer, I want my cart total to include all applied discounts correctly, so that I am not surprised by an unexpected charge at checkout" is a story. Acceptance criteria include: the corrected behavior, the specific scenario that was broken (as a regression test case), and confirmation that existing correct scenarios still pass. Add a "Regression" label so the team knows to add a permanent automated test for this path.

Spike for Unknown Technical Feasibility

When a feature requires technology the team has no experience with, or when the implementation space is genuinely unknown, write a spike instead of a story. Spike format: title starts with "Spike:", states the explicit question being answered ("Can we achieve sub-100ms geolocation lookups using the existing infrastructure without adding a new service?"), defines the time box in hours (never more than one sprint's worth of a single engineer's time -- typically 4-16 hours), and specifies the output artifact ("Decision document with two implementation options, rough complexity estimates, and a recommended approach"). The spike's acceptance criterion is always: "The team can estimate related user stories after the spike is complete." Do not create an open-ended investigation without a time box -- it will expand to fill all available time.

Cross-Platform Features (Web, iOS, Android)

Write one platform-agnostic story capturing the user behavior, then add platform-specific acceptance criteria within the same story. "As a customer, I want to receive a push notification when my order ships, so that I know when to expect my delivery" applies to all platforms. Platform-specific AC then follows: "On iOS: notification is delivered via APNs; user is prompted for notification permissions on first trigger if not previously granted; tapping the notification opens the Order Detail screen." "On Android: notification is delivered via FCM; notification channel 'Order Updates' is registered; tapping the notification deep-links to the Order Detail screen." If the platform implementations diverge significantly in complexity or timing, split into platform-specific stories -- but only if their estimates would differ by more than one Fibonacci size.

Stories Inherited From Stakeholder Feature Requests or Sales Commitments

When a story originates from a committed customer feature request or a sales promise, flag it with a "Committed" label and include the commitment context in the Notes field ("Committed to [Customer Name] for [Release X] per sales contract dated [date]"). This changes the P0/P1/P2 framework -- a committed story is P0 by obligation regardless of its internal value ranking. The team needs this context to avoid deprioritizing it during planning. AC for committed stories should be reviewed with the customer-facing team to ensure the implementation will satisfy the actual customer expectation, not just an internal interpretation.


Example

Input: "We're building a multi-step onboarding flow for a B2B SaaS product. New users need to set up their company account after signing up. It involves entering company details, inviting team members, and connecting their first integration. I need sprint-ready stories for this."


User Stories: Company Onboarding Flow

Epic Summary

Enable newly registered B2B users to activate their company account end-to-end -- including setting up their company profile, inviting teammates, and connecting a first integration -- so that the team is functional on day one without requiring support intervention.

Definition of Done (Team Standard)


Story Map

| User Flow Step | P0 (Sprint 1 MVP) | P1 (Sprint 2) | P2 (Future) |

|---------------------------|----------------------------|-----------------------------|------------------------------|

| Company Profile Setup | Story 1 | Story 6 (logo upload) | |

| Team Member Invitation | Story 2, Story 3 | Story 7 (bulk CSV import) | Story 10 (SSO provisioning) |

| Integration Connection | Story 4 | Story 8 (OAuth retry flow) | Story 11 (multi-integration) |

| Onboarding Completion | Story 5 | Story 9 (completion email) | |


Stories


Story 1: Set Up Company Profile During Onboarding

Priority: P0

Estimate: 3 points

Depends on: None (entry point of the onboarding flow)

As a newly registered account admin completing onboarding for the first time,

I want to enter my company name, industry, and team size,

So that the product can be configured with relevant defaults and my teammates see our company context when they join.

Acceptance Criteria:

Open Questions: What are the industry categories -- does product have a finalized list, or should we use a standard taxonomy (NAICS, SIC)? Blocks: dropdown implementation.

Notes: Progress persistence for partial completion should use local storage as a fallback if the user is not authenticated mid-flow.


Story 2: Invite Team Members by Email During Onboarding

Priority: P0

Estimate: 5 points

Depends on: Story 1 (company profile must exist before invitations can be associated with it)

As a newly registered account admin setting up their company workspace,

I want to enter email addresses for my teammates and send them invitation emails during onboarding,

So that my team can access the product immediately after setup without me having to remember to do it later from the Settings page.

Acceptance Criteria:

Open Questions: Should invited users receive the role "Member" by default, or should the admin assign roles at invite time? Design has not confirmed role selection UI.

Notes: Invitation email template is owned by the marketing/comms team -- confirm copy before sprint starts.


Story 3: Accept a Team Invitation and Join the Company Workspace

Priority: P0

Estimate: 3 points

Depends on: Story 2 (invitations must be sent before they can be accepted)

As a team member who received an invitation email from my company admin,

I want to click the invitation link, set my password, and access the shared company workspace,

So that I can start using the product with my team's existing configuration without needing to set anything up myself.

Acceptance Criteria:

Open Questions: None -- requirements are clear.

Notes: This story reuses the registration form component from direct signup but with the email field locked. Confirm with engineering that the invite token is validated server-side, not client-side.


Story 4: Connect First Integration During Onboarding

Priority: P0

Estimate: 8 points

Depends on: Story 1 (company profile must exist to associate the integration)

As a account admin completing onboarding,

I want to connect one of our supported integrations (CRM, helpdesk, or project management tool) during setup,

So that the product has live data to work with from day one, increasing the likelihood we see value in the first session.

Acceptance Criteria:

Open Questions: Do we support all 6 integrations at MVP, or only 3? Product needs to confirm the integration launch set before this story can be estimated confidently -- current estimate assumes 3 integrations with existing OAuth library support.

Notes: If the integration set is not confirmed before sprint, recommend timebox spike (4 hours) to audit OAuth library support and confirm per-integration effort. This story may need to be split by integration type if complexity varies significantly.


Story 5: Complete Onboarding and Reach the Product Dashboard

Priority: P0

Estimate: 2 points

Depends on: Story 1 (profile required), Story 2 or Story 4 (at least one other step attempted)

As a new account admin who has completed the required onboarding steps,

I want to see a confirmation screen summarizing what I set up and navigate to the product dashboard,

So that I have a clear sense of completion and know where to go next without feeling abandoned mid-flow.

Acceptance Criteria:

Open Questions: None.

Notes: The onboarding_completed event is required by the growth team for activation rate tracking. Do not defer this criterion.


Story 6: Upload Company Logo During Profile Setup (P1)

Priority: P1

Estimate: 3 points

Depends on: Story 1

As a account admin who has already set up the company profile,

I want to upload a company logo image to the account,

So that the workspace feels branded for my team when they log in and on any customer-facing exports.

Acceptance Criteria:

Open Questions: Should we auto-crop to a square, or show a crop/resize interface? UX has not confirmed.

Notes: Image processing should be done server-side; do not store raw uploads in user-accessible storage without access controls.


Backlog Summary Table

| Story # | Title | Priority | Estimate | Depends On |

|---------|------------------------------------------------|----------|-----------|------------------|

| 1 | Set up company profile during onboarding | P0 | 3 pts | None |

| 2 | Invite team members by email during onboarding | P0 | 5 pts | Story 1 |

| 3 | Accept invitation and join workspace | P0 | 3 pts | Story 2 |

| 4 | Connect first integration during onboarding | P0 | 8 pts | Story 1 |

| 5 | Complete onboarding and reach dashboard | P0 | 2 pts | Story 1 + 2 or 4 |

| 6 | Upload company logo (P1) | P1 | 3 pts | Story 1 |

| Total P0 | | | 21 pts| |

| Total P1 | | | 3 pts | |

Sprint readiness note: At 21 points for P0 stories, this is at the high end of a standard 2-week sprint velocity (typically 20-30 points for a 4-6 person team). Story 4 (integration connection, 8 points) should be the first candidate to defer to a second sprint if velocity does not support it -- the onboarding flow is still functional without it. Confirm with the team during planning.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.