Sub topic 7
Writing user stories with acceptance criteria
This chapter assumes you know what a PRD is and have a problem statement, goals, and a description of your target users. It covers how to turn a use case into a user story, and how to attach acceptance criteria that engineers and testers can check as pass or fail.
Where user stories fit
A use case describes a situation: a team admin needs to share the member list with finance. A user story breaks that situation into a unit of work that a team can build and verify. In the PRD, stories sit between the users and use cases section and the requirements section. They show why a requirement exists, and acceptance criteria show when it is done.
Stories are not a replacement for requirements. A story states intent from the user's side. A requirement states what the system must do. Many teams write the story first, then derive one or more numbered requirements from it. The next chapter covers that second step.
The anatomy of a user story
The common template has three parts:
> As a role, I want capability so that benefit.
Each part has a job.
- Role: a specific user type from your users section, such as "team admin". Avoid "user" when a more precise role exists, because permissions and needs differ by role.
- Capability: what the person wants to do, described from their point of view, not as a screen or a database operation.
- Benefit: the reason. This is the part most often dropped, and it is the most useful for design and trade-off decisions. If an engineer knows the admin wants to share the list with finance, they can judge whether CSV is enough or whether a spreadsheet link would serve better.
Here is a complete example, which the rest of this chapter extends:
**User story:** As a team admin, I want to export the member list as a CSV file so that I can share it with finance.Checking story quality
A widely used checklist is INVEST. It helps you spot stories that will cause trouble later.
| Letter | Meaning | Warning sign |
|---|---|---|
| Independent | Can be built and delivered without another story | "This only works after story 7 ships" |
| Negotiable | Describes need, not a fixed solution | The story dictates button colors and layout |
| Valuable | Gives a user or the business something | The benefit clause is empty or circular |
| Estimable | Engineers can size it | Nobody can say if it takes a day or a quarter |
| Small | Fits within one iteration | The story contains "and" several times |
| Testable | You can tell when it is done | The criteria use words like "fast" or "intuitive" |
Treat INVEST as a prompt for discussion, not a scoring system. A story that fails one letter is a signal to revise it, not to discard it.
Acceptance criteria
Acceptance criteria are the conditions a story must meet to count as done. They convert a goal into something you can check. Good criteria have these properties:
- Binary: each one passes or fails. There is no "mostly".
- Observable: a tester can see the result without reading the code.
- Specific to this story: they do not repeat general quality rules that apply to everything.
- Independent of implementation: they say what happens, not how it is built.
The Given/When/Then format
Given/When/Then, from behavior-driven development, is the most common structure. Each criterion is a short scenario:
- Given the starting state or context.
- When the user or system takes an action.
- Then the observable result.
**Acceptance criteria:**
- Given I am a team admin, when I choose Export, then a CSV file with one row per member is downloaded.
- Given I am not a team admin, when I open the member list, then the Export option is not shown.The second criterion matters as much as the first. It describes a negative case, where the feature must not be available. Writing only the happy path is the most common gap in acceptance criteria.
A checklist alternative
Given/When/Then suits behavior that depends on state or role. For simpler stories, a plain checklist of rules works better and is easier to read:
- The export file uses UTF-8 encoding.
- The header row contains the column names.
- The file name includes the team name and export date.
Use whichever format makes the condition clearest. Mixing both in one story is fine. Forcing Given/When/Then onto a rule like "the file is UTF-8" only adds words.
Covering the edge cases
A story with only the happy path leaves engineers to guess the rest, and they may guess differently from you. Walk through these categories for each story:
- Empty states: What happens when the team has no members? Does the export produce a header-only file, or does the system show a message?
- Boundaries: What happens with 10,000 members? Is there a limit, and what does the user see when they reach it?
- Permissions: Who can do this, and who cannot? What does a blocked user see?
- Errors: What happens if the download fails or the session expires partway through?
- Concurrent or changing data: If a member is added during export, is that person included?
Not every category applies to every story. When one does apply and you do not know the answer, do not invent it. Add the question to the open questions section of the PRD and attach an owner. A visible open question is better than a silent assumption.
Extending the earlier example with these cases:
**Acceptance criteria (extended):**
- Given I am a team admin, when I choose Export, then a CSV file with one row per member is downloaded.
- Given I am not a team admin, when I open the member list, then the Export option is not shown.
- Given my team has no members other than me, when I choose Export, then the file contains the header row and one row for me.
- Given the export fails, when I choose Export, then I see an error message and can try again.Common mistakes
| Mistake | Example | Fix |
|---|---|---|
| Vague criterion | "The export is fast." | Give a measurable condition, such as "A team of 5,000 members exports in under 10 seconds." Treat this as a non-functional requirement if it applies broadly. |
| Solution in the story | "As an admin, I want a blue button in the top right." | Describe the need and leave layout to design. |
| Missing benefit | "As an admin, I want to export members." | Add the "so that" clause and check that it is real. |
| Giant story | "As an admin, I want to manage my team." | Split it by action: invite, remove, export, change role. |
| Criteria that restate the story | "The admin can export." | Describe the observable result and its conditions. |
| Only happy paths | No error, empty, or permission cases | Walk the edge case categories above. |
| Technical role | "As the database, I need an index." | Write the story for a person, and put technical work in requirements or engineering tasks. |
Splitting a large story
When a story is too big, split it along a seam that still delivers value. Useful seams include:
- Workflow steps: import, review, confirm.
- Roles: admin first, other roles later.
- Rules or variations: a single file format first, other formats later.
- Happy path first: basic success case now, advanced error handling next.
Do not split by technical layer, such as "build the API" and "build the screen". Neither half gives a user anything on its own, so neither can be tested by a user.
Keeping stories useful in the PRD
A PRD does not need every story the team will ever write. Include the stories that explain the main use cases and the ones with unusual or risky behavior. Leave routine detail to the team's tracker, and link to it. Each story in the PRD should be traceable: a reader should see which goal it supports and which requirement ID it produces.
A simple approach is to give each story an ID and reference it from the requirements table:
| Story | Supports goal | Requirements |
|---|---|---|
| US-1 Export member list | Reduce manual reporting requests | FR-1, FR-2 |Reviewers can then see quickly whether a goal has no stories behind it, or a story has no goal.
Exercises
Exercise
A story reads: "As a user, I want the dashboard to be better so that I am happier." Name three problems with it and rewrite it for a hypothetical analytics product where managers often cannot find last week's report.
Show answer
Problems: "user" is not a specific role, "better" is not observable or testable, and "happier" is not a real benefit. A rewrite: "As a team manager, I want to open last week's report from the dashboard home page so that I can prepare for Monday's review without searching the archive." Acceptance criteria: Given I am a team manager, when I open the dashboard home page, then I see a link to the previous week's report. Given no report exists for last week, when I open the home page, then I see a message saying so instead of a broken link.
Exercise
Write Given/When/Then acceptance criteria for this story, including one negative case and one error case: "As a customer, I want to reset my password by email so that I can regain access to my account."
Show answer
Sample answer. Given I have a registered email address, when I request a reset, then I receive an email with a reset link. Given I enter an email that is not registered, when I request a reset, then I see the same confirmation message as for a registered address, so the system does not reveal which emails have accounts. Given my reset link has expired, when I open it, then I see a message that the link has expired and an option to request a new one. Other valid answers cover link reuse or password rules, as long as each criterion is observable and passes or fails.
Exercise
Why is "As an engineer, I want to add a database index so that queries are faster" a poor user story, and where should that content go instead?
Show answer
The role is not a user of the product, and the benefit is internal. No user can accept or reject the result directly. The content belongs in a non-functional requirement, such as "Searching the member list returns results within a stated time for a stated data size," or in an engineering task that supports it.