Generating PR Descriptions
When to use
- Preparing a pull request for review and need a comprehensive description
- Generating a PR title automatically from commit message analysis
- Classifying the type of change (bug fix, feature, breaking change)
- Saving a reusable PR description to
docs/pr-descriptions/<branch-name-with-hyphens>.md
Skip when
- The PR is a single trivial commit with an obvious description
- A PR description already exists and does not need regeneration
- The branch has no commits beyond the base branch
Process
1. Git Branch Analysis - CRITICAL: Branch-Only Scope
- MANDATORY: Identify actual branch point to avoid analyzing entire development history
- Detect the base branch (develop, main, master) that the current branch was created from
- CORRECT APPROACH: Use
git merge-base HEAD <base-branch> to find the true divergence point
- CORRECT APPROACH: Use
git log --oneline $(git merge-base HEAD <base-branch>)..HEAD for branch-specific commits
- CORRECT APPROACH: Use
git diff $(git merge-base HEAD <base-branch>)..HEAD for branch-specific changes
- NEVER rely on manual
HEAD~n counting — it breaks on merges, rebases, and long-lived branches
- Run
git status --porcelain to identify uncommitted files (excluded from PR)
- Enforce that PR analyzes ONLY commits made on the current feature branch, not development history
- Determine if this is a bug fix, feature, or breaking change based on actual branch commits
2. Change Classification
- Analyze file patterns and change types
- Identify the type of change (bug fix, new feature, breaking change, etc.)
- Detect if documentation updates are needed
- Determine testing requirements
3. PR Description Generation
- Create comprehensive description following the template format
- Include summary of changes and motivation based on ONLY branch-specific commits
- Pre-fill appropriate checkboxes based on change analysis
- Suggest testing strategies
- Derive the output filename from the full branch name with slashes replaced by hyphens (e.g.,
feature/FE-157 -> feature-FE-157.md)
- Save to
docs/pr-descriptions/<derived-filename> (create directory if needed)
CRITICAL Implementation Steps
Step 1: Branch Analysis (MANDATORY)
# 1. Get branch structure to identify commits
git log --oneline --decorate --graph -10
# 2. Count commits unique to current branch
# Look for where branch diverged from main/develop
# Example output shows 2 commits on feature/PLU-393:
# * 06603bf (HEAD -> feature/PLU-393) fix(i18n): add missing translations
# * d40c631 feat(ui): enhance templates system with calendar filter
# * 30664b1 (develop) Merge branch 'develop' into feature/libs
Step 2: Extract Branch-Only Changes (MANDATORY)
# Use HEAD~n where n = number of branch commits
git log --oneline HEAD~2..HEAD # Get branch commits
git diff HEAD~2..HEAD --name-status # Get changed files
git diff HEAD~2..HEAD --stat # Get change statistics
Step 3: Validation (MANDATORY)
- Verify commit count matches actual branch commits
- Ensure no base branch commits are included in analysis
- Confirm file changes align with branch purpose
WRONG APPROACH - DO NOT USE:
git log main..HEAD # Includes entire development history
git diff main...HEAD # Includes all changes since branch creation
Generated Template Structure
The skill generates pull requests following this exact structure:
# [Auto-generated PR title: short, under 70 chars, using conventional commit prefix]
# Description
[Auto-generated summary of changes and motivation based on commits]
## Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
PR Title Generation
- Auto-generated from commit message analysis
- Uses conventional commit prefix (
feat:, fix:, chore:, refactor:, etc.) based on the dominant change type
- Kept under 70 characters, concise and descriptive
- Placed as the first
# heading in the output file
Change Type Detection
- Bug fix: Detects fixes, corrections, and patches in commit messages
- New feature: Identifies new functionality, components, or capabilities
- Breaking change: Flags API changes, removed functionality, or incompatible changes
- Documentation update: Detects changes to .md files, comments, or docs folders
Implementation Requirements - CRITICAL
MANDATORY Git Command Usage:
Branch Point Detection:
git log --oneline --decorate --graph -10
# Identify where current branch diverged from base
# Count commits unique to current branch
Branch-Only Analysis Commands:
# For 2 commits on current branch:
git log --oneline HEAD~2..HEAD
git diff HEAD~2..HEAD --name-status
git diff HEAD~2..HEAD --stat
# NEVER use these (includes all development history):
git log main..HEAD # WRONG
git diff main...HEAD # WRONG
Branch Point Validation:
- If branch has 3 commits: use
HEAD~3..HEAD
- If branch has 5 commits: use
HEAD~5..HEAD
- Always verify commit count matches actual branch commits
Smart Analysis Features
- File Pattern Recognition: Detects frontend/backend changes, test files, config changes
- Commit Message Analysis: Uses conventional commits to determine change types
- Dependency Detection: Identifies if package.json or similar files changed
- Test Coverage: Suggests appropriate testing based on changed components
Notes
- Critical: Uses
HEAD~n..HEAD approach to analyze ONLY current branch commits
- Branch Validation: Verifies number of commits on branch before analysis
- Feature Branch Scope: Analyzes only commits made specifically on the current feature branch
- Committed Changes Only: Analyzes committed changes in the branch only, ignores uncommitted files
- Precise Scope: Prevents inclusion of entire development history in PR description
- Generated PRs reflect actual feature branch changes, not cumulative project history
- Breaking changes are flagged based on actual branch commits only
- Generated PR descriptions are saved to
docs/pr-descriptions/<branch-name-with-hyphens>.md for easy copying to GitHub/GitLab
1---2name: ring-generating-pr-descriptions3description: "Generating pull request descriptions from git branch changes with automatic title generation, change-type detection, and smart analysis. Uses branch-only scope to avoid full history analysis. Use when preparing a PR for review. Skip when the PR is a single trivial commit or description already exists."4user-invocable: true5argument-hint: "[base-branch]"6---78# Generating PR Descriptions910## When to use11- Preparing a pull request for review and need a comprehensive description12- Generating a PR title automatically from commit message analysis13- Classifying the type of change (bug fix, feature, breaking change)14- Saving a reusable PR description to `docs/pr-descriptions/<branch-name-with-hyphens>.md`1516## Skip when17- The PR is a single trivial commit with an obvious description18- A PR description already exists and does not need regeneration19- The branch has no commits beyond the base branch2021## Process2223### 1. Git Branch Analysis - CRITICAL: Branch-Only Scope2425- **MANDATORY**: Identify actual branch point to avoid analyzing entire development history26- Detect the base branch (develop, main, master) that the current branch was created from27- **CORRECT APPROACH**: Use `git merge-base HEAD <base-branch>` to find the true divergence point28- **CORRECT APPROACH**: Use `git log --oneline $(git merge-base HEAD <base-branch>)..HEAD` for branch-specific commits29- **CORRECT APPROACH**: Use `git diff $(git merge-base HEAD <base-branch>)..HEAD` for branch-specific changes30- **NEVER** rely on manual `HEAD~n` counting — it breaks on merges, rebases, and long-lived branches31- Run `git status --porcelain` to identify uncommitted files (excluded from PR)32- **Enforce that PR analyzes ONLY commits made on the current feature branch, not development history**33- Determine if this is a bug fix, feature, or breaking change based on actual branch commits3435### 2. Change Classification3637- Analyze file patterns and change types38- Identify the type of change (bug fix, new feature, breaking change, etc.)39- Detect if documentation updates are needed40- Determine testing requirements4142### 3. PR Description Generation4344- Create comprehensive description following the template format45- Include summary of changes and motivation based on ONLY branch-specific commits46- Pre-fill appropriate checkboxes based on change analysis47- Suggest testing strategies48- Derive the output filename from the full branch name with slashes replaced by hyphens (e.g., `feature/FE-157` -> `feature-FE-157.md`)49- Save to `docs/pr-descriptions/<derived-filename>` (create directory if needed)5051## CRITICAL Implementation Steps5253### Step 1: Branch Analysis (MANDATORY)5455```bash56# 1. Get branch structure to identify commits57git log --oneline --decorate --graph -105859# 2. Count commits unique to current branch60# Look for where branch diverged from main/develop61# Example output shows 2 commits on feature/PLU-393:62# * 06603bf (HEAD -> feature/PLU-393) fix(i18n): add missing translations63# * d40c631 feat(ui): enhance templates system with calendar filter64# * 30664b1 (develop) Merge branch 'develop' into feature/libs65```6667### Step 2: Extract Branch-Only Changes (MANDATORY)6869```bash70# Use HEAD~n where n = number of branch commits71git log --oneline HEAD~2..HEAD # Get branch commits72git diff HEAD~2..HEAD --name-status # Get changed files73git diff HEAD~2..HEAD --stat # Get change statistics74```7576### Step 3: Validation (MANDATORY)7778- Verify commit count matches actual branch commits79- Ensure no base branch commits are included in analysis80- Confirm file changes align with branch purpose8182**WRONG APPROACH - DO NOT USE:**8384```bash85git log main..HEAD # Includes entire development history86git diff main...HEAD # Includes all changes since branch creation87```8889## Generated Template Structure9091The skill generates pull requests following this exact structure:9293```markdown94# [Auto-generated PR title: short, under 70 chars, using conventional commit prefix]9596# Description9798[Auto-generated summary of changes and motivation based on commits]99100## Type of change101102- [ ] Bug fix (non-breaking change which fixes an issue)103- [ ] New feature (non-breaking change which adds functionality)104- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)105- [ ] This change requires a documentation update106```107108### PR Title Generation109110- **Auto-generated** from commit message analysis111- Uses conventional commit prefix (`feat:`, `fix:`, `chore:`, `refactor:`, etc.) based on the dominant change type112- Kept under 70 characters, concise and descriptive113- Placed as the first `#` heading in the output file114115### Change Type Detection116117- **Bug fix**: Detects fixes, corrections, and patches in commit messages118- **New feature**: Identifies new functionality, components, or capabilities119- **Breaking change**: Flags API changes, removed functionality, or incompatible changes120- **Documentation update**: Detects changes to .md files, comments, or docs folders121122## Implementation Requirements - CRITICAL123124**MANDATORY Git Command Usage:**1251261. **Branch Point Detection:**127128 ```bash129 git log --oneline --decorate --graph -10130 # Identify where current branch diverged from base131 # Count commits unique to current branch132 ```1331342. **Branch-Only Analysis Commands:**135136 ```bash137 # For 2 commits on current branch:138 git log --oneline HEAD~2..HEAD139 git diff HEAD~2..HEAD --name-status140 git diff HEAD~2..HEAD --stat141142 # NEVER use these (includes all development history):143 git log main..HEAD # WRONG144 git diff main...HEAD # WRONG145 ```1461473. **Branch Point Validation:**148 - If branch has 3 commits: use `HEAD~3..HEAD`149 - If branch has 5 commits: use `HEAD~5..HEAD`150 - **Always verify** commit count matches actual branch commits151152## Smart Analysis Features153154- **File Pattern Recognition**: Detects frontend/backend changes, test files, config changes155- **Commit Message Analysis**: Uses conventional commits to determine change types156- **Dependency Detection**: Identifies if package.json or similar files changed157- **Test Coverage**: Suggests appropriate testing based on changed components158159## Notes160161- **Critical**: Uses `HEAD~n..HEAD` approach to analyze ONLY current branch commits162- **Branch Validation**: Verifies number of commits on branch before analysis163- **Feature Branch Scope**: Analyzes only commits made specifically on the current feature branch164- **Committed Changes Only**: Analyzes committed changes in the branch only, ignores uncommitted files165- **Precise Scope**: Prevents inclusion of entire development history in PR description166- Generated PRs reflect actual feature branch changes, not cumulative project history167- Breaking changes are flagged based on actual branch commits only168- Generated PR descriptions are saved to `docs/pr-descriptions/<branch-name-with-hyphens>.md` for easy copying to GitHub/GitLab