Raw view: PR title and body from branch diff
No invisible, zero-width, or bidi-control characters detected.
---
name: pr-description
description: Generates a pull request title and body (summary, change list, testing notes, risks, reviewer checklist) from the diff between the current branch and its base. Use when the user asks to open a PR, write a PR description, describe a branch, or fill in a merge request template.
license: CC0-1.0
allowed-tools: Bash(git diff *) Bash(git log *) Bash(git branch *) Bash(git merge-base *) Bash(git rev-parse *)
metadata:
author: Waxmark
version: "1.0.0"
---
# PR Description
A good PR body lets a reviewer decide where to look first and how to verify, without reading every file.
## Procedure
1. Find the base branch and the range.
```bash
git rev-parse --abbrev-ref HEAD
git branch -r --list 'origin/main' 'origin/master' 'origin/develop'
BASE=$(git merge-base HEAD origin/main) # swap main for the real base
git log --oneline "$BASE"..HEAD
git diff --stat "$BASE"..HEAD
git diff "$BASE"..HEAD
```
If the repo has `.github/pull_request_template.md` or `.gitlab/merge_request_templates/`, read it and fill its sections instead of the default layout below.
2. Read the commit messages first; they state intent. Read the diff second; it states fact. Where they disagree, trust the diff and flag the gap.
3. Group the changes by purpose, not by file. Three bullets about what a reviewer will notice beat twenty file paths.
4. Write testing notes from evidence: test files in the diff, CI config, commands in the commit bodies. If you cannot find evidence that something was tested, write "Not covered by automated tests" rather than inventing a test plan.
5. Draft the title as a Conventional Commit subject under 70 characters.
## Output template
```markdown
## Summary
<2-4 sentences: the problem, the approach, the user-visible result.>
## Changes
- <purpose-level bullet, with the key file in backticks>
- ...
## Testing
- [x] `<command>` passes locally (<N> tests)
- [x] Added `<test file>` covering <behavior>
- [ ] Manual check needed: <what and how>
## Risks and rollout
- <migration, feature flag, config change, or "None">
- Rollback: <revert commit / flag off / N/A>
## Reviewer notes
- Start with `<file>`; the rest follows from it.
- <open question for the reviewer, if any>
Closes #<issue>
```
Drop any section that would be empty. Keep the body under 60 lines.
## Rules
- Every sentence must be checkable against the diff or the commit log. No "improved performance" without a number or a mechanism.
- Mention breaking changes, schema migrations, and new env vars in **Risks and rollout** even if the author did not.
- Do not run `gh pr create` unless the user asks. When they do, pass the body via `--body-file` to preserve formatting.
## Example
Branch with 3 commits touching `src/auth/session.ts`, `migrations/0042_session_ttl.sql`, `tests/auth/session.test.ts`:
**Title:** `feat(auth): make session TTL configurable per tenant`
**Summary:** Sessions expired after a fixed 24h regardless of tenant policy. This adds a `session_ttl_seconds` column, reads it in `SessionService.refresh`, and defaults to the previous 24h so existing tenants see no change.