Requirements Engineer

All guides

How to Write a User Story: Template, Example and Acceptance Criteria

A user story describes a requirement from the point of view of the people who use the product. This guide gives you a template, a complete example with acceptance criteria and a checklist for reviewing your own stories.

Write a user story with AI

A user story describes what users need and why

A user story captures who wants something, what they want and why it matters to them. It describes the problem and the benefit. The team works out the technical solution in conversation and keeps it out of the story. Ron Jeffries summed this up in 2001 with three words: the card, a short written note; the conversation, where the details get clarified; and the confirmation, the acceptance tests that show everyone the story is done.

A good story is small enough for a team to finish within one sprint. Its acceptance criteria can be tested. That makes it a solid basis for estimating, planning and testing.

In a backlog, the user story sits next to three other ticket types:

  • An epic is a larger initiative with a measurable goal. It is too big for one sprint and gets broken down into several user stories.
  • A task covers technical or organizational work without direct user value, such as a database upgrade.
  • A bug report describes a defect in the existing product and how to reproduce it.

If a person can do something after the change that they could not do before, you are looking at a user story. If only the team notices the difference, it is probably a task.

User story template and structure

At its core, a user story is one sentence with three parts:

Template

As a <role>, I want to <goal>, so that <benefit>.

The role names a specific group of users, such as "customer with an open order" or "HR coordinator". "As a user" is too vague to guide any decision. The goal describes what the person wants to do or achieve, in their own words and without technical terms. The benefit explains why it matters to them, which helps the team decide what solution is good enough and what can be left out.

Acceptance criteria go below the sentence. They define when the story is complete. Write each criterion as a short statement about the expected behavior and number them AC 1, AC 2 and so on. The numbers let the team refer to a single criterion during planning and testing.

For a single story, three to six criteria are typical, covering the normal path as well as edge cases and error cases. Each criterion describes an outcome that a person or another system can observe. Teams that automate their tests also write criteria as Given/When/Then scenarios.

A complete story therefore has a short title, the role/goal/benefit sentence, a description with background where needed and the acceptance criteria. The title names the subject in a few words, such as "Change delivery address".

A good example from an online store

Customers of an online store call support when they have moved after placing an order or made a typo in their address. The store wants them to fix the address themselves. Here is the story:

Good example

Title Change delivery address after ordering

As a customer with an open order, I want to change the delivery address myself, so that my package arrives at the right place without me having to call support.

Description Today, support agents change addresses over the phone. A change is possible until the warehouse hands the package to the carrier.

Acceptance criteria

  • AC 1: For an order with the status "Processing", the customer can save a new delivery address in her account. The order then shows the new address and she receives a confirmation email.
  • AC 2: For an order with the status "Shipped", "Change address" is unavailable and a message explains why.
  • AC 3: If the ZIP code does not match the city, an error message appears next to the field on save and the original address stays in place.
  • AC 4: After a change, the shipping label shows the new address.
  • AC 5: If the address is in a country the store does not ship to, the store rejects the change and lists the countries it ships to.

The role narrows the scope to orders that are still open. The benefit explains the purpose: fewer calls to support. The criteria cover the normal case plus the "already shipped" limit, invalid input and an unsupported country. AC 4 makes sure the change reaches the warehouse. A tester can check each one without asking follow-up questions.

A weak example and what it is missing

Weak example

Title Address change

As a user, I want to be able to change the address.

Acceptance criteria

  • Address can be changed
  • Works fast
  • API endpoint PUT /orders/address exists

"As a user" does not say who this is for. It could mean the billing address in the customer account or the delivery address of an order in progress. Those are two different pieces of work. Without a benefit, the team cannot judge how far the solution needs to go.

The acceptance criteria give a tester very little to work with. "Can be changed" simply restates the goal. "Fast" cannot be measured without a number. The API endpoint prescribes a technical solution that belongs in a task, if anywhere. Edge cases are missing entirely, such as a package that has already shipped or an address with errors.

INVEST: six qualities of a good story

