/pr - Pull Request Description Generator
Analyze all changes in the current branch compared to the base branch and generate comprehensive PR descriptions.
Implementation: This command delegates to the specialized pr-generator subagent for optimal performance and context efficiency.
How It Works
When invoked, this command:
- Launches the
pr-generator subagent via Task tool
- Subagent detects base branch dynamically (main/master/develop)
- Analyzes git diff, commit history, and file changes
- Generates comprehensive PR descriptions
- Returns multiple template alternatives
Usage
Basic Usage
/pr
Generates PR description from current branch changes.
With Issue Reference
/pr "#456"
Links PR to specific issue.
With Custom Context
/pr "This PR implements the new authentication flow discussed in the team meeting"
Incorporates additional context into the description.
PR Description Structure
Essential Sections
- Summary: High-level overview
- Motivation: Why these changes
- Changes: Detailed breakdown
- Testing: Verification steps
- Related: Linked issues/PRs
Optional Sections
- Screenshots: For UI changes
- Breaking Changes: For API modifications
- Performance Impact: For optimizations
- Migration Guide: For breaking changes
Output Format
The command provides:
- Branch analysis: Current/base branches, commits, files, lines changed
- Change summary: Type, affected components, breaking changes, test coverage
- Recommended template: Comprehensive PR description
- Alternative formats: Detailed, concise, custom versions
- Usage instructions: How to create PR with description
Integration with Workflow
Works seamlessly with:
/branch - Create branch first
/commit - Make commits
/pr - Generate PR description
/audit - Code review after PR
Technical Details
Subagent Benefits
- 90% context reduction: Only git operations, no codebase loading
- 2-3x faster execution: Lightweight agent optimized for git analysis
- Specialized logic: Dedicated to PR description generation
- Parallel execution: Can run concurrently with other operations
Git Operations Used
The subagent only executes git commands:
git symbolic-ref - Detect base branch
git diff - Compare branches
git log - Analyze commits
git status - Check current state
- No file system access or code parsing
Base Branch Detection
The subagent automatically detects the base branch:
- Attempts:
git symbolic-ref refs/remotes/origin/HEAD
- Falls back to:
main → master → develop
- Never assumes without verification
Related Commands
/branch - Generate branch names
/commit - Generate commit messages
/audit - Code review
Best Practices
- Create PR after commits: Ensure all changes are committed
- Include context: Provide motivation and goals
- Add testing steps: Help reviewers verify
- Link issues: Connect to relevant issues
- Review before submitting: Check generated description
Context Efficiency
This command is optimized for minimal context usage:
- ✅ No codebase files loaded
- ✅ Only git metadata analyzed
- ✅ Fast execution (<10 seconds)
- ✅ Can run in parallel with other tasks
Smart Features
Automatic Detection
- Issue numbers from commits/branch
- Change type (feature/fix/refactor)
- Breaking changes
- Test coverage
- Affected components
Pattern Recognition
- API changes
- UI updates
- Database modifications
- Configuration changes
- Dependency updates
Note: For implementation details, see .claude/agents/git/pr-generator.md