PR Workflow Skill
Manage the complete PR lifecycle: review responses, updates, and merge.
Usage
code
/pr-workflow # Current PR: show status /pr-workflow status # Show PR status and pending reviews /pr-workflow resolve # Resolve all addressed review comments /pr-workflow update # Update PR description to match changes /pr-workflow merge # Merge after all checks pass /pr-workflow complete # Full flow: resolve → update → merge /pr-workflow complete 3 # Specify PR number
Actions
status - Show PR Status
Check the current PR state, review comments, and CI status.
bash
# Get PR number
PR_NUM=$(gh pr list --state open --json number --jq '.[0].number')
# Show status
gh pr view $PR_NUM --json title,state,reviewDecision,statusCheckRollup
# Show unresolved threads
gh api graphql -f query='
query($pr: Int!) {
repository(owner: "{owner}", name: "{repo}") {
pullRequest(number: $pr) {
reviewThreads(first: 20) {
nodes { isResolved comments(first:1) { nodes { body } } }
}
}
}
}' -F pr=$PR_NUM
resolve - Resolve Review Comments
Resolve all review threads that have been addressed in the code.
Steps:
- •Fetch all unresolved review threads via GraphQL
- •For each thread, resolve using
resolveReviewThreadmutation - •Report resolution status
bash
# Get thread IDs
THREADS=$(gh api graphql -f query='
query {
repository(owner: "{owner}", name: "{repo}") {
pullRequest(number: {pr_num}) {
reviewThreads(first: 50) {
nodes { id isResolved }
}
}
}
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false) | .id')
# Resolve each thread
for thread_id in $THREADS; do
gh api graphql -f query='
mutation {
resolveReviewThread(input: {threadId: "'$thread_id'"}) {
thread { isResolved }
}
}
'
done
update - Update PR Description
Update the PR title and body to accurately reflect current changes.
Steps:
- •Analyze commits in the PR:
git log main..HEAD - •Review changed files:
git diff main --stat - •Generate updated summary based on actual changes
- •Update via
gh pr edit
bash
# Get current changes
COMMITS=$(git log main..HEAD --oneline)
FILES=$(git diff main --stat)
# Update PR
gh pr edit $PR_NUM --body "$(cat <<'EOF'
## Summary
{generated summary based on commits and changes}
## Changes
{list of key changes}
## Test Plan
{verification steps}
Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"
merge - Merge PR
Merge the PR after verifying all checks pass.
Pre-merge Checklist:
- •All CI checks passing
- •No unresolved review threads
- •Branch is up-to-date with base
bash
# Verify checks gh pr checks $PR_NUM # Merge (squash by default) gh pr merge $PR_NUM --squash --delete-branch
complete - Full Workflow
Execute the complete PR finalization workflow:
- •Resolve all addressed review comments
- •Update PR description if needed
- •Verify all checks pass
- •Merge the PR
- •Cleanup local branches
bash
# Complete flow /pr-workflow resolve /pr-workflow update gh pr checks $PR_NUM --watch gh pr merge $PR_NUM --squash --delete-branch # Sync local jj git fetch jj rebase -d main@origin
Dynamic Context
When executing, gather context first:
bash
# Repository info
REPO=$(gh repo view --json owner,name --jq '"\(.owner.login)/\(.name)"')
OWNER=$(echo $REPO | cut -d'/' -f1)
NAME=$(echo $REPO | cut -d'/' -f2)
# Current PR
PR_NUM=${1:-$(gh pr list --state open --json number --jq '.[0].number')}
Notes
- •Always verify before merge: Check that review comments are truly addressed
- •Use squash merge: Keep main branch history clean
- •Delete branch after merge: Clean up feature branches
- •Sync after merge:
jj git fetch && jj rebase -d main@origin
Language Protocol
- •Commands and code: English
- •User communication: Japanese
- •Report results in Japanese with URLs for easy access