Inferensys

Prompt

User Story Narrative to Acceptance Criteria Prompt Template

A practical prompt playbook for converting narrative user stories into structured, testable acceptance criteria records in production AI workflows.
Elegant overhead shot of a polished wooden communal table in a sun-drenched WeWork lounge, laptops and tablets displaying AI workflow dashboards, plants and pendant lights in background.
PROMPT PLAYBOOK

When to Use This Prompt

Define the job-to-be-done, ideal user, required context, and when not to use this prompt for converting narrative user stories into structured acceptance criteria.

This prompt is designed for product engineering teams that need to convert free-text user story narratives into structured, testable acceptance criteria. The primary job-to-be-done is transforming a human-readable story like 'As a user, I want to reset my password so I can regain access to my account' into a typed record containing Given-When-Then scenarios, edge cases, and non-functional requirements. The ideal user is a product manager, technical lead, or QA engineer who needs to move from a narrative requirement to a machine-readable specification that can feed into test management tools, ticketing systems, or automated test generation pipelines. The prompt assumes you already have a well-formed user story narrative as input—it does not help you write the story itself.

Use this prompt when you have a complete user story narrative and need to produce structured acceptance criteria that are individually testable and collectively exhaustive. The prompt is particularly valuable in workflows where downstream systems expect typed records with fields like scenarios, edge_cases, and non_functional_requirements. It works best when the input story follows a standard format (role, goal, benefit) and contains enough detail to derive meaningful test conditions. The prompt includes validation checks for testability—each scenario must have observable preconditions, actions, and outcomes—and for scenario completeness, flagging missing edge cases or ambiguous acceptance conditions. For high-risk domains such as healthcare, finance, or safety-critical systems, you must add a human review step before accepting the generated criteria as requirements.

Do not use this prompt when the input is a vague one-line feature request, a bug report, or a technical task description that lacks a user-facing narrative. It is not designed for converting Jira tickets, support issues, or architectural decisions into acceptance criteria. If your input is a bug report, use the Bug Report Narrative to Structured Issue Prompt Template instead. If you need to extract requirements from meeting transcripts, use the Meeting Transcript to Action Items JSON Prompt Template. Avoid using this prompt when the story contains conflicting or contradictory statements without first resolving them—the model will produce criteria that inherit those conflicts. For stories that span multiple user roles or subsystems, consider splitting them into separate prompts per role to keep the acceptance criteria focused and testable.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt works and where it does not. Use these cards to decide if this template fits your workflow before you integrate it.

01

Good Fit: Narrative-to-Test Conversion

Use when: product teams write user stories in prose and need structured acceptance criteria with Given-When-Then scenarios. Guardrail: always include a concrete persona and goal in the input narrative; vague stories produce vague criteria.

02

Bad Fit: Regulatory or Safety-Critical Requirements

Avoid when: acceptance criteria carry compliance obligations (FDA, aviation, payments). Guardrail: generated criteria must pass human review and traceability checks before entering any regulated requirement system.

03

Required Inputs

What to watch: missing persona, missing goal, or missing constraints in the input narrative. Guardrail: validate that [USER_STORY] contains a clear actor, action, and outcome before calling the prompt; reject or flag incomplete inputs.

04

Operational Risk: Hallucinated Edge Cases

What to watch: the model invents edge cases or non-functional requirements not implied by the source story. Guardrail: diff generated criteria against the input narrative; flag any scenario or NFR without textual support for human removal.

05

Operational Risk: Untestable Criteria

What to watch: criteria phrased as vague goals ('the system should be fast') rather than testable conditions. Guardrail: run a post-generation validator that checks each criterion for measurable conditions; re-prompt or escalate untestable items.

06

Pipeline Integration

What to watch: direct injection of generated criteria into a test management tool without review. Guardrail: insert a human approval step or confidence threshold gate before the output reaches Jira, TestRail, or CI/CD pipelines.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for converting narrative user stories into structured, testable acceptance criteria records.