Bill Wake introduced the INVEST acronym in 2003. Each letter stands for a quality you can check a story against. The six qualities are:

  • Independent: The story can be scheduled and built in any order relative to other stories.
  • Negotiable: The story is not a fixed contract. The business side and the team work out the details together.
  • Valuable: The story delivers value to users or customers, beyond work that only matters to the team.
  • Estimable: The team understands the story well enough to give a rough estimate.
  • Small: Wake puts the upper limit at a few person-weeks of work. Some teams cap stories at a few person-days. Smaller stories are easier to estimate accurately.
  • Testable: You understand the story well enough that you could write a test for it.

How to spot a story that is too big and split it

Mountain Goat Software, the company founded by Mike Cohn, describes an epic as a large story that gets split into smaller ones before development. A story is too big if the team cannot finish it in one sprint or cannot estimate it. Other warning signs are words like "manage" or "and" in the goal, more than about six acceptance criteria and a long list of edge cases.

Split the story so that each piece delivers value on its own. Richard Lawrence and Peter Green of Humanizing Work advise against splitting by technical layer, such as front end, API and database. Those pieces may be small, but they fail the independent and valuable criteria. A vertical slice through all layers works better. These patterns help:

  • Workflow steps: Build the simple end-to-end path first and add middle steps and alternate paths later.
  • Operations: "Manage appointments" becomes "book an appointment", "reschedule an appointment" and "cancel an appointment".
  • Business rule variations: Each rule that leads to the same goal becomes its own story.
  • Simple first: The simplest version goes into the first story. Each variation gets a story of its own.
  • Defer performance: Make the feature work first, then make it faster or more robust.

Here is an example from online booking at a medical practice. "As a patient, I want to manage my appointments online" is too big. Split by operation, it becomes three stories. The first one reads "As a patient, I want to book an open appointment slot online, so that I don't have to call during office hours". Rescheduling and canceling follow as separate stories. The first story already delivers value on its own.

Common mistakes

  • The role is "user" or "system", so the person the story is for is missing.
  • The benefit is missing or repeats the goal, as in "so that I can change the address".
  • The story prescribes a solution, such as a dropdown menu or a database table.
  • The acceptance criteria only cover the happy path and leave out errors, limits and empty input.
  • Criteria use vague words like "user-friendly" or "fast".
  • The story is a task in disguise, as in "As a developer, I want to upgrade the framework".
  • Several goals are packed into one story, which makes it too big.

Checklist for reviewing a user story

  1. The role names a specific group of users.
  2. The goal describes what the person wants to achieve, without a technical solution.
  3. The benefit explains why the person needs it.
  4. There are three to six acceptance criteria, numbered AC 1, AC 2 and so on.
  5. At least one criterion covers an edge case or error case.
  6. Every criterion describes an outcome someone can observe.
  7. The team can estimate the effort and the story fits into one sprint.
  8. The story delivers value on its own, even if no other story is built.

Write and review user stories with AI

This site offers a free tool that helps you write tickets. You describe what you need in your own words. In guided mode, the AI asks up to three questions per round and explains what each detail is for. It then writes the story with role, goal, benefit and acceptance criteria and reviews it against the six INVEST criteria. Anything the AI filled in on its own is listed separately so you can check it. Create a ticket with AI

Frequently asked questions

Does every user story have to follow the As a/I want/so that template?

The template is a thinking aid. Mountain Goat Software says it is useful as long as it improves the team's conversation and should not turn into a ritual. For beginners it is still worth using, because it makes you name the role and the benefit.

How many acceptance criteria should a user story have?

Three to six is typical. With fewer, edge cases are usually missing. With many more, the story is often too big and should be split.

What is the difference between acceptance criteria and the definition of done?

Acceptance criteria apply to one story and describe its expected behavior. The definition of done applies to every story a team delivers, with items such as "code has been reviewed" or "tests run automatically". A story is done when both are met.

Who writes user stories?

The product owner is usually responsible for them. Anyone on the team or in the business can write one, though. The details come out of conversations between business, development and testing, which is what Ron Jeffries meant by "conversation".

How big can a user story be?

It has to fit into one sprint. Bill Wake gives a few person-weeks as the upper limit. Many teams aim for stories of a few days. If the team cannot estimate the effort, the story is usually too big or still unclear.

Do technical details belong in a user story?

Technical solutions stay out of the sentence and the acceptance criteria. Business constraints such as legal deadlines or required partner interfaces can go in the description. The team plans the implementation in separate tasks under the story.

Sources

Last updated: