GitHub PR Manager
Instructions
When to Invoke This Skill
- Creating a pull request after implementing changes
- Checking status of an existing PR (mergeable, checks, reviews)
- Merging an approved PR
- Validating PR state before operations
Capabilities
Create Pull Request
- Generate PR from current branch
- Create descriptive title and body
- Link to related issues
- Add appropriate labels
View PR Status
- Check if PR is open/closed/merged
- Verify mergeable state
- Review CI check status
- Check review approvals
Merge Pull Request
- Squash merge with single commit
- Validate before merging
- Branch cleanup handled externally
Standard Workflows
Creating a PR
Verify Current Branch
git branch --show-current
Ensure you're on a feature branch, not main/master
Push Branch (if not already pushed)
git push -u origin HEAD
Create PR
gh pr create --title "<type>: <description>" --body "$(cat <<'EOF'
## Summary
Resolves #<issue_number>
<Brief description of changes>
## Changes Made
- <List key changes>
## Testing
- <How to test these changes>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"
Checking PR Status
Fetch PR Information
gh pr view <pr_number> --json state,mergeable,statusCheckRollup,reviewDecision
Interpret Results
state: "OPEN", "CLOSED", "MERGED"
mergeable: "MERGEABLE", "CONFLICTING", "UNKNOWN"
reviewDecision: "APPROVED", "CHANGES_REQUESTED", "REVIEW_REQUIRED"
Merging a PR
Validate PR State
gh pr view <pr_number> --json headRefName,state,mergeable
- Verify state is "OPEN"
- Verify mergeable is "MERGEABLE"
- Extract branch name for cleanup
Perform Squash Merge
gh pr merge <pr_number> --squash
This will:
- Squash all commits into one
- Merge to main/master
Important: Do NOT use --delete-branch flag and do NOT switch back to main. Branch cleanup and worktree disposal are handled by the orchestrator after the PR is merged.
Error Handling
Authentication Issues:
- Run:
gh auth status
- If not authenticated:
gh auth login
PR Not Mergeable:
- Check for conflicts: Inform user to resolve merge conflicts
- Check for failing CI: Wait for checks to pass
- Check for required reviews: Request reviews from team
Worktree Environment:
- Workers operate in isolated git worktrees
- Do NOT attempt to delete branches or switch to main after merging
- Worktree cleanup is handled by the orchestrator after PR merge
- Focus only on the merge operation itself
PR Title and Body Standards
Title Format:
<type>: <brief description>
Types: feat, fix, chore, docs, refactor, test, perf
Body Format:
## Summary
Resolves #<issue>
<1-2 sentence description>
## Changes Made
- <Bullet list of key changes>
## Testing
- <How changes were tested>
- <Manual test steps if needed>
## Screenshots (if UI changes)
<Optional screenshots>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Examples
Example 1: Create PR from feature branch
User: "Create a PR for this feature"
Action:
1. Verify on feature branch
2. Push if needed
3. Create PR with structured body linking to issue
Output: PR URL and number
Example 2: Check PR status before merging
User: "Is PR #123 ready to merge?"
Action:
1. Fetch PR status
2. Check mergeable state, CI status, reviews
Output: "PR #123 is ready to merge" or list blockers
Example 3: Merge approved PR
User: "Merge PR #123"
Action:
1. Validate PR state (gh pr view 123 --json headRefName,state,mergeable)
2. Squash merge (gh pr merge 123 --squash)
Output: "PR #123 merged successfully. Worktree cleanup will be handled by orchestrator."
1---2name: github-pr-manager3description: Create, view, and merge GitHub pull requests with validation. Use when creating PRs from branches, checking PR status, or merging approved PRs with cleanup.4---5
6# GitHub PR Manager
7
8## Instructions
9
10### When to Invoke This Skill
11- Creating a pull request after implementing changes
12- Checking status of an existing PR (mergeable, checks, reviews)
13- Merging an approved PR
14- Validating PR state before operations
15
16### Capabilities
17
181. **Create Pull Request**
19 - Generate PR from current branch
20 - Create descriptive title and body
21 - Link to related issues
22 - Add appropriate labels
23
242. **View PR Status**
25 - Check if PR is open/closed/merged
26 - Verify mergeable state
27 - Review CI check status
28 - Check review approvals
29
303. **Merge Pull Request**
31 - Squash merge with single commit
32 - Validate before merging
33 - Branch cleanup handled externally
34
35### Standard Workflows
36
37#### Creating a PR
38
391. **Verify Current Branch**
40 ```bash
41 git branch --show-current
42 ```
43 Ensure you're on a feature branch, not main/master
44
452. **Push Branch** (if not already pushed)
46 ```bash
47 git push -u origin HEAD
48 ```
49
503. **Create PR**
51 ```bash
52 gh pr create --title "<type>: <description>" --body "$(cat <<'EOF'
53 ## Summary
54 Resolves #<issue_number>
55
56 <Brief description of changes>
57
58 ## Changes Made
59 - <List key changes>
60
61 ## Testing
62 - <How to test these changes>
63
64 🤖 Generated with [Claude Code](https://claude.com/claude-code)
65 EOF
66 )"
67 ```
68
69#### Checking PR Status
70
711. **Fetch PR Information**
72 ```bash
73 gh pr view <pr_number> --json state,mergeable,statusCheckRollup,reviewDecision
74 ```
75
762. **Interpret Results**
77 - `state`: "OPEN", "CLOSED", "MERGED"
78 - `mergeable`: "MERGEABLE", "CONFLICTING", "UNKNOWN"
79 - `reviewDecision`: "APPROVED", "CHANGES_REQUESTED", "REVIEW_REQUIRED"
80
81#### Merging a PR
82
831. **Validate PR State**
84 ```bash
85 gh pr view <pr_number> --json headRefName,state,mergeable
86 ```
87 - Verify state is "OPEN"
88 - Verify mergeable is "MERGEABLE"
89 - Extract branch name for cleanup
90
912. **Perform Squash Merge**
92 ```bash
93 gh pr merge <pr_number> --squash
94 ```
95 This will:
96 - Squash all commits into one
97 - Merge to main/master
98
99 **Important**: Do NOT use `--delete-branch` flag and do NOT switch back to main. Branch cleanup and worktree disposal are handled by the orchestrator after the PR is merged.
100
101### Error Handling
102
103**Authentication Issues:**
104- Run: `gh auth status`
105- If not authenticated: `gh auth login`
106
107**PR Not Mergeable:**
108- Check for conflicts: Inform user to resolve merge conflicts
109- Check for failing CI: Wait for checks to pass
110- Check for required reviews: Request reviews from team
111
112**Worktree Environment:**
113- Workers operate in isolated git worktrees
114- Do NOT attempt to delete branches or switch to main after merging
115- Worktree cleanup is handled by the orchestrator after PR merge
116- Focus only on the merge operation itself
117
118### PR Title and Body Standards
119
120**Title Format:**
121```
122<type>: <brief description>
123```
124
125Types: `feat`, `fix`, `chore`, `docs`, `refactor`, `test`, `perf`
126
127**Body Format:**
128```markdown
129## Summary
130Resolves #<issue>
131
132<1-2 sentence description>
133
134## Changes Made
135- <Bullet list of key changes>
136
137## Testing
138- <How changes were tested>
139- <Manual test steps if needed>
140
141## Screenshots (if UI changes)
142<Optional screenshots>
143
144🤖 Generated with [Claude Code](https://claude.com/claude-code)
145```
146
147## Examples
148
149### Example 1: Create PR from feature branch
150```
151User: "Create a PR for this feature"
152Action:
1531. Verify on feature branch
1542. Push if needed
1553. Create PR with structured body linking to issue
156Output: PR URL and number
157```
158
159### Example 2: Check PR status before merging
160```
161User: "Is PR #123 ready to merge?"
162Action:
1631. Fetch PR status
1642. Check mergeable state, CI status, reviews
165Output: "PR #123 is ready to merge" or list blockers
166```
167
168### Example 3: Merge approved PR
169```
170User: "Merge PR #123"
171Action:
1721. Validate PR state (gh pr view 123 --json headRefName,state,mergeable)
1732. Squash merge (gh pr merge 123 --squash)
174Output: "PR #123 merged successfully. Worktree cleanup will be handled by orchestrator."
175```