This prompt template converts a free-text user story narrative into a structured JSON payload of acceptance criteria. It is designed for product engineering teams who need to move from a natural-language description of a feature to a set of testable, well-formed scenarios that can be consumed by test management tools, ticketing systems, or automated test harnesses. The template enforces Given-When-Then structure, requires edge case identification, and separates functional from non-functional requirements. Use this template when the input is a coherent user story narrative and the desired output is a machine-readable set of criteria. Do not use it for bug reports, technical tasks, or architectural epics without adapting the output schema.

text
You are a requirements engineer converting a narrative user story into structured acceptance criteria.

INPUT USER STORY:
[USER_STORY_NARRATIVE]

OUTPUT SCHEMA:
{
  "story_summary": "<one-sentence summary of the user story>",
  "actor": "<the primary user or persona>",
  "goal": "<what the actor wants to accomplish>",
  "acceptance_criteria": [
    {
      "id": "AC-001",
      "scenario": "<descriptive name of the scenario>",
      "given": "<precondition or initial state>",
      "when": "<trigger or action>",
      "then": "<expected outcome, observable and testable>",
      "priority": "must-have | should-have | nice-to-have"
    }
  ],
  "edge_cases": [
    {
      "id": "EC-001",
      "condition": "<description of the edge condition>",
      "expected_behavior": "<how the system should handle it>",
      "recovery_action": "<fallback or error handling, if applicable>"
    }
  ],
  "non_functional_requirements": [
    {
      "id": "NFR-001",
      "category": "performance | security | accessibility | usability | reliability",
      "requirement": "<measurable requirement>",
      "measurement": "<how to verify it>"
    }
  ],
  "assumptions": ["<assumption made during criteria generation>"],
  "ambiguities": ["<unresolved ambiguity in the source narrative that needs clarification>"]
}

CONSTRAINTS:
- Every acceptance criterion must be independently testable.
- Given-When-Then statements must use concrete, observable conditions, not vague adjectives.
- Edge cases must include conditions not explicitly mentioned in the narrative but reasonably expected in production.
- Non-functional requirements must be measurable. Do not invent requirements not implied by the story.
- If the narrative is too vague to produce testable criteria, list the ambiguities and produce partial criteria with explicit assumptions.
- Do not add features or behavior not present in the source narrative.
- Assign priorities based on the narrative's emphasis. Default to "must-have" if unclear.

EXAMPLES:
[FEW_SHOT_EXAMPLES]

RISK LEVEL: [RISK_LEVEL]

To adapt this template, replace the square-bracket placeholders with your specific inputs. [USER_STORY_NARRATIVE] should contain the full text of the user story as written by the product owner or stakeholder. [FEW_SHOT_EXAMPLES] should include one or two worked examples showing a narrative and its corresponding structured output, which dramatically improves output consistency. [RISK_LEVEL] should be set to low, medium, or high to adjust the model's conservatism—high-risk domains like healthcare or finance should trigger more conservative criteria generation and flag more ambiguities. After generating the output, validate the JSON structure programmatically before ingestion. For high-risk workflows, require a human reviewer to confirm that no criteria were hallucinated and that edge cases are realistic. Run an eval suite that checks: (1) every AC has all required fields populated, (2) Given-When-Then statements contain no placeholder text, (3) edge case count is non-zero for non-trivial stories, and (4) ambiguities are listed when the narrative is genuinely underspecified.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the User Story Narrative to Acceptance Criteria prompt. Each placeholder must be populated before the prompt is assembled and sent. Validation notes describe how to programmatically check that the input is fit for purpose before incurring model cost.

PlaceholderPurposeExampleValidation Notes

[USER_STORY_NARRATIVE]

The raw user story text written in natural language. This is the primary input the model will parse and structure.

As a frequent flyer, I want to check in online so that I can skip the airport counter.

Check: string length > 20 chars. Reject if empty or contains only whitespace. Warn if length > 4000 tokens to avoid context truncation.

[PERSONA_ROLE]

The role or persona requesting the feature. Used to ground acceptance criteria in a specific user context.

