---
name: "codemaman-pr-description"
description: "Write or refresh a clear PR description from the diff, commits and Jira ticket, following the repo's template. Use for 'write the PR description', 'fill in the PR template', 'update my PR description'."
---

# PR Description Writer

Produce a description that lets a reviewer understand the change in two minutes, and keep it accurate as the PR evolves.

## 1. Gather
- Resolve the PR from the argument (number/URL) or the current branch (`gh pr view --json number,title,body,baseRefName,headRefName`). If no PR exists yet, work from the branch and offer to create it with `gh pr create --draft` afterwards.
- Read the evidence, not just commit messages:
  - `git log --reverse <base>..HEAD --format='%h %s%n%b'`
  - `git diff <base>...HEAD --stat`, then the full diff for anything non-trivial
  - Jira key from branch/title/commits (pattern `ABC-123`); if a Jira tool is connected, fetch summary, description and acceptance criteria
- Find the template: `.github/pull_request_template.md`, `.github/PULL_REQUEST_TEMPLATE/`, `docs/`, or CONTRIBUTING. Follow it exactly (keep every heading, fill or mark N/A). If none exists, use the default structure below.
- Fetch the existing body. Anything the author wrote by hand (screenshots, notes, checked boxes, `<!-- ... -->` marker regions) must be preserved.

## 2. Default structure
- **Ticket**: link `[ABC-123](https://<site>.atlassian.net/browse/ABC-123)`
- **Summary**: 2-4 sentences on what changed and why, in plain language. Lead with the user-visible or system-level outcome.
- **Changes**: bullets grouped by area, focused on behaviour and decisions, not file lists.
- **Design notes / trade-offs**: non-obvious choices, alternatives rejected, known limitations.
- **How to test**: numbered, copy-pasteable steps (URLs, accounts, flags, commands, seed data). Include what "correct" looks like.
- **Automated tests**: what was added or changed and the command to run it.
- **Screenshots / recordings**: leave an `<!-- screenshots:start --> ... <!-- screenshots:end -->` region; for UI changes suggest running the codemaman-pr-screenshots skill.
- **Risk & rollout**: migrations, feature flags, config/env changes, backwards compatibility, rollback plan. Write "Low risk, no migrations" explicitly if true.
- **Follow-ups**: deferred work with ticket links.
- **Reviewer guide** (large PRs only): suggested reading order and where to focus.

## 3. Quality bar
- Every claim must be true of the diff. Don't describe intended work that isn't there, and don't tick checklist items (tests pass, docs updated) unless you verified them.
- Explain the why. A reviewer can read the what from the diff.
- Call out breaking changes, new dependencies, schema changes and security-relevant changes prominently.
- No filler, no marketing tone, no emoji walls. Match the repo's style.
- Suggest a title in the form `ABC-123: <imperative summary>` (or the repo's convention), under ~70 chars.
- If the PR mixes unrelated changes or is very large, say so and mention the codemaman-pr-split skill.

## 4. Apply
- Show the draft (and title) to the user. Only after approval: write the body to a temp file and run `gh pr edit <n> --body-file <file>` (and `--title` if changed).
- When refreshing an existing description, change only the stale parts and tell the user which sections you altered.
- Report the PR URL.

## Rules
- Never overwrite hand-written content or marker regions you don't own.
- Never include secrets, internal-only URLs or customer data.
- Ask rather than guess when the intent of the change isn't clear from the code and ticket.