Generates comprehensive, reviewer-friendly PR descriptions with visual diagrams, summary tables, collapsible sections, and structured test plans. Optimized for readability without sacrificing detail.
Use this Skill when:
This Skill is designed to work with any repository but is especially tuned for Django/Python backends, React frontends, and infrastructure changes.
pr-description-writer to create a PR description for my current branch."pr-description-writer Skill."Before writing the PR description, always gather the complete picture of all changes that will be included in the PR. This means:
Use gh pr view to check if the current branch already has an associated PR:
# Check if current branch has a PR (returns 0 if PR exists, non-zero otherwise)
gh pr view --json number,title,body,url 2>/dev/null
# If you just need to know if a PR exists (boolean check):
gh pr view --json number 2>/dev/null && echo "PR exists" || echo "No PR yet"
Interpretation:
0 + JSON output ā PR exists, use the PR number for updatesDetermine what branch the PR targets (or will target). Use this detection order:
# 1. If PR exists, get base from the PR (most reliable)
gh pr view --json baseRefName --jq '.baseRefName' 2>/dev/null
# 2. Get the repo's default branch via GitHub API
gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name'
# 3. Fallback: check git remote HEAD
git remote show origin 2>/dev/null | grep "HEAD branch" | cut -d: -f2 | xargs
# 4. Last resort: check which common branches exist
git branch -r | grep -E "origin/(main|master|release|develop)$" | head -1 | sed 's|origin/||'
Detection Priority:
gh repo view --json defaultBranchRef is authoritativeSmart Detection Script:
detect_base_branch() {
# Try existing PR first
local pr_base=$(gh pr view --json baseRefName --jq '.baseRefName' 2>/dev/null)
if [[ -n "$pr_base" ]]; then
echo "$pr_base"
return
fi
# Try GitHub API for default branch
local gh_default=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name' 2>/dev/null)
if [[ -n "$gh_default" ]]; then
echo "$gh_default"
return
fi
# Try git remote HEAD
local remote_head=$(git remote show origin 2>/dev/null | grep "HEAD branch" | cut -d: -f2 | xargs)
if [[ -n "$remote_head" ]]; then
echo "$remote_head"
return
fi
# Fallback to checking common branches
for branch in main master release develop; do
if git rev-parse --verify "origin/$branch" &>/dev/null; then
echo "$branch"
return
fi
done
echo "main" # Ultimate fallback
}
BASE_BRANCH=$(detect_base_branch)
echo "Using base branch: $BASE_BRANCH"
CRITICAL: The PR description must account for ALL changes, not just the latest commit. This includes:
# 1. Get the base branch (adjust as needed)
BASE_BRANCH="origin/release" # or origin/main, etc.
# 2. View ALL commits that will be in the PR
git log ${BASE_BRANCH}..HEAD --oneline
# 3. View the FULL diff of all changes (committed + uncommitted)
# This shows what reviewers will see in the PR
git diff ${BASE_BRANCH}...HEAD --stat # Files changed (committed only)
git diff ${BASE_BRANCH} --stat # Files changed (including uncommitted)
# 4. Check for uncommitted changes that should be included
git status --short
# 5. If there are uncommitted changes, include them in the diff
git diff --stat # Unstaged changes
git diff --cached --stat # Staged changes
When updating an existing PR, fetch current details to preserve/enhance:
# Get full PR details as JSON
gh pr view --json number,title,body,url,commits,files
# Get just the current body for reference
gh pr view --json body --jq '.body'
# Get list of files changed in the PR
gh pr view --json files --jq '.files[].path'
# Get commit history in the PR
gh pr view --json commits --jq '.commits[].messageHeadline'
# View the actual diff to understand what changed
git diff ${BASE_BRANCH}...HEAD
# For a specific file
git diff ${BASE_BRANCH}...HEAD -- path/to/file.py
# See commit messages for context on why changes were made
git log ${BASE_BRANCH}..HEAD --format="%h %s%n%b" | head -100
gh CLIOnce the description is generated, use gh pr edit to update:
# Update PR title and body
gh pr edit <number> --title "New Title" --body "$(cat <<'EOF'
## Summary
...full markdown body here...
EOF
)"
# Or update just the body
gh pr edit --body "$(cat <<'EOF'
...full markdown body here...
EOF
)"
# Update PR for current branch (no number needed if on the branch)
gh pr edit --body "..."
Creating a new PR:
gh pr create --title "Title" --body "$(cat <<'EOF'
## Summary
...
EOF
)" --base release
Reviewers should understand the PR in 30 seconds from the summary, then dive deeper as needed. Structure content in layers:
Use diagrams, tables, and structured formatting instead of prose where possible:
Every section should answer a reviewer's question:
Never describe only the latest commit. The PR description must reflect:
Start with a 1-2 sentence high-level summary, then provide a Key Features table if the PR has 3+ distinct features:
## Summary
This PR adds [brief description of the main change].
### Key Features
| Feature | Description |
|---------|-------------|
| **Feature A** | Short description of what it does |
| **Feature B** | Short description of what it does |
| **Feature C** | Short description of what it does |
For smaller PRs (1-2 features), a bullet list is acceptable.
For any non-trivial flow, include a visual diagram. Choose the appropriate format based on complexity:
Use for decision trees and linear flows:
## Feature Flow
First condition? ā YES āāāŗ Has prior state? āāāŗ YES: Action A ā āāāāŗ NO: Action B ā NO āāāāŗ Action C
Use for multi-step pipelines, state machines, or architectures:
## Architecture
```mermaid
flowchart LR
A[Step 1] --> B[Step 2]
B --> C{Decision}
C -->|Yes| D[Path A]
C -->|No| E[Path B]
#### Box Diagrams (Pipelines)
Use for showing data flow or process stages:
```markdown
## Data Pipeline
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā ā Input Stage āāāāāāŗā Process Stage āāāāāāŗā Output Stage ā ā (description) ā ā (description) ā ā (description) ā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
For each major feature, provide a dedicated section with:
Use horizontal rules (---) to separate major features.
---
## Feature A: Title
Description of what this feature does and why.
Key implementation details:
- Point 1
- Point 2
---
## Feature B: Title
...
Group files by category using collapsible sections:
## Files Changed
<details>
<summary>Core modules (click to expand)</summary>
- `path/to/file1.py` - Brief description
- `path/to/file2.py` - Brief description
</details>
<details>
<summary>Tests (click to expand)</summary>
- `tests/test_file1.py` - What it tests
- `tests/test_file2.py` - What it tests
</details>
Categories to consider:
Provide both automated and manual testing instructions:
## How to Test
```bash
# Run all related tests
.bin/pytest path/to/tests/ -v
### Section 6: Breaking Changes / Notes
Always include a section for special considerations:
```markdown
## Notes
- **No Migrations**: This PR has no schema changes.
Or for PRs with important notes:
## Breaking Changes
- **API Change**: The `/api/endpoint` now returns X instead of Y.
- **Config Required**: Set `NEW_ENV_VAR` before deploying.
## Deploy Steps
1. Add environment variable `NEW_VAR=value`
2. Run migrations
3. Deploy code
| Scenario | Use |
|---|---|
| 3+ distinct features | Summary table |
| Conditional logic | ASCII decision tree |
| Multi-step process | Box diagram or Mermaid |
| 5+ files in a category | Collapsible details |
| Test commands exist | Code block with commands |
| Manual testing needed | Numbered step list |
| Schema changes | Explicit migration section |
| Breaking changes | Dedicated callout section |
## Feature Flag
Controlled by `FEATURE_FLAG_NAME` (default: `False`).
When enabled:
- Behavior A
- Behavior B
When disabled:
- Falls back to original behavior
## Migrations
| Migration | Description | Reversible |
|-----------|-------------|------------|
| `0001_add_field.py` | Adds `new_field` to Model | Yes |
| `0002_backfill.py` | Backfills existing rows | Yes (data loss) |
### Rollback Plan
1. Revert code deployment
2. Run `./manage.py migrate app_name 0000_previous`
## API Changes
### New Endpoints
| Method | Path | Description |
|--------|------|-------------|
| `GET` | `/api/v2/resource` | Fetches resource with new format |
### Modified Endpoints
| Endpoint | Change |
|----------|--------|
| `GET /api/v1/old` | Now returns `new_field` in response |
### Deprecated
- `GET /api/v1/legacy` - Use `/api/v2/resource` instead
Wall of text ā Use formatting (tables, lists, diagrams) instead of paragraphs.
Vague descriptions ā "Various bug fixes" tells reviewers nothing. Be specific.
Missing test instructions ā Always include how to verify the changes.
Buried breaking changes ā Put them in a dedicated, visible section.
Listing every file ā Use collapsible sections and group by purpose.
No visual aids for flows ā If you need more than 2 sentences to explain a flow, use a diagram.
Describing only the latest commit ā The PR description should cover ALL commits and changes in the branch.
gh CLI Commands# Check if current branch has a PR
gh pr view --json number 2>/dev/null && echo "Has PR" || echo "No PR"
# Get PR number for current branch
gh pr view --json number --jq '.number'
# Get full PR details
gh pr view --json number,title,body,baseRefName,headRefName,url,state,files,commits
# Get PR URL
gh pr view --json url --jq '.url'
# Create new PR
gh pr create --title "Title" --body "Body" --base release
# Update existing PR (current branch)
gh pr edit --title "New Title" --body "New Body"
# Update specific PR by number
gh pr edit 1234 --title "New Title" --body "New Body"
# Add reviewers
gh pr edit --add-reviewer username1,username2
# Add labels
gh pr edit --add-label "enhancement,needs-review"
# View PR diff
gh pr diff
# View PR diff for specific PR
gh pr diff 1234
# View PR files
gh pr view --json files --jq '.files[].path'
# View PR commits
gh pr view --json commits --jq '.commits[] | "\(.oid[0:7]) \(.messageHeadline)"'
This Skill works with both Claude Code and OpenAI Codex.
For Codex users:
--repo DiversioTeam/agent-skills-marketplace --path plugins/pr-description-writer/skills/pr-description-writer.$skill pr-description-writer to invoke.For Claude Code users:
/plugin install pr-description-writer@diversiotech./pr-description-writer:write-pr to invoke.When this Skill generates a PR description, it should:
gh pr edit if a PR exists, or
create one using gh pr create if not.The description should be copy-paste ready for GitHub.