create-pull-request
>
Works with
---
name: create-pull-request
description: >
license: MIT
---
# Create Pull Request
Create a GitHub pull request with a clear title, structured description, and proper branch setup.
## When to Use
- Proposing changes from a feature or fix branch for review
- Merging completed work into the main branch
- Requesting code review from collaborators
- Documenting the purpose and scope of a set of changes
## Inputs
- **Required**: Feature branch with committed changes
- **Required**: Base branch to merge into (usually `main`)
- **Optional**: Reviewers to request
- **Optional**: Labels or milestone
- **Optional**: Draft status
## Procedure
### Step 1: Ensure Branch Is Ready
Verify the branch is up to date with the base branch and all changes are committed:
```bash
# Check for uncommitted changes
git status
# Fetch latest from remote
git fetch origin
# Rebase on latest main (or merge)
git rebase origin/main
```
**Expected:** Branch is ahead of `origin/main` with no uncommitted changes and no conflicts.
**On failure:** If rebase conflicts occur, resolve them (see `resolve-git-conflicts` skill), then `git rebase --continue`. If the branch has diverged significantly, consider `git merge origin/main` instead.
### Step 2: Review All Changes on the Branch
Examine the full diff and commit history that will be included in the PR:
```bash
# See all commits on this branch (not on main)
git log origin/main..HEAD --oneline
# See the full diff against main
git diff origin/main...HEAD
# Check if branch tracks remote and is pushed
git status -sb
```
**Expected:** All commits are relevant to the PR. The diff shows only intended changes.
**On failure:** If unrelated commits are present, consider interactive rebase to clean up history before creating the PR.
### Step 3: Push the Branch
```bash
# Push branch to remote (set upstream tracking)
git push -u origin HEAD
```
**Expected:** Branch appears on GitHub remote.
**On failure:** If push is rejected, pull first with `git pull --rebase origin <branch>` and resolve any conflicts.
### Step 4: Write PR Title and Description
Keep the title under 70 characters. Use the body for details:
```bash
gh pr create --title "Add weighted mean calculation" --body "$(cat <<'EOF'
## Summary
- Implement `weighted_mean()` with NA handling and zero-weight filtering
- Add input validation for mismatched vector lengths
- Include unit tests covering edge cases
## Test plan
- [ ] `devtools::test()` passes with no failures
- [ ] Manual verification with example data
- [ ] Edge cases: empty vectors, all-NA weights, zero-length input
🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"
```
For draft PRs:
```bash
gh pr create --title "WIP: Add authentication" --body "..." --draft
```
**Expected:** PR created on GitHub with a URL returned. Description clearly communicates what changed and how to test.
**On failure:** If `gh` is not authenticated, run `gh auth login`. If the base branch is wrong, specify with `--base main`.
### Step 5: Handle Review Feedback
Respond to review comments and push updates:
```bash
# View PR comments
gh api repos/{owner}/{repo}/pulls/{number}/comments
# View PR review status
gh pr checks
# After making changes, commit and push
git add <files>
git commit -m "$(cat <<'EOF'
fix: address review feedback on input validation
EOF
)"
git push
```
**Expected:** New commits appear on the PR. Review comments are addressed.
**On failure:** If CI checks fail after pushing, read the check output with `gh pr checks` and fix the issues before requesting re-review.
### Step 6: Merge and Clean Up
After approval:
```bash
# Merge the PR (squash merge keeps history clean)
gh pr merge --squash --delete-branch
# Or merge with all commits preserved
gh pr merge --merge --delete-branch
# Or rebase merge (linear history)
gh pr merge --rebase --delete-branch
```
After merge, update local main:
```bash
git checkout main
git pull origin main
```
**Expected:** PR is merged, remote branch is deleted, local main is updated.
**On failure:** If merge is blocked by failing checks or missing approvals, address those first. Do not force-merge without resolving blockers.
## Validation
- [ ] PR title is concise (under 70 characters) and descriptive
- [ ] PR body includes summary of changes and test plan
- [ ] All commits on the branch are relevant to the PR
- [ ] CI checks pass
- [ ] Branch is up to date with base branch
- [ ] Reviewers are assigned (if required by repository settings)
- [ ] No sensitive data in the diff
## Common Pitfalls
- **PR too large**: Keep PRs focused on a single feature or fix. Large PRs are harder to review and more likely to have merge conflicts.
- **Missing test plan**: Always describe how the changes can be verified, even for documentation PRs.
- **Stale branch**: If the base branch has moved ahead significantly, rebase before creating the PR to minimize merge conflicts.
- **Force-pushing during review**: Avoid force-pushing to a branch with open review comments. Push new commits so reviewers can see incremental changes.
- **Not reading CI output**: Check `gh pr checks` before asking for re-review. Failing CI wastes reviewers' time.
- **Forgetting to delete branch**: Use `--delete-branch` with merge to keep the remote clean.
## Related Skills
- `commit-changes` - creating commits for the PR
- `manage-git-branches` - branch creation and naming conventions
- `resolve-git-conflicts` - handling conflicts during rebase/merge
- `create-github-release` - releasing after mergeMore Code Review skills
pr-to-video
heygen-com/hyperframes
Turn a GitHub pull request (a PR URL, owner/repo#N, or 'this PR' in a checked-out repo) into a code-change explainer video — changelog, feature reveal, fix, or refactor walkthrough built from the diff, commits, and files: the input is a code change, not a website. Not a product promo (/product-launch-video) or a no-PR topic explainer (/faceless-explainer). Unclear → /hyperframes.
receiving-code-review
obra/superpowers
Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation
public-relations
coreyhaines31/marketingskills
When the user wants help with public relations, earned media, press coverage, journalist outreach, or media strategy (not pull requests). Also use when the user mentions 'PR,' 'public relations,' 'press,' 'press release,' 'press coverage,' 'media outreach,' 'pitch a journalist,' 'get featured,' 'media list,' 'media kit,' 'press kit,' 'newsjacking,' 'news hijack,' 'HARO,' 'Qwoted,' 'Featured,' 'Help A Reporter,' 'reporter request,' 'tech press,' 'TechCrunch,' 'earned media,' 'thought leadership placement,' 'op-ed,' 'guest article,' 'press contacts,' 'podcast prep,' 'going on a podcast,' 'podcast guest,' 'prep me for this podcast,' or 'how do I get press.' Use this for earned media work — finding journalists, pitching stories, newsjacking, prepping podcast appearances, and responding to press requests. For startup/SaaS/AI directory submissions, see directory-submissions. For product launches, see launch. For social-media engagement, see social. For cold-email outreach to prospects, see cold-email.

