Skip to content

Commit 464cabf

Browse files
Add structured PR template and write-pr-description skill (#673)
## Summary Replaces the free-form PR template with a structured three-section format and adds a `/write-pr-description` Claude command so agents and contributors can generate high-quality PR descriptions automatically. ## Why The current PR template asks contributors to answer "what" and "why" but provides little structure beyond that. In practice, PR descriptions vary widely in quality and organization, making reviews harder and reducing the long-term value of the git history. A structured template (Summary / Why / What Changed) gives contributors a clear framework to follow, while the Claude command automates the process for agent workflows — reading the diff, analyzing the change, and producing a description that follows the template. ## What changed ### Interface changes None. ### Behavioral changes None. This only affects PR description authoring, not SDK behavior. ### Internal changes - **`.github/PULL_REQUEST_TEMPLATE.md`** — Rewritten with three sections (Summary, Why, What Changed) and ordered sub-sections under "What Changed": Interface changes → Behavioral changes → Internal changes. Includes inline guidance and examples in HTML comments so it works standalone for non-Claude contributors. - **`.claude/commands/write-pr-description.md`** — New Claude command (invocable via `/write-pr-description`) with a four-phase workflow: gather context → analyze → write → update PR. References the PR template as the single source of truth for structure. ## How is this tested? N/A — no code changes, only documentation and tooling configuration. NO_CHANGELOG=true Signed-off-by: Ubuntu <renaud.hartert@databricks.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0b809d2 commit 464cabf

File tree

2 files changed

+143
-20
lines changed

2 files changed

+143
-20
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
description: >
3+
Write or improve a GitHub pull request description. Use when the user asks
4+
to "write a PR description", "improve the PR description", "update the PR
5+
body", or provides a PR URL and asks for a better description.
6+
Keywords: PR description, pull request summary, PR body, PR writeup.
7+
allowed-tools: [Read, Glob, Grep, Bash, ToolSearch]
8+
---
9+
10+
# Write PR Description
11+
12+
Generate a structured PR description that explains **why** the change exists,
13+
not just what files were touched.
14+
15+
## When to use
16+
17+
- The user provides a PR URL and asks to write or improve its description.
18+
- The user asks to draft a PR description for the current branch.
19+
- An agent needs to open a PR and wants a high-quality description.
20+
21+
## Workflow
22+
23+
### Phase 1: Gather context
24+
25+
Collect all the information needed to understand the change:
26+
27+
1. **Read the PR metadata** — title, current description, author, branch name.
28+
2. **Read the full diff** — understand every file changed, every function added
29+
or removed, every signature change. Do not skip files.
30+
3. **Read surrounding code when needed** — if the diff modifies an interface or
31+
a struct, read the full file to understand how the change fits into the
32+
existing architecture.
33+
4. **Check for linked issues or docs** — the PR or commit messages may
34+
reference issues, design docs, or RFCs that explain motivation.
35+
36+
### Phase 2: Analyze the change
37+
38+
Before writing, answer these questions internally:
39+
40+
- **What was the status quo before this PR?** What limitation, bug, or missing
41+
capability existed?
42+
- **Why is this change needed now?** What concrete problem does it solve? Who
43+
benefits?
44+
- **What are the key design decisions?** Why was this approach chosen over
45+
alternatives?
46+
- **What is the new API surface?** Any new public types, functions, or
47+
configuration options?
48+
- **What are the architectural changes?** How does the internal structure
49+
change? What moves where? What gets refactored?
50+
- **Are there behavioral changes?** If not, say so explicitly — this reassures
51+
reviewers.
52+
53+
### Phase 3: Write the description
54+
55+
Use the structure defined in `.github/PULL_REQUEST_TEMPLATE.md` as the
56+
template. The tone should be direct and technical. Write for a reviewer who is
57+
familiar with the codebase but has not seen this change before.
58+
59+
**Key principles:**
60+
61+
- **Lead with why, not what.** The diff already shows the what. The description
62+
should explain the reasoning that is not visible in the code.
63+
- **Be specific.** Instead of "improves extensibility", say "allows internal
64+
tools to compose their own auth chain from individual credential strategies".
65+
- **Name things.** Reference actual types, functions, files, and config fields.
66+
Use backticks for code references.
67+
- **State non-changes explicitly.** If the PR is a refactor with no behavioral
68+
change, say "No behavioral changes. Existing users are unaffected." This is
69+
valuable information for reviewers.
70+
- **Keep the summary to one or two sentences.** It should be scannable.
71+
- **Use the motivation section to tell a story.** What was the problem? Why
72+
couldn't it be solved before? What does this PR unlock?
73+
74+
### Phase 4: Update the PR
75+
76+
Use the GitHub MCP tools or `gh` CLI to update the PR body with the new
77+
description. Confirm with the user before pushing if unsure.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 66 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,74 @@
1-
## What changes are proposed in this pull request?
1+
<!--
2+
This template provides a recommended structure for PR descriptions.
3+
Adapt it freely — the goal is clarity, not rigid compliance.
4+
The three-section format (Summary / Why / What Changed) helps reviewers
5+
understand the change quickly and makes the PR easier to revisit later.
6+
-->
27

3-
Provide the readers and reviewers with the information they need to understand
4-
this PR in a comprehensive manner.
8+
## Summary
59

6-
Specifically, try to answer the two following questions:
10+
<!--
11+
One or two sentences describing what this PR changes and what it enables.
12+
Focus on the effect, not the implementation details.
713
8-
- **WHAT** changes are being made in the PR? This should be a summary of the
9-
major changes to allow the reader to quickly understand the PR without having
10-
to look at the code.
11-
- **WHY** are these changes needed? This should provide the context that the
12-
reader might be missing. For example, were there any decisions behind the
13-
change that are not reflected in the code itself?
14+
Example:
15+
Extracts the credentials chain iteration logic into a reusable
16+
`NewCredentialsChain` constructor so that internal tools can compose
17+
their own authentication chains from individual credential strategies.
18+
-->
1419

15-
The “why part” is the most important of the two as it usually cannot be
16-
inferred from the code itself. A well-written PR description will help future
17-
developers (including your future self) to know how to interact and update your
18-
code.
20+
## Why
21+
22+
<!--
23+
Explain the problem that motivated this change. A reviewer who reads only
24+
this section should understand why the PR exists and what problem it solves.
25+
26+
- Start with the status quo: how things work today and what limitation exists.
27+
- Explain who is affected and what they cannot do (or must work around).
28+
- If alternatives were considered and rejected, briefly mention why.
29+
- End with how this PR addresses the gap.
30+
31+
The "why" is the most important part of a PR description — it usually
32+
cannot be inferred from the code itself.
33+
-->
34+
35+
## What changed
36+
37+
### Interface changes
38+
39+
<!--
40+
New or modified public API surface: types, functions, configuration options.
41+
Use backticks for code references. Write "None." if there are no changes.
42+
43+
Example:
44+
- **`NewCredentialsChain(...CredentialsStrategy) CredentialsStrategy`** —
45+
Takes an ordered list of credential strategies and returns a strategy
46+
that tries them in sequence.
47+
-->
48+
49+
### Behavioral changes
50+
51+
<!--
52+
User-visible behavior changes: different defaults, changed error messages,
53+
new side effects, performance characteristics. Write "None." if this is a
54+
pure refactor — this explicitly reassures reviewers.
55+
-->
56+
57+
### Internal changes
58+
59+
<!--
60+
Refactoring, file moves, implementation details, test infrastructure.
61+
Things that don't affect the public API or user-visible behavior.
62+
-->
1963

2064
## How is this tested?
2165

22-
Describe any tests you have done; especially if test tests are not part of
23-
the unit tests (e.g. local tests).
66+
<!--
67+
Describe any tests you have done, especially tests that are not part of
68+
the unit tests (e.g. local tests, integration tests, manual verification).
2469
25-
**ALWAYS ANSWER THIS QUESTION:** Answer with "N/A" if tests are not applicable
26-
to your PR (e.g. if the PR only modifies comments). Do not be afraid of
27-
answering "Not tested" if the PR has not been tested. Being clear about what
28-
has been done and not done provides important context to the reviewers.
70+
ALWAYS ANSWER THIS QUESTION: answer with "N/A" if tests are not applicable
71+
to your PR (e.g. if the PR only modifies comments). Do not be afraid of
72+
answering "Not tested" if the PR has not been tested. Being clear about what
73+
has been done and not done provides important context to the reviewers.
74+
-->

0 commit comments

Comments
 (0)