Frequent Flyer

Check: non-empty string. Validate against a known persona list if available. Reject if generic placeholder like 'user' is detected when specific roles exist.

[OUTPUT_SCHEMA]

The target JSON schema or typed record definition the model must conform to. Defines the shape of the acceptance criteria output.

{"type": "object", "properties": {"criteria_id": {"type": "string"}, "scenario": {"type": "string"}, "given": {"type": "string"}, "when": {"type": "string"}, "then": {"type": "string"}, "edge_cases": {"type": "array"}, "non_functional": {"type": "array"}}, "required": ["criteria_id", "scenario", "given", "when", "then"]}

Check: valid JSON parse. Schema must include 'required' field array. Reject if schema allows arbitrary additional properties without explicit 'additionalProperties: false'.

[DOMAIN_CONTEXT]

Optional domain-specific terminology, business rules, or system constraints that the model must respect when writing acceptance criteria.

Check-in window opens 24 hours before departure. Seat selection is included. Boarding pass must be mobile-friendly.

Check: string or null allowed. If provided, length > 10 chars. Warn if context contains contradictory rules. Strip any PII before passing to model.

[EXISTING_CRITERIA_EXAMPLES]

Optional few-shot examples of previously approved acceptance criteria from the same team or system. Teaches the model the expected style, granularity, and tone.

[{"criteria_id": "AC-001", "scenario": "Successful login", "given": "a registered user on the login page", "when": "they enter valid credentials", "then": "they are redirected to the dashboard"}]

Check: valid JSON array if provided. Each example must include 'scenario', 'given', 'when', 'then' fields. Reject if examples contain placeholder data. Null allowed for zero-shot use.

[CONSTRAINTS]

Hard constraints on the output: maximum number of criteria, required sections, forbidden content, or testability requirements.

Generate 3-7 acceptance criteria. Each must be independently testable. Include at least 2 edge cases. Do not include implementation details.

Check: non-empty string. Parse for numeric limits (e.g., '3-7') and extract as validation parameters. Reject if constraints conflict with OUTPUT_SCHEMA required fields.

[NON_FUNCTIONAL_REQUIREMENTS]

Optional performance, security, accessibility, or compliance requirements that should generate non-functional acceptance criteria.

Page load under 2 seconds. WCAG 2.1 AA compliant. Works offline after first load.

Check: string or null allowed. If provided, each requirement should be a distinct sentence. Warn if non-functional requirements are vague (e.g., 'fast' without a measurable threshold).

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the User Story Narrative to Acceptance Criteria prompt into a product pipeline with validation, retries, and human review gates.

This prompt is designed to sit inside a product management or issue-tracking workflow where a human provides a narrative user story and the system must return structured, testable acceptance criteria. The implementation harness should treat the model call as a conversion step in a larger pipeline: receive unstructured text, call the LLM, validate the output against the expected schema, and either pass the result downstream or trigger a repair loop. Because the output directly shapes development and QA work, the harness must enforce schema compliance, testability checks, and human approval before the criteria land in a backlog or sprint board.

Wire the prompt into your application as a typed function with the following contract: accept a user_story_narrative string and an optional context object containing product domain, existing terminology, and non-functional requirement categories. Return a structured AcceptanceCriteriaPayload containing an array of Scenario objects, each with given, when, then fields, plus edge_cases and non_functional_requirements arrays. Before the model call, inject the [OUTPUT_SCHEMA] placeholder with a JSON Schema definition that enforces required fields, string types, and array constraints. After the model responds, run a two-stage validator: first, a structural validator that checks JSON parseability, field presence, and type correctness; second, a testability validator that scores each scenario for measurable conditions—reject or flag any then clause that uses vague language like "works correctly" or "is fast" without a quantifiable metric. If validation fails, route the output to a repair prompt from the Output Repair and Validation Prompts pillar rather than retrying the original prompt blindly.

