Turn a diff into a clear, reviewer-friendly PR description
Converts a diff and context into a structured, reviewer-friendly pull request description and title.
A good pull request description is the difference between a fast review and a thread of confused questions. This prompt turns your diff plus context into a structured description reviewers can actually act on: a one-line summary, what changed, why (tied to the ticket), how to test, and a risks/rollout note. It deliberately keeps things factual—describing only what the diff does—and asks the model to flag anything a reviewer should scrutinize, which raises the quality of the review rather than rubber-stamping it. Provide the actual diff (or a summary of it) and any context the diff alone can't convey: the ticket goal, a design decision, why you chose approach A over B. Set the reviewer level so the depth matches your audience—a senior reviewer wants risks and trade-offs, a junior teammate may want more on-ramp. You still own correctness: read the description against your diff, because the model describes what you give it, and a misleading summary is worse than none.
You are an experienced tech lead who writes pull request descriptions that make review fast. From the diff and context below, write a PR description with: a one-line summary, a 'What changed' section, a 'Why' section tying back to the ticket [TICKET], a 'How to test' section with concrete steps, and a 'Risks / rollout' note. Keep it factual—describe only what the diff actually does. Flag anything a reviewer should scrutinize. Target reviewer: [REVIEWER_LEVEL]. Diff and context: [DIFF_AND_CONTEXT] Return the PR description in Markdown, plus a suggested concise PR title under 70 characters.
What you can expect back
**Title:** Prevent duplicate signups with a unique email constraint (JIRA-482) **Summary:** Enforce unique emails at the database level and return 409 on conflict. **What changed** - New migration adds a `UNIQUE` constraint on `users.email`. - `createUser` now catches the unique-violation error and returns HTTP 409 instead of an unhandled 500. **Why** JIRA-482: production saw duplicate accounts caused by double-clicks on signup. The app-level check had a race; a DB constraint closes it. **How to test** 1. Run the migration on a copy of staging data (watch for existing duplicates—see Risks). 2. POST the same email twice; the second call should return 409. **Risks / rollout** - Migration will FAIL if duplicate emails already exist—back-fill/dedupe first. - Reviewer, please scrutinize the dedupe step and the 409 error shape clients receive.
Illustrative example — your results will vary by tool and inputs.
Get sharper results
- 01Include the 'why' the diff can't show—reviewers approve faster when intent is explicit.
- 02Let it flag risks; a self-identified scrutiny list makes reviewers trust the PR more, not less.
- 03Read the generated 'How to test' steps against reality—wrong steps waste a reviewer's time.
- 04Keep the title under 70 chars and lead with the user-facing change, not the implementation.
Adapt it for your case
Add 'Also produce a Conventional Commits-style commit message (type, scope, subject, body) summarizing this change.'
Add 'Append a checklist of specific things the reviewer should verify before approving.'
Common questions
How is this different from a commit message?
A PR description explains a whole change set for review (test steps, risks, rollout); use the 'Commit message' variation if you also need the commit line.
What if I don't have a ticket?
Put 'none' in [TICKET]; the prompt will still write the 'Why' from the context you provide.
Can it invent risks that aren't real?
It reasons from your diff and context, so feed it accurate input and review the risks section—remove any that don't apply.
You may also need
Perform a Thorough Code Review on a Pull Request
Get a senior-engineer-style code review with categorized, file-referenced feedback.
Refactor Code for Readability and Maintainability
Refactor any code for readability and maintainability without changing its behavior.
Design a RESTful API Endpoint Schema
Design a complete REST API schema with request/response bodies, status codes, and error cases.
Audit Code for Performance Bottlenecks
Identify performance bottlenecks in code and get ranked, impact-focused optimization suggestions.