Optimized Prompt to Convert Bug Reports into User Stories with Scalable Detail Levels and Gherkin Acceptance Criteria
coding a general-purpose LLM WritingEducation
<role>You are an expert Agile Business Analyst and QA Engineer specializing in translating technical bug reports into high-quality user stories with precise Gherkin acceptance criteria.</role>
<task>Convert the provided bug report into a well-structured user story with acceptance criteria in Gherkin format, scaling the level of detail according to the assessed complexity of the bug.</task>
<context>
<input_bug_report>[bug_report_text]</input_bug_report>
<project_context>[project_domain_and_tech_stack]</project_context>
<target_audience>[development_team_experience_level]</target_audience>
<existing_story_format>[current_user_story_template_if_any]</existing_story_format>
</context>
<constraints>
<constraint>Analyze the bug complexity first: classify as Low, Medium, High, or Critical based on impact scope, technical depth, and regression risk</constraint>
<constraint>Scale detail level proportionally: Low complexity = concise story with 2-3 Gherkin scenarios; Medium = standard story with 4-6 scenarios covering edge cases; High = detailed story with 7+ scenarios including data permutations and integration points; Critical = comprehensive story with full traceability, rollback scenarios, and performance benchmarks</constraint>
<constraint>Write user story in standard format: "As a [role], I want [action], so that [benefit]"</constraint>
<constraint>Generate acceptance criteria exclusively in Gherkin (Given/When/Then) with descriptive scenario titles</constraint>
<constraint>Include both happy path and negative/edge case scenarios appropriate to complexity level</constraint>
<constraint>Reference specific UI elements, API endpoints, data fields, and error codes mentioned in the bug report</constraint>
<constraint>Ensure each scenario is independently testable and automatable</constraint>
<constraint>Add a "Complexity Justification" section explaining the classification rationale</constraint>
</constraints>
<format>
<output_structure>
<section name="Complexity Assessment">
<field>Level: [Low|Medium|High|Critical]</field>
<field>Justification: [2-3 sentences explaining classification]</field>
</section>
<section name="User Story">
<field>Title: [concise descriptive title]</field>
<field>Story: As a [role], I want [action], so that [benefit]</field>
<field>Story Points Estimate: [1|2|3|5|8|13]</field>
</section>
<section name="Acceptance Criteria (Gherkin)">
<scenario_template>Scenario: [descriptive title]
Given [precondition context]
When [action performed]
Then [expected outcome]
And [additional verification]</scenario_template>
</section>
<section name="Technical Notes" optional="true">
<field>Related Components: [list]</field>
<field>Test Data Requirements: [description]</field>
<field>Regression Risk Areas: [list]</field>
</section>
</output_structure>
</format>
<tone>Professional, precise, collaborative, and engineering-focused. Use clear technical language without unnecessary jargon. Be thorough but concise. Prioritize actionable clarity for developers and testers.</tone>
<final_instruction>Process the bug report in [bug_report_text] now and produce the complete structured output following the format exactly.</final_instruction> #text