What I do
- Validate feature branch has commits ahead of master/main
- Push branch to remote if needed
- Generate PR title summarizing all commits + session work (no type prefix)
- Create concise PR description with summary and 3-5 key changes
- Link GitHub issue if working on one in current session
- Create GitHub PR using
gh CLI and self-assign it to the authenticated GitHub user
- Update root
CHANGELOG.md when present with one PR-linked unreleased bullet using the PR URL, then commit and push that changelog update back to the same branch
When to use me
Use this skill when the user asks to create a pull request from the current feature branch.
Prerequisites
- Must be on a feature branch (not master/main)
- Branch must have commits ahead of base branch
- GitHub CLI (
gh) must be installed and authenticated
- If
gh not installed → error: "GitHub CLI not found. Install: https://cli.github.com/"
Validation Workflow
- Check current branch:
git branch --show-current
- If on
master or main → error message and exit
- Check for commits ahead of base:
- Try:
git log master..HEAD --oneline
- Fallback:
git log main..HEAD --oneline
- If no commits ahead → warn user and exit
Push Workflow
- Check if branch exists on remote:
git ls-remote --heads origin <branch-name>
- If not on remote:
git push -u origin <branch-name>
- If exists on remote:
git push
- If a follow-up changelog sync creates a new
CHANGELOG.md commit after PR creation, push that commit to the same branch as well
PR Title Generation
- Analyze all commit messages in the branch
- Analyze agent's session context and work completed
- Summarize into one cohesive title (no type prefix)
- If commits use conventional format (
feat:, fix:), strip type prefixes
- Capitalize first letter
- Examples:
Add CSV export functionality and update documentation
Resolve NPE in call graph builder
Implement parallel test execution
PR Description Generation
Base Branch Detection
- Primary:
master
- Fallback:
main (if master doesn't exist)
- Check:
git rev-parse --verify master 2>/dev/null && echo "master" || echo "main"
Assignee Resolution
- Always self-assign the PR to the authenticated GitHub CLI account
- Use
--assignee @me with gh pr create
- Do not derive the assignee from local git config such as
git config user.name or email
Issue Linking
If the agent is working on a GitHub issue in the current session:
- Check session context for issue number (e.g., working on issue #123)
- Add issue reference to PR body footer:
---
Closes #<issue-number>
Create PR
Execute the pull request creation:
gh pr create --base <master-or-main> --assignee @me --title "<title>" --body "<description>"
- If working on an issue, append
Closes #<issue-number> to the description
- Always include
--assignee @me so the PR is assigned to the signed-in gh user
- Capture the created PR number and URL for any follow-up changelog sync, commit, and push
- Return the PR URL to the user
CHANGELOG.md Sync
After the PR is created, optionally sync the repository root CHANGELOG.md.
When to sync
- Only if
CHANGELOG.md exists at the repository root
- Only if
## [Unreleased] exists exactly once
- Only if the unreleased section already contains the target subsection heading
- If any of the above checks fail, skip changelog editing without failing PR creation
Changelog Commit and Push Workflow
After the PR exists and its number is known:
- Update or insert the single PR-linked unreleased bullet using the PR number and PR URL
- If
CHANGELOG.md is unchanged after the sync logic, stop here
- If
CHANGELOG.md changed, stage only that file:git add CHANGELOG.md
- Verify the staged set contains only
CHANGELOG.md before committing:git diff --cached --name-only
If any staged path other than CHANGELOG.md appears, warn and skip the changelog commit rather than risking unrelated files in the commit.
- Create a dedicated changelog commit:
git commit -m "docs: add changelog entry for PR #<pr-number>"
If the skill updated an existing bullet rather than adding a new one, use:git commit -m "docs: update changelog entry for PR #<pr-number>"
- Push that new changelog commit to the same branch that backs the PR:
git push
Rules:
- Only create the follow-up changelog commit when
CHANGELOG.md actually changed
- Stage only
CHANGELOG.md; never use broad staging like git add .
- Verify the staged set contains only
CHANGELOG.md before git commit; otherwise warn and skip the changelog commit
- Keep the changelog commit dedicated to the changelog sync so the PR history is easy to understand
- If
CHANGELOG.md already has unrelated local edits that make the sync unsafe or ambiguous, skip changelog editing and warn the user instead of guessing
- Do not fail PR creation just because changelog commit or push steps are skipped
Changelog Entry Format
Section Selection
Choose the best matching subsection under ## [Unreleased] based on the PR's high-level purpose:
### Added for new user-facing capabilities or first-time integrations
### Changed for meaningful behavior changes or enhancements to existing functionality
### Deprecated when marking functionality as discouraged but still available
### Removed when functionality is no longer available to users
### Fixed for user-visible bug fixes
### Security for security-relevant fixes or improvements
### Misc only when the PR is notable but does not fit the standard Keep a Changelog sections
Update Rules
- Treat changelog state as one PR = one bullet
- Within the
## [Unreleased] section, if a bullet already references that PR number using either (#<pr-number>) or ([#<pr-number>](<pr-url>)), update that line instead of appending a second one
- Only move bullets within the
## [Unreleased] section (between its subsections) when the PR's high-level purpose is better represented elsewhere
- Never create duplicate bullets for the same PR number within
## [Unreleased]
- If multiple matching bullets for the same PR number exist within
## [Unreleased], or if matching bullets are found only outside ## [Unreleased], treat the changelog as ambiguous and skip editing
- If an existing plain
(#<pr-number>) suffix is found, rewrite it to the linked ([#<pr-number>](<pr-url>)) form during the update
- If changelog sync succeeds and produces a file change, commit and push that
CHANGELOG.md change to the same PR branch
Error Handling
- Not on feature branch → "Error: Cannot create PR from master/main branch"
- No commits ahead → "Warning: No commits to create PR for"
gh not installed → "Error: GitHub CLI not found. Install: https://cli.github.com/"
gh not authenticated / gh auth status fails → "Error: GitHub CLI not authenticated. Run: gh auth login"
- Self-assignment fails (for example, assignees unsupported or user not assignable) → surface the
gh error clearly and do not claim the PR was self-assigned
CHANGELOG.md missing, malformed, ambiguous, or missing the needed unreleased subsection → skip changelog sync and continue
- Staged set contains files other than
CHANGELOG.md after sync → warn and skip the changelog commit to avoid committing unrelated staged changes
git commit for CHANGELOG.md fails → warn user but keep the PR: "Warning: PR created but changelog commit failed."
git push for the follow-up changelog commit fails → warn user but keep the PR: "Warning: PR created but changelog commit was not pushed."
1---2name: git-pr3description: Create GitHub pull requests with smart title and description from branch commits4license: MIT5---67## What I do89- Validate feature branch has commits ahead of master/main10- Push branch to remote if needed11- Generate PR title summarizing all commits + session work (no type prefix)12- Create concise PR description with summary and 3-5 key changes13- Link GitHub issue if working on one in current session14- Create GitHub PR using `gh` CLI and self-assign it to the authenticated GitHub user15- Update root `CHANGELOG.md` when present with one PR-linked unreleased bullet using the PR URL, then commit and push that changelog update back to the same branch1617## When to use me1819Use this skill when the user asks to create a pull request from the current feature branch.2021## Prerequisites2223- Must be on a feature branch (not master/main)24- Branch must have commits ahead of base branch25- GitHub CLI (`gh`) must be installed and authenticated26- If `gh` not installed → error: "GitHub CLI not found. Install: https://cli.github.com/"2728## Validation Workflow29301. Check current branch: `git branch --show-current`312. If on `master` or `main` → error message and exit323. Check for commits ahead of base:33 - Try: `git log master..HEAD --oneline`34 - Fallback: `git log main..HEAD --oneline`354. If no commits ahead → warn user and exit3637## Push Workflow38391. Check if branch exists on remote: `git ls-remote --heads origin <branch-name>`402. If not on remote: `git push -u origin <branch-name>`413. If exists on remote: `git push`424. If a follow-up changelog sync creates a new `CHANGELOG.md` commit after PR creation, push that commit to the same branch as well4344## PR Title Generation4546- Analyze all commit messages in the branch47- Analyze agent's session context and work completed48- Summarize into one cohesive title (no type prefix)49- If commits use conventional format (`feat:`, `fix:`), strip type prefixes50- Capitalize first letter51- Examples:52 - `Add CSV export functionality and update documentation`53 - `Resolve NPE in call graph builder`54 - `Implement parallel test execution`5556## PR Description Generation5758- Analyze commits, diffs, and session context59- Summarize many commits into 3-5 key points (avoid listing every commit)60- Format (only these sections):61 ```markdown62 ## Summary63 <2-3 sentence overview of what was accomplished>64 65 ## Changes66 - <key change 1>67 - <key change 2>68 - <key change 3>69 - <key change 4 (if needed)>70 - <key change 5 (if needed)>71 ```7273## Base Branch Detection7475- Primary: `master`76- Fallback: `main` (if master doesn't exist)77- Check: `git rev-parse --verify master 2>/dev/null && echo "master" || echo "main"`7879## Assignee Resolution8081- Always self-assign the PR to the authenticated GitHub CLI account82- Use `--assignee @me` with `gh pr create`83- Do not derive the assignee from local git config such as `git config user.name` or email8485## Issue Linking8687If the agent is working on a GitHub issue in the current session:881. Check session context for issue number (e.g., working on issue #123)892. Add issue reference to PR body footer:90 ```markdown91 ---92 Closes #<issue-number>93 ```9495## Create PR9697Execute the pull request creation:98```bash99gh pr create --base <master-or-main> --assignee @me --title "<title>" --body "<description>"100```101102- If working on an issue, append `Closes #<issue-number>` to the description103- Always include `--assignee @me` so the PR is assigned to the signed-in `gh` user104- Capture the created PR number and URL for any follow-up changelog sync, commit, and push105- Return the PR URL to the user106107## CHANGELOG.md Sync108109After the PR is created, optionally sync the repository root `CHANGELOG.md`.110111### When to sync112113- Only if `CHANGELOG.md` exists at the repository root114- Only if `## [Unreleased]` exists exactly once115- Only if the unreleased section already contains the target subsection heading116- If any of the above checks fail, skip changelog editing without failing PR creation117118### Changelog Commit and Push Workflow119120After the PR exists and its number is known:1211221. Update or insert the single PR-linked unreleased bullet using the PR number and PR URL1232. If `CHANGELOG.md` is unchanged after the sync logic, stop here1243. If `CHANGELOG.md` changed, stage only that file:125 ```bash126 git add CHANGELOG.md127 ```1284. Verify the staged set contains only `CHANGELOG.md` before committing:129 ```bash130 git diff --cached --name-only131 ```132 If any staged path other than `CHANGELOG.md` appears, warn and skip the changelog commit rather than risking unrelated files in the commit.1335. Create a dedicated changelog commit:134 ```bash135 git commit -m "docs: add changelog entry for PR #<pr-number>"136 ```137 If the skill updated an existing bullet rather than adding a new one, use:138 ```bash139 git commit -m "docs: update changelog entry for PR #<pr-number>"140 ```1416. Push that new changelog commit to the same branch that backs the PR:142 ```bash143 git push144 ```145146Rules:147148- Only create the follow-up changelog commit when `CHANGELOG.md` actually changed149- Stage only `CHANGELOG.md`; never use broad staging like `git add .`150- Verify the staged set contains only `CHANGELOG.md` before `git commit`; otherwise warn and skip the changelog commit151- Keep the changelog commit dedicated to the changelog sync so the PR history is easy to understand152- If `CHANGELOG.md` already has unrelated local edits that make the sync unsafe or ambiguous, skip changelog editing and warn the user instead of guessing153- Do not fail PR creation just because changelog commit or push steps are skipped154155### Changelog Entry Format156157- Write exactly one bullet for the PR in this format:158 ```markdown159 - <high-level PR summary> ([#<pr-number>](<pr-url>))160 ```161- Keep it to one line162- Use changelog-style wording, not PR-body wording163- Focus on the high-level thing the PR does, not an implementation checklist164165### Section Selection166167Choose the best matching subsection under `## [Unreleased]` based on the PR's high-level purpose:168169- `### Added` for new user-facing capabilities or first-time integrations170- `### Changed` for meaningful behavior changes or enhancements to existing functionality171- `### Deprecated` when marking functionality as discouraged but still available172- `### Removed` when functionality is no longer available to users173- `### Fixed` for user-visible bug fixes174- `### Security` for security-relevant fixes or improvements175- `### Misc` only when the PR is notable but does not fit the standard Keep a Changelog sections176177### Update Rules178179- Treat changelog state as one PR = one bullet180- Within the `## [Unreleased]` section, if a bullet already references that PR number using either `(#<pr-number>)` or `([#<pr-number>](<pr-url>))`, update that line instead of appending a second one181- Only move bullets within the `## [Unreleased]` section (between its subsections) when the PR's high-level purpose is better represented elsewhere182- Never create duplicate bullets for the same PR number within `## [Unreleased]`183- If multiple matching bullets for the same PR number exist within `## [Unreleased]`, or if matching bullets are found only outside `## [Unreleased]`, treat the changelog as ambiguous and skip editing184- If an existing plain `(#<pr-number>)` suffix is found, rewrite it to the linked `([#<pr-number>](<pr-url>))` form during the update185- If changelog sync succeeds and produces a file change, commit and push that `CHANGELOG.md` change to the same PR branch186187## Error Handling188189- Not on feature branch → "Error: Cannot create PR from master/main branch"190- No commits ahead → "Warning: No commits to create PR for"191- `gh` not installed → "Error: GitHub CLI not found. Install: https://cli.github.com/"192- `gh` not authenticated / `gh auth status` fails → "Error: GitHub CLI not authenticated. Run: gh auth login"193- Self-assignment fails (for example, assignees unsupported or user not assignable) → surface the `gh` error clearly and do not claim the PR was self-assigned194- `CHANGELOG.md` missing, malformed, ambiguous, or missing the needed unreleased subsection → skip changelog sync and continue195- Staged set contains files other than `CHANGELOG.md` after sync → warn and skip the changelog commit to avoid committing unrelated staged changes196- `git commit` for `CHANGELOG.md` fails → warn user but keep the PR: "Warning: PR created but changelog commit failed."197- `git push` for the follow-up changelog commit fails → warn user but keep the PR: "Warning: PR created but changelog commit was not pushed."