pr-diff
Compare branches to review code changes and automatically draft pull request titles and descriptions.
Install
mkdir -p .claude/skills/pr-diff && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15064" && unzip -o skill.zip -d .claude/skills/pr-diff && rm skill.zipInstalls to .claude/skills/pr-diff
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Produce a pull request diff between the current branch and a target branch. Use when: reviewing PR changes, performing code review, summarizing PR changes (title + description), creating a new PR with title and description, understanding what a branch introduces, comparing branches, getting diff output.Key capabilities
- →Produce a structured diff between current and target branches
- →Summarize PR changes for title and description
- →Draft a PR title in conventional commit format
- →Generate a structured PR description
- →List modified files grouped by status
- →Retrieve full diff content
How it works
The skill asks for a target branch and work item, runs a script to get diff metadata, retrieves the full diff content, and then performs the requested action like PR summarization or creation.
Inputs & outputs
When to use pr-diff
- →Reviewing and auditing code changes before merging
- →Drafting a PR title and description based on branch changes
- →Comparing current branch progress against main
- →Analyzing file modifications in a specific feature branch
About this skill
PR Diff
Produces a structured diff between the current branch and a target branch, giving the agent full context on what the PR introduces.
When to Use
- PR review: User asks to review or audit PR changes
- PR summarization: User wants a PR title and description drafted from the diff
- Create PR: User asks to open or create a new PR with a generated title and description
- User wants to understand what files were modified before a code review
- User asks to "show the diff", "what changed", or "compare to main/master"
- Any workflow that requires full awareness of branch changes (code review, changelog, impact analysis)
Procedure
Step 1 — Ask for the Target Branch and Work Item
You MUST ask the user for the target branch first. Do not assume.
Use the ask-questions tool with two questions in the same call:
- Target branch — pre-filled options
origin/mainandorigin/master(markorigin/mainas recommended), allow freeform input for other branches (e.g.,develop,release/1.0). - Related work item / issue — freeform text, optional. Format depends on platform:
- GitHub:
#123 - Azure DevOps:
AB#12345 - Leave blank if there is no related work item
- GitHub:
Store both answers; the work item ID is used in the Related Work section of the PR description.
Step 2 — Run the Diff Script
You MUST run the appropriate script to get the diff output. This is a mandatory step — do not skip it.
Choose the script based on the current OS:
- Windows → use pr-diff.ps1 via
pwsh:pwsh .github/skills/pr-diff/scripts/pr-diff.ps1 -TargetBranch <target> - macOS / Linux → use pr-diff.sh:
bash .github/skills/pr-diff/scripts/pr-diff.sh <target>
The script produces metadata only (no diff content); use each piece as follows:
| Output | Source | How the agent uses it |
|---|---|---|
| Current branch name | git rev-parse --abbrev-ref HEAD | Report which feature branch is under review |
| Modified files list | git diff --name-status origin/main...HEAD | Group by status (A Added / M Modified / D Deleted / R Renamed) and present a structured scope summary |
| Diff line count | git diff ... | wc -l | Use as a scope signal: ≤1000 lines → read full diff at once; >1000 lines → offer per-file sections or summaries |
| Remote origin URL | git remote get-url origin | Extract the owner and repo to pass to mcp_io_github_git_create_pull_request |
| All remotes | git remote -v | Confirm remote names and URLs before creating a PR |
Step 3 — Digest the Output
After digesting the output, the agent MUST:
- Report the current branch and target branch
- List the modified files grouped by status (Added / Modified / Deleted / Renamed)
- State the diff size (line count) as a signal of PR scope
The agent now has full context to proceed with Step 4 and then the appropriate follow-up action in Step 5.
Step 4 — Read the Full Diff
This is a mandatory step — do not skip it.
You MUST run the following command to retrieve the full diff content:
git diff <target-branch>...HEAD
The agent MUST read the diff from the terminal output.
Step 5 — Read Full File Contents for Key Changed Files
This is a mandatory step for all workflows.
After reading the diff, use read_file to load the complete contents of key changed files — not just the lines that appear in the diff. This provides crucial context: imports, class structure, surrounding logic, and existing patterns that the diff alone cannot convey.
Prioritize reading:
- Files with substantial logic changes (not just formatting)
- Files with changed interfaces, function signatures, or class definitions
Skip:
- Files that are purely added (the diff already shows all content)
- Lock files (e.g.,
uv.lock,package-lock.json) - Files with only formatting changes (e.g., whitespace, line breaks)
- Files with only comment changes
Step 6 — Perform the Requested Action
Based on the user's intent, proceed with one of these actions after reading the diff:
PR Review
Perform a thorough code review following the project's code review instructions. Address security, correctness, test coverage, and style — grouped by severity (Critical / Important / Suggestion).
PR Summarization (title + description)
Draft a PR title (conventional commit format: type(scope): summary, 50-72 characters, imperative mood) and a full structured description. Output the entire block inside a raw markdown code fence for easy copy-paste:
```markdown
# <type(scope): concise imperative summary — 50-72 chars>
## Summary
2-3 sentence overview: what this PR does and why.
## Changes
- **Component / File:** Description of the change and its rationale
- **Component / File:** …
## Technical Details
- Key implementation decisions
- Algorithm or architecture changes
- Performance considerations
- Breaking changes (if any)
## Testing
- How changes were tested
- Test coverage impact
- Manual testing performed
## Related Work
- Closes #<issue> / AB#<work-item-id>
```
Work item handling:
- If the user provided a work item ID in Step 1, include it using the platform-specific keyword:
- GitHub:
Closes #123,Fixes #123, orResolves #123(auto-closes the issue on merge) - Azure DevOps:
AB#12345
- GitHub:
- If no work item was provided, omit the Related Work section entirely.
- Remove any placeholder lines that have no real content.
Title guidelines:
- Use imperative mood: "Add feature" not "Added feature"
- Be specific: ✅ "Add OAuth2 authentication to API layer" — ❌ "Bug fixes"
- Follow conventional-commit format:
type(scope): summary
Create PR
After drafting the title and description (see Summarization above), use the mcp_io_github_git_create_pull_request tool to open the PR against the target branch. Confirm the title and description with the user before submitting.
Notes
- The
...(three-dot) syntax ingit diffcompares from the merge base, not the tip of the target branch — this is the correct PR semantics - If the branch has no commits ahead of the target, the diff will be empty — inform the user
- The scripts output metadata only; the agent retrieves the actual diff by running
git diff <target>...HEADdirectly in the terminal
When not to use it
- →When the user does not want to compare branches or review changes
- →When the task is not related to pull request creation or review
Limitations
- →The skill requires the user to specify the target branch.
- →The script produces metadata only; the agent retrieves the actual diff.
- →It prioritizes reading files with substantial logic changes.
How it compares
This skill automates the process of generating a structured diff and drafting PR content based on branch changes, providing a more efficient workflow than manual diff analysis and PR description writing.
Compared to similar skills
pr-diff side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| pr-diff (this skill) | 0 | 3mo | Review | Intermediate |
| resolve-conflicts | 81 | 8mo | Review | Intermediate |
| dependency-upgrade | 26 | 5mo | Review | Intermediate |
| git-commits | 21 | 4mo | No flags | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
resolve-conflicts
antinomyhq
Use this skill immediately when the user mentions merge conflicts that need to be resolved. Do not attempt to resolve conflicts directly - invoke this skill first. This skill specializes in providing a structured framework for merging imports, tests, lock files (regeneration), configuration files, and handling deleted-but-modified files with backup and analysis.
dependency-upgrade
wshobson
Manage major dependency version upgrades with compatibility analysis, staged rollout, and comprehensive testing. Use when upgrading framework versions, updating major dependencies, or managing breaking changes in libraries.
git-commits
bonny
Create well-structured git commits in logical chunks following best practices
git-advanced-workflows
wshobson
Master advanced Git workflows including rebasing, cherry-picking, bisect, worktrees, and reflog to maintain clean history and recover from any situation. Use when managing complex Git histories, collaborating on feature branches, or troubleshooting repository issues.
github-multi-repo
ruvnet
Multi-repository coordination, synchronization, and architecture management with AI swarm orchestration
git-workflow-enforcer
CrazyDubya
Ensures commits follow conventional commits, branch naming conventions, and PR templates. Use when creating commits, branches, or PRs, or when user mentions git workflow.