| name | create-pr |
| description | Create a GitHub PR with a well-structured body from the diff/commits. Use when creating any pull request. |
Create PR
Overview
Creates a GitHub pull request with a well-structured description derived from the diff and commits.
Announce at start: "I'm using the create-pr skill to create a pull request."
Steps
1. Gather Context (parallel)
git branch --show-current
git status
git diff main...HEAD --stat
git log main..HEAD --oneline
Also check if a PR already exists:
gh pr view --json url 2>/dev/null
If a PR exists, report its URL and stop.
2. Handle Uncommitted Changes
If there are uncommitted changes, warn the user and ask whether to commit first before proceeding.
3. Build the PR Body
Summary of Changes
Write a concise summary from the diff and commits. Focus on what changed and why — not a file listing. 2-5 bullet points.
Visual Changes
- If UI files changed (components, styles, layouts): describe the visual impact
- If no visual changes: write
No visual changes.
Steps to Test
Concrete steps to verify. Reference specific pages, user actions, or API endpoints. Be specific enough that a reviewer can follow them.
4. Push and Create PR
git push -u origin "$(git branch --show-current)"
gh pr create --title "title" --body "$(cat <<'EOF'
...filled body...
EOF
)"
- Title: Under 70 chars. Conventional format when clear (e.g.,
feat: add group aggregation to tables).
- Base branch:
main (unless the user specifies otherwise).
5. Report
Output the PR URL.
Edge Cases
| Situation | Action |
|---|
| No commits ahead of main | Abort — nothing to PR |
| Uncommitted changes | Warn user, ask to commit first |
| PR already exists for branch | Report existing PR URL |
| Push fails (no remote permissions) | Report error, suggest manual push |