| name | update-pr |
| description | Updates an existing pull request with new changes, commits, and optionally revises the PR description. Activate when the user asks to update, fix, or add to an existing PR. Also activate when the user says "update the PR", "fix the PR", "add this to the PR", or any variation of modifying an existing pull request.
|
Update Pull Request Skill
When to Use
Activate when the user says:
- "Update the PR"
- "Fix the PR based on feedback"
- "Add this to the PR"
- "Push these changes to the PR"
- "Update the PR description"
Do NOT use for:
- Creating a new PR (use
pr-creation skill)
- Reviewing a PR (
gh pr view)
- Merging a PR (
gh pr merge)
Workflow
1. Verify PR Exists and Is Open
gh pr view --json number,state,title,url
If no PR exists, ask if they want to create one (/pr-creation). If merged or closed, ask what to do.
2. Make Changes
Implement the requested updates following the user's instructions.
3. Commit Changes
Use the /commit skill to create conventional commits:
/commit
4. Push Updates
git push
5. Update PR Title and Description
After pushing, dynamically update the PR to reflect all changes (not just the latest commit):
- Run
git diff $CLAUDE_CODE_BASE_REF...HEAD and git log $CLAUDE_CODE_BASE_REF..HEAD --oneline to see the full scope
- Check for
CONTRIBUTING.md, .github/PULL_REQUEST_TEMPLATE.md, or similar PR description guidance in the repo — if found, adapt the description to follow the repository's conventions
- Read
.claude/skills/pr-creation/pr-templates.md for the PR template format and merge with any repo-specific guidance
- Rewrite the title and body to accurately describe the current state of the PR:
gh pr edit <pr-number> --title "<type>: <updated description>" --body "$(cat <<'EOF'
<updated body using template from pr-templates.md>
EOF
)"
- The title and summary should reflect the totality of the PR, not just the new changes
6. Verify CI (with 15-minute timeout)
timeout 15m gh pr checks --watch || true
The stop hook (verify_ci.py) will automatically block completion if CI fails. If checks fail, fix issues and repeat steps 3-6.
7. Report Result
Confirm the PR is updated and provide the URL.
Example
User: "Fix the type error in the PR"
Actions: Verify PR exists → Fix type error → /commit → Push → Update PR title/description → Verify CI → Report URL
Error Handling
- No PR for branch: Ask if they want to create one (
/pr-creation)
- PR merged/closed: Ask user what to do (don't modify merged PRs)
- CI fails: Fix issues, push again, and update the PR description (stop hook enforces this)