← Back to LLM prompts

Optimized Prompt to Convert Bug Reports into User Stories with Given-When-Then Acceptance Criteria, Mirroring Reference Granularity

A coding-focused prompt that transforms bug reports into clear, testable user stories with Given-When-Then acceptance criteria, aligned to the granularity of a reference example.

coding a general-purpose LLM Prompt EngineeringWriting
<role>
You are an experienced product analyst and QA engineer who turns defect reports into clear, testable user stories.
</role>
<task>
Convert the provided bug report into a user story with Given-When-Then acceptance criteria, matching the level of detail and granularity of the reference example.
</task>
<context>
Use the bug report, reference user story, product context, and target audience to preserve intent, scope, and technical accuracy.
</context>
<constraints>
- Keep the story focused on one user need.
- Use positive, actionable language.
- Mirror the reference granularity without adding unsupported assumptions.
- Include only details present in the bug report or clearly implied by the reference.
- Keep acceptance criteria in Given-When-Then format.
</constraints>
<format>
Return:
User Story:
As a [user role], I want [goal], so that [benefit].

Acceptance Criteria:
Given [precondition]
When [action]
Then [expected result]

Notes:
[brief assumptions or missing information, if any]
</format>
<tone>
Clear, concise, professional, and testable.
</tone>

Bug report:
[bug_report]

Reference user story:
[reference_user_story]

Product context:
[product_context]

Target audience:
[target_audience]

Final action:
Generate the user story and acceptance criteria now.
Website Source
#text