Skip to content
AI Dev Toolkit.
Esc
  • Loading…

Prompt template · Git and docs

Pull request description prompt

A good pull request description prompt gives the model the diff, the ticket and what you actually tested, then asks for what changed and why, how to test it, the risks and where reviewers should look. This template keeps the result under 250 words and only reports testing the author described.

Free to copy, or open it in the prompt builder to fill the variables and get the exact API request.

195 tokens unfilled · 303 with the example below · o200k_base (GPT-4o and later)

Template

The pull request description prompt template (copy it)

Paste this into a chat window and replace each {{variable}}, or open it in the prompt builder to fill them in a form. Sections are marked with XML tags, which every major model reads well.

Prompt (one message, plain text)
You write pull request descriptions that let a busy reviewer understand a change in two minutes.

<context>
The ticket or task:
<ticket>
{{ticket}}
</ticket>

How the author tested it:
<testing>
{{testing}}
</testing>

The diff:
<diff>
{{diff}}
</diff>
</context>

<constraints>
- Describe behaviour changes, not a file-by-file tour.
- Only state testing that the author described. If testing is missing or thin, say what is untested.
- Call out anything risky: migrations, config changes, changed public APIs, new dependencies, feature flags.
- Point reviewers at the one or two places that most need careful review.
- Keep it under 250 words. Reviewers skim.
</constraints>

<output_format>
Markdown with these headings:
## What and why
## How to test
## Risks
## Review focus
</output_format>

<task>
Write the description for this pull request.
</task>
For an API call: system prompt and user message

With a system prompt, the role, constraints and output format stay fixed across calls (and can be cached), while the context and task go in the user message.

System prompt
You write pull request descriptions that let a busy reviewer understand a change in two minutes.

<constraints>
- Describe behaviour changes, not a file-by-file tour.
- Only state testing that the author described. If testing is missing or thin, say what is untested.
- Call out anything risky: migrations, config changes, changed public APIs, new dependencies, feature flags.
- Point reviewers at the one or two places that most need careful review.
- Keep it under 250 words. Reviewers skim.
</constraints>

<output_format>
Markdown with these headings:
## What and why
## How to test
## Risks
## Review focus
</output_format>
User message
<context>
The ticket or task:
<ticket>
{{ticket}}
</ticket>

How the author tested it:
<testing>
{{testing}}
</testing>

The diff:
<diff>
{{diff}}
</diff>
</context>

<task>
Write the description for this pull request.
</task>

Variables

What do the variables mean?

{{ticket}}
The issue or task text, or a sentence on the goal. Include the ticket ID if your team links PRs to tickets.
{{testing}}
What you ran and saw: unit tests added, manual steps, screenshots taken. Be honest; “not tested yet” is a valid value.
{{diff}}
The PR’s diff, or git diff main...HEAD. For large PRs, the stat summary plus the important hunks.

Use

When should I use this pull request description prompt?

Use it when opening a pull request, especially a large one or one that touches an area the reviewer doesn’t know. A good description shortens review time and gives future readers the context that a merged PR link points to.

For a one-line fix, a one-line description is fine; the template adds nothing. It is most useful when there is something to warn the reviewer about.

Structure

Why is the prompt structured this way?

The testing section is separate from the diff because it is the part most often invented. A model seeing new test files may claim “all tests pass”; the constraint limits it to what the author actually reported, and asks it to flag what is untested instead.

The four headings match what a reviewer needs in order: the goal, how to check it, what could go wrong, and where to look. “Review focus” is the most valuable and the one people most often leave out; it turns a description into a guide to the diff.

The word limit is deliberate. Long descriptions get skimmed, and the model will happily write 600 words if you let it. Fitting into 250 forces it to drop the file-by-file tour.

Example

Example: a filled-in pull request description prompt

{{ticket}}
PAY-412: Customers want to download all their invoices at once as a ZIP.
{{testing}}
Added unit tests for the ZIP builder. Manually downloaded a ZIP of 30 invoices locally. Not tested with accounts that have more than 1,000 invoices.
{{diff}}
+ app/invoices/export.ts        (new, 84 lines: streams invoices into a ZIP)
+ app/routes/invoices.zip.ts    (new route, GET /invoices.zip)
~ app/invoices/list.tsx         (adds a "Download all" button)
+ app/invoices/export.test.ts   (new tests)

What to look for. The useful output names the untested case (very large accounts) under Risks and points review at the streaming code in export.ts, where memory use and timeouts would show up. A generic description would just list the four files.

The complete filled-in prompt (303 tokens)
Filled-in prompt
You write pull request descriptions that let a busy reviewer understand a change in two minutes.

<context>
The ticket or task:
<ticket>
PAY-412: Customers want to download all their invoices at once as a ZIP.
</ticket>

How the author tested it:
<testing>
Added unit tests for the ZIP builder. Manually downloaded a ZIP of 30 invoices locally. Not tested with accounts that have more than 1,000 invoices.
</testing>

The diff:
<diff>
+ app/invoices/export.ts        (new, 84 lines: streams invoices into a ZIP)
+ app/routes/invoices.zip.ts    (new route, GET /invoices.zip)
~ app/invoices/list.tsx         (adds a "Download all" button)
+ app/invoices/export.test.ts   (new tests)
</diff>
</context>

<constraints>
- Describe behaviour changes, not a file-by-file tour.
- Only state testing that the author described. If testing is missing or thin, say what is untested.
- Call out anything risky: migrations, config changes, changed public APIs, new dependencies, feature flags.
- Point reviewers at the one or two places that most need careful review.
- Keep it under 250 words. Reviewers skim.
</constraints>

<output_format>
Markdown with these headings:
## What and why
## How to test
## Risks
## Review focus
</output_format>

<task>
Write the description for this pull request.
</task>

Models

Does it work the same in ChatGPT, Claude and Gemini?

Yes, the structure works in all three: tagged sections that keep your material apart from the instructions, and an explicit output format. The tips below cover where the providers’ own guides differ for this pull request description prompt.

  • OpenAI GPT

    Reasoning models skip Markdown by default from o1-2024-12-17 on, OpenAI notes. Because this format needs headings, put “Formatting re-enabled” on the first line of the developer message when you call one through the API.

  • Claude

    Anthropic notes that the formatting of the prompt tends to influence the formatting of the reply. Since this template uses Markdown headings in the format line, Claude will usually match them without extra instructions.

  • All models

    Save the filled template as a GitHub pull request template or an agent command so every PR on the team uses the same headings.

FAQ

Questions people ask

Can AI write pull request descriptions?

Yes, and it saves the most time on large pull requests or ones in an area the reviewer doesn’t know. Pass in what you tested rather than letting the model infer it: seeing new test files, a model may claim “all tests pass”. This template limits testing claims to what you wrote and flags what is untested.

How do I make it follow our PR template?

Replace the four headings in the format section with your own, and keep a review focus section, which points reviewers at the one or two places that need care. Then save the filled-in prompt as a pull request template or an agent command, so every pull request on the team uses the same headings.

How do I handle a very large pull request?

Send the stat summary and the important hunks, not the whole diff. A file list with line counts shows the shape of the change, and two or three key hunks give the model enough to describe the behaviour. Name the risky area in the testing notes so the review focus section points reviewers at it.

Related

Building this into an app that sends the same instructions with every request? Start from a system prompt instead; each comes with design notes, failure modes and a monthly cost. In the system prompt library: Pull request description writer.

Edited the template? Compare your version with this one in the prompt diff, and count it for your model with the token counter. Browse all 29 prompt templates.

Keep exploring