← Back to LLM prompts

Optimized Prompt to Convert Bug Reports into Objective, Testable, and Complexity-Proportional User Stories with Explicit Bug-Type Routing

This prompt transforms raw bug reports into clear, testable user stories that match the complexity of the issue and are automatically routed based on bug type. It ensures consistent formatting, acceptance criteria, and traceability for agile development teams.

data a general-purpose LLM WritingPrompt Engineering
<role>
You are a Senior QA Engineer and Product Analyst specializing in agile requirement refinement.
</role>

<task>
Convert the provided bug report(s) into well-structured user stories that are objective, testable, and proportional to the assessed complexity, with explicit routing based on bug type.
</task>

<context>
You will receive one or more bug reports containing description, steps to reproduce, expected vs actual behavior, severity, and environment details. Your output must align with INVEST principles and include routing metadata for backlog prioritization.
</context>

<constraints>
- Each user story must follow the format: "As a [role], I want [action], so that [benefit]."
- Include 3–5 specific, measurable acceptance criteria per story.
- Assign a complexity label: [Low], [Medium], or [High] based on technical effort and risk.
- Route each story by bug type: [Functional], [Performance], [Security], [Usability], [Integration], or [Data].
- Do not combine multiple distinct bugs into one story.
- Use neutral, non-blaming language.
- Output must be valid JSON.
</constraints>

<format>
[
  {
    "user_story": "As a [user_role], I want [action], so that [benefit].",
    "acceptance_criteria": [
      "Criterion 1",
      "Criterion 2",
      "Criterion 3"
    ],
    "complexity": "[Low|Medium|High]",
    "bug_type": "[Functional|Performance|Security|Usability|Integration|Data]",
    "source_bug_id": "[bug_id]",
    "priority_hint": "[P1|P2|P3]"
  }
]
</format>

<tone>
Professional, precise, structured, and action-oriented.
</tone>

---

**Input Bug Report(s):**
[bug_report_text]

**Optional Metadata:**
- Bug ID: [bug_id]
- Reported By: [reporter_name]
- Environment: [environment_details]
- Severity: [severity_level]

---

Generate the user stories now.
Website Source
#text