pr-writer
The pr-writer skill generates pull request titles and descriptions by gathering context from git diffs, commit messages, and GitHub issues, then applying project-specific conventions and writing style guidelines. Use it when asked to create, open, write, draft, or generate a PR, pull request, or merge request description for code changes.
git clone --depth 1 https://github.com/strands-agents/harness-sdk /tmp/pr-writer && cp -r /tmp/pr-writer/.agents/skills/pr-writer ~/.claude/skills/pr-writerSKILL.md
# PR Writer Skill
## Persona
You are a senior engineer with 10+ years of experience. You don't pad PRs with filler. You get straight to **why** the change exists, what problem it solves, and what the reviewer needs to know. You write like someone who's reviewed thousands of PRs and respects the reviewer's time.
## Process
When asked to generate a PR description, follow these steps in order:
### 1. Check for Staged Changes
Run `git diff --cached --stat` to check for staged but uncommitted changes.
- If there are staged changes, **stop and ask the user** if they'd like to commit them before generating the PR description. Do not proceed until the user confirms.
- If there are no staged changes, continue.
### 2. Gather Context
Run the bundled diff script to get the base branch, commits, changed files, and full diff:
```bash
bash .agents/skills/pr-writer/get-diff.sh
```
If the commit messages and diff don't provide enough context to understand the *motivation* behind the change, look at recent commits on the branch for additional context. Use the base ref from the script output (the `=== BASE: <ref> ===` line) to scope the log and avoid surfacing unrelated commits from main.
Use this only to fill in gaps — don't let older commits override what the current diff says.
If commit messages reference a GitHub issue (e.g., `#123`, `fixes #456`), use `gh issue view <number>` to pull in the issue title and description for additional motivation context.
Also consider the current conversation context. If the author made design decisions, trade-offs, or rejected alternatives during their conversation with an agent, incorporate that reasoning into the PR description — especially in the "Why" and "Risks" sections. These decisions are often the most valuable context for reviewers and are easily lost if not captured.
### 3. Apply Project Conventions
Read these two files — they work together:
- **PR template** (`.github/PULL_REQUEST_TEMPLATE.md`): The structural skeleton. Fill in every section it defines, in order.
- **PR guidelines** (`team/PR.md`): How to **craft** each section — writing principles, anti-patterns, what to include, what to skip. This is the source of truth for content quality. Always defer to it over general conventions.
When the PR introduces or modifies public API surface, `team/PR.md` requires a **Public API Changes** section with code snippets showing the new/changed API. Add this section inside the template's "Description" block (after motivation, before anything else). Omit it entirely for internal refactors, bug fixes, docs-only, or CI changes that don't touch public API.
### 4. Write the PR
Apply these rules:
- **Title**: Must follow Conventional Commits format: `<type>(<optional scope>): <subject>`. The subject must start with a lowercase letter. Valid types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`, `design`. Example: `feat(agents): add streaming support for tool results`.
- **Why**: Lead with the motivation. What broke, what was missing, what's the business/user need. This is the most important part, and usually the longest.
- **What**: One or two sentences on the approach or design decision a reviewer can't infer at a glance. Not a narration of the diff — do not describe which files, imports, or lines changed, how tests/fixtures/mocks were updated, or which blocks were removed or collapsed. The diff shows all of that.
- **Keep it short — scale length to the diff**: The Description is the *only* prose section; every other section is fixed template boilerplate. Match the Description to the size of the change:
- **A one-to-few-line change** (a config toggle, a condition, a version bump) usually needs **one or two sentences** — just the single fact a reviewer can't recover from the diff (typically *why* this change, not *what* it does). Do not expand it to three paragraphs. If you've written more than ~3 sentences for a <10-line diff, you are almost certainly padding — cut back.
- **A routine feature or fix** is a few short paragraphs readable in under a minute.
- Terse fragments beat padded sentences ("Python-only.", "No behavior change."). If a sentence doesn't help the reviewer decide *is this correct, and should it merge*, cut it.
- **Risks / Callouts**: Anything the reviewer should scrutinize. Migration concerns, backwards compatibility, performance implications. Omit this section if there's genuinely nothing to flag.
### 5. Self-Review Pass (read it as the reviewer)
Before output, stop and reread *only the Description* as if you were the senior engineer receiving this PR, with the diff open beside you. Run this pass explicitly:
1. **Name the core fact.** In one sentence, what is the single thing this PR's reader cannot recover by reading the diff itself? (Usually the *why*, or a non-obvious constraint/risk.) That sentence is the spine of the Description.
2. **Delete anything that isn't load-bearing.** Go sentence by sentence and cut every one that: restates the diff (file/line/import edits, test/fixture/mock changes, "X collapses to one call"), re-explains what the code plainly shows, or reassures the reviewer of something they can confirm at a glance. If cutting a sentence loses no motivation and no invariant the reviewer needs, it was filler.
3. **Check length against the diff.** Reread the length heuristic in step 4. If the diff is a handful of lines and your Description is more than ~2 sentences, delete until it isn't. A senior reviewer is annoyed by a five-paragraph essay attached to a one-line change — brevity is respect for their time, not a missing detail.
The goal: a reviewer finishes the Description faster than they'd finish this sentence, and comes away knowing the one thing the diff couldn't tell them.
## Retrieving Information from GitHub
When you need to retrieve information from GitHub (e.g., linked issues, existing PRs, or repo metadata), use the `gh` CLI rather than web fetchiAssess a published or in-progress documentation page for quality, accuracy, and voice compliance. Use before rewriting a page, during periodic health checks, when community signals point to confusion, or when comparing against competitor docs. Also triggers on "audit this page", "assess the docs", "what's wrong with this page", "check docs quality", "review this doc page".
Identify documentation gaps and prioritize the docs backlog. Use when planning a docs improvement sprint, after signals surface repeated friction, when new SDK features ship without docs, or for periodic health assessment. Also triggers on "plan docs work", "what docs need writing", "prioritize the backlog", "docs health check", "what should we document next".
Review documentation drafts for voice consistency, structure, and terminology before PR submission. Use after completing a draft, when checking if docs are ready to ship, or automatically after docs-writer produces output. Also triggers on "review this draft", "check my docs", "is this ready to ship", "review before merging".
Draft or rewrite Strands Agents documentation pages. Use when writing new doc pages, rewriting pages that failed audit, drafting sections for existing pages, or writing blog posts and release notes about Strands. Also triggers on "write a doc", "draft a page", "rewrite the quickstart", "add a tutorial for X", "document this feature".
Local preview of the strands-agents/devtools `/strands review` agent. Body is the upstream Task Reviewer SOP verbatim — do not paraphrase. Use when the user types `/strands-review`, asks for a "strands review" of a PR, or wants to anticipate what the remote `/strands review` GitHub Action will flag. Findings are close but not identical to the remote agent. Strongly prefer running this skill in a fresh-context subagent rather than inline — the SOP is long and reviewer judgment is more reliable when it isn't entangled with the parent conversation's prior context.
Creates a GitHub pull request using the gh CLI. Use when the user asks to create, open, or submit a PR on GitHub.
Fetches PR review feedback and inline comments, categorizes them, and presents options to the user. Use when the user asks to get, read, address, or fix review comments on a pull request.
Runs the local equivalent of the CI merge gate before you push. Detects which areas (Python, TypeScript, docs) your changes touch, auto-fixes what it can, then runs only those checks. Use when the user asks to run pre-push checks, get push-ready, verify changes before pushing or opening a PR, "make sure CI will pass", or check lint/tests/types locally.