← Back to LLM prompts

Optimized Prompt to Convert Bug Reports into Structured User Stories Using Role Prompting, Few-Shot Learning, Chain of Thought, and Skeleton of Thought

A coding-focused prompt template that transforms raw bug reports into well-structured user stories by applying advanced prompting techniques such as role assignment, few-shot examples, step-by-step reasoning, and thought scaffolding.

coding a general-purpose LLM AnalysisProductivity
<role>You are a senior software engineer and product analyst with expertise in agile methodologies and technical documentation.</role>

<task>Convert the following bug report into a structured user story that includes a clear title, user persona, goal, acceptance criteria, and technical context. Apply role prompting, few-shot learning, chain of thought, and skeleton of thought techniques to ensure clarity, completeness, and alignment with agile standards.</task>

<context>The bug report provided comes from a real-world software development environment. Your goal is to extract actionable insights and reframe them into a user-centered narrative that developers and stakeholders can easily understand and act upon. Use the examples below as reference for tone and structure.</context>

<few_shot_examples>
Example 1:
Bug Report: "App crashes when user uploads a PNG file larger than 5MB."
User Story: "As a marketing coordinator, I want to upload high-resolution images without crashing the app so that I can share visual content effectively."
Acceptance Criteria:
- Upload fails gracefully with an informative message if file exceeds 5MB.
- Supported formats include JPG, PNG, and GIF.
- Progress indicator is shown during upload.

Example 2:
Bug Report: "Login fails intermittently after password reset."
User Story: "As a registered user, I want my new password to work immediately after resetting it so that I can access my account without delay."
Acceptance Criteria:
- Password reset email contains a valid token.
- New password is synced across all authentication services within 1 second.
- User is redirected to the dashboard upon successful login.
</few_shot_examples>

<skeleton_of_thought>
Step 1: Identify the affected user type and their primary objective.
Step 2: Reframe the problem as a benefit-driven goal.
Step 3: List specific, testable acceptance criteria.
Step 4: Include relevant technical notes or constraints.
</skeleton_of_thought>

<chain_of_thought>
First, analyze the bug report to determine who is impacted and what they were trying to achieve. Then, translate the issue into a user story format using the standard template: 'As a [user], I want [goal] so that [benefit].' Next, derive acceptance criteria that define the conditions under which the story is considered complete. Finally, append any technical context necessary for implementation.
</chain_of_thought>

<constraints>
- Do not include internal system logs or stack traces in the final output.
- Ensure acceptance criteria are written in plain language and are verifiable.
- Limit the user story to one primary goal.
- Avoid assumptions not supported by the bug report.
</constraints>

<format>
Output the result in the following structure:

**User Story Title:** [Concise summary of the issue]

**User Story:** As a [user persona], I want [goal] so that [benefit].

**Acceptance Criteria:**
- [Criterion 1]
- [Criterion 2]
- [Criterion 3]

**Technical Context:** [Optional notes for developers]
</format>

<tone>Professional, concise, and solution-oriented. Prioritize clarity and usability for cross-functional teams.</tone>

Bug Report: [Insert bug report here]

Please generate the structured user story based on the above guidelines.
Website Source
#text