For production deployment, use a model with strong structured output support (GPT-4o, Claude 3.5 Sonnet, or equivalent) and set response_format to json_object where the API supports it. Implement a retry budget of 2 attempts with exponential backoff; if both attempts fail validation, escalate to a human review queue with the original narrative, the failed output, and the specific validation errors surfaced. Log every conversion attempt with the prompt version, model, input hash, output, validation result, and human decision for auditability. Do not auto-commit acceptance criteria to a backlog without human approval—this workflow is high-stakes because incorrect or untestable criteria waste engineering cycles. The harness should also detect when the input narrative is too vague to produce testable criteria and return a clarification request to the user rather than hallucinating specifics.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the exact shape of the structured output this prompt must produce. Use this contract to build downstream parsers, validation logic, and test assertions.

Field or ElementType or FormatRequiredValidation Rule

acceptance_criteria

Array of objects

Array length >= 1. Each object must have 'scenario_type', 'given', 'when', 'then' fields.

acceptance_criteria[].scenario_type

Enum string

Must be one of: 'happy_path', 'edge_case', 'error_condition', 'non_functional'. No other values allowed.

acceptance_criteria[].given

String

Non-empty string. Must describe initial context or preconditions. Check for placeholder text like 'TODO'.

acceptance_criteria[].when

String

Non-empty string. Must describe a single trigger action or event. Reject if multiple actions are combined.

acceptance_criteria[].then

String

Non-empty string. Must describe observable, testable outcomes. Reject purely subjective outcomes like 'user is happy'.

non_functional_requirements

Array of objects

If present, each object must have 'category' and 'condition' fields. Null or empty array is acceptable.

non_functional_requirements[].category

Enum string

true if parent present

Must be one of: 'performance', 'security', 'usability', 'reliability', 'compliance'. No other values allowed.

non_functional_requirements[].condition

String

true if parent present

Non-empty string. Must express a measurable or verifiable condition. Reject vague statements like 'system should be fast'.

PRACTICAL GUARDRAILS

Common Failure Modes

When converting narrative user stories into structured acceptance criteria, these are the most common production failures and how to prevent them before they reach your issue tracker.

01

Hallucinated Scenarios Not in Source

What to watch: The model invents edge cases, given-when-then scenarios, or non-functional requirements that have no basis in the original user story narrative. This is especially common when the input story is sparse and the model tries to be 'helpful' by filling gaps. Guardrail: Add a strict instruction to only derive criteria from explicit statements in the source text. Implement a post-generation grounding check that requires each acceptance criterion to cite the specific sentence or phrase from the input that supports it. Flag criteria without source grounding for human review.

02

Missing Edge Cases and Negative Scenarios

What to watch: The model generates only happy-path scenarios and omits error states, boundary conditions, authorization failures, or empty-state behavior that product teams need to build resilient features. Guardrail: Include explicit instructions to generate negative scenarios for each primary flow. Add a completeness validator that checks for the presence of at least one error-state criterion per functional area. Use a post-generation checklist prompt to audit the output for missing categories: empty inputs, permission denied, concurrent access, and timeout conditions.

03

Non-Testable or Vague Acceptance Criteria

What to watch: The model produces criteria like 'the system should work correctly' or 'the user experience should be good' that cannot be objectively verified. These slip through when the prompt lacks explicit testability constraints. Guardrail: Require every acceptance criterion to include observable inputs, actions, and measurable outcomes. Add a testability validator that rejects criteria without concrete expected results. Use a rubric check: 'Can a junior QA engineer determine whether this criterion passes or fails without asking for clarification?'

04

Inconsistent Given-When-Then Structure

What to watch: The model mixes formats—some criteria use given-when-then, others use bullet points, and some are narrative prose. This breaks downstream parsing and makes automated test generation unreliable. Guardrail: Enforce a strict output schema with required fields for precondition, action, and expected result. Use a structural validator that checks every criterion object for all three fields. On validation failure, retry with a repair prompt that explicitly requests structural conformance rather than content regeneration.

05

Priority and Dependency Blindness

What to watch: The model generates a flat list of criteria without indicating which are must-have versus nice-to-have, or which criteria depend on others being implemented first. This forces product managers to manually re-sort and annotate the output. Guardrail: Include priority and dependency fields in the output schema. Prompt the model to classify each criterion as P0 (blocking), P1 (critical path), or P2 (enhancement). Add a dependency validator that flags circular dependencies and orphaned criteria that reference unimplemented features.

06

Non-Functional Requirements Omitted

What to watch: The model focuses exclusively on functional behavior and ignores performance, security, accessibility, and localization requirements that are implied by the story context but not explicitly stated. Guardrail: Add a non-functional requirements checklist to the prompt that forces the model to consider response time, concurrent users, data retention, screen reader support, and error message language. Include a post-generation audit step that flags stories with zero non-functional criteria and requests explicit justification for their absence.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the quality of structured acceptance criteria generated from a user story narrative before integrating the prompt into your product pipeline. Each criterion targets a specific production failure mode.

CriterionPass StandardFailure SignalTest Method

Scenario Completeness

Output contains at least one Given-When-Then scenario for each distinct functional requirement in [USER_STORY_NARRATIVE]

A functional requirement from the input has zero corresponding scenarios in the output

Parse output scenarios; extract requirement coverage by mapping each scenario back to a sentence in [USER_STORY_NARRATIVE]; flag uncovered requirements

Testability of Conditions

Every Then clause describes a specific, observable outcome that can be verified without ambiguity

A Then clause contains subjective language like 'works well', 'is fast', or 'looks good' without a measurable threshold

Run a keyword scan on all Then clauses for subjective terms; manually review flagged clauses against a testability checklist

Edge Case Coverage

Output includes at least one edge case scenario for boundary inputs, empty states, error conditions, or concurrent access mentioned in [USER_STORY_NARRATIVE]

Output contains zero edge case scenarios or edge cases are generic and not derived from the specific narrative

Count edge case scenarios; verify each edge case references a specific condition from [USER_STORY_NARRATIVE]; fail if count is zero or all are generic

Non-Functional Requirement Extraction

Output includes a non-functional requirements block with performance, security, or accessibility criteria when [USER_STORY_NARRATIVE] implies them

A narrative that mentions 'fast', 'secure', 'accessible', or 'many users' produces no non-functional requirements in the output

Scan [USER_STORY_NARRATIVE] for non-functional keywords; if present, assert that output contains a non-functional requirements field with at least one entry

Schema Conformance

Output is valid JSON matching the [OUTPUT_SCHEMA] with all required fields present and no extra hallucinated fields

Output is missing a required field like 'scenarios' or 'non_functional_requirements', or contains fields not defined in [OUTPUT_SCHEMA]

Validate output against [OUTPUT_SCHEMA] using a JSON schema validator; fail on missing required fields or additional properties

No Hallucinated Requirements

Every acceptance criterion is directly traceable to a statement in [USER_STORY_NARRATIVE]; no invented features or constraints

Output includes a scenario or requirement that cannot be mapped to any sentence in the input narrative

For each scenario and non-functional requirement, require a citation to a specific sentence in [USER_STORY_NARRATIVE]; fail if any citation is missing or fabricated

Given-When-Then Structure Validity

Every scenario follows the Given-When-Then structure with non-empty Given, When, and Then clauses

A scenario is missing a Given, When, or Then clause, or a clause contains only placeholder text

Parse each scenario object; assert that 'given', 'when', and 'then' fields are present and contain non-empty strings longer than 10 characters

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single user story and lighter validation. Focus on getting the acceptance criteria structure right before adding schema enforcement. Replace [USER_STORY_NARRATIVE] with a single story and set [OUTPUT_SCHEMA] to a simple JSON array of criteria objects with scenario, given, when, then, and edge_cases fields.

Watch for

  • Missing given or then clauses that make scenarios untestable
  • Acceptance criteria that restate the story instead of defining testable conditions
  • Edge cases that are generic rather than story-specific
  • No validation of whether each criterion can actually be tested
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.