Our review
Updates an existing pull request with new commits and syncs the branch with its base.
Strengths
- Automates rebasing and PR description updates.
- Handles conflicts by explicitly asking the user which version to keep.
- Includes safety checks: GitHub auth, clean git state, PR status.
Limitations
- Requires GitHub CLI authentication beforehand.
- Assumes a rebase workflow which rewrites history.
- Does not automatically resolve complex merge conflicts.
Use this skill when you have pushed additional commits to a feature branch and need to update the PR description while syncing with the base branch.
Do not use this skill if no PR exists yet (use /create-pr instead) or if the PR is already merged/closed.
Security analysis
SafeThe skill instructs running standard git and GitHub CLI commands for updating a PR, including rebasing and force-pushing. No destructive, obfuscated, or exfiltrating actions are present, and all operations are transparent and reversible.
No concerns found
Examples
I just pushed a few more commits to this branch. Can you update the PR description to reflect the new changes and sync it with the main branch?Please update the PR description for this branch to match the latest diff.Update my PR, rebase on latest main, and refresh the description.name: update-pr description: "Update an existing pull request with new changes. Use when the user wants to update a PR, push follow-up changes to a PR, refresh a PR description, or sync a PR with latest commits. Triggers on: update pr, update-pr, update the pr, push to pr, refresh pr, sync pr, update pull request."
PR Updater
Push follow-up changes to an existing PR and update its description to reflect the new work.
Workflow
Step 1: Pre-flight Checks
- Verify GitHub CLI authentication — run
gh api user --jq '.login'to confirm the CLI is authenticated. If this fails, the user needs to rungh auth loginfirst. - Find the existing PR — run
gh pr view --json number,title,body,url,baseRefName,stateto find the PR for the current branch. If no PR exists, abort and suggest using/create-prinstead. Check thestatefield — if it is notOPEN, abort and inform the user that the PR is already merged or closed. - Verify clean git state — run
git statusto ensure no uncommitted changes. If there are uncommitted changes, run the/commitskill first to commit them. - Sync submodules — check if
.gitmodulesexists first. If it does, rungit submodule update --init --recursive. If not, skip this step.
Step 2: Sync with Base Branch
Ensure the feature branch is up-to-date with the base branch to avoid merge conflicts:
- Fetch latest remote — run
git fetch origin <base-branch>(use the base branch from the PR metadata) - Check for divergence — run
git log HEAD..origin/<base-branch> --onelineto see if the base branch has new commits - Rebase if needed — if there are new commits on the base branch:
a. Run
git rebase origin/<base-branch>b. Resolve conflicts — if the rebase hits conflicts:- Read the conflicting files to understand both sides
- Surface the conflict to the user — show both sides and ask which version to keep. Do not silently resolve conflicts.
- Stage resolved files:
git add <file> - Continue:
git rebase --continue - Repeat until rebase completes
- Verify clean state — run
git statusto confirm no unresolved conflicts remain - Push the branch — run
git push. If the rebase changed history, usegit push --force-with-leaseinstead. If--force-with-leasefails, it means someone else has pushed to this branch. Fetch the remote branch (git fetch origin <branch>), inspect the divergence (git log HEAD..origin/<branch> --oneline), and ask the user how to proceed — they may need to integrate the other contributor's changes first.
Step 3: Analyze New Changes
Understand the full scope of changes now in the PR:
- Run
git log origin/<base-branch>..HEAD --onelineto see all commits on this branch - Run
git diff origin/<base-branch>...HEAD --statfor a high-level summary of changed files - Run
git diff origin/<base-branch>...HEADto read the full diff. Note: Three-dot (...) syntax is intentional — it shows only the changes introduced on this branch since it diverged from the base, excluding commits on the base branch that aren't part of this PR. - Identify the type of change:
feat,fix,refactor,docs,chore, etc. - Review existing PR title and body — compare the current PR title and body (from Step 1) against the full diff. Note what's already accurately described vs. what's missing, outdated, or no longer relevant.
Important: Look at ALL commits, not just the latest one. The updated PR description should reflect the entire branch, not just the new additions.
Step 4: Update the PR Description
Title
- Under 70 characters
- Use conventional prefix:
feat:,fix:,refactor:,docs:,chore: - Review the existing PR title (from Step 1). If it still accurately reflects the full scope of changes, keep it. If the scope has changed or the title is misleading, update it.
Body
Review the existing PR body (from Step 1) and update it to reflect the current state of the branch. Preserve any still-accurate content (e.g., context, links, decisions) rather than rewriting from scratch. Use this template — scale detail with PR complexity:
## Summary
<1-5 bullet points explaining what changed and WHY — covering ALL changes in the branch>
## Changes
<Categorized list of what was modified — group by area/concern>
## Diagrams
<OPTIONAL — include Mermaid diagrams when visual aids clarify workflow or architecture changes>
## Test Plan
<How the changes were verified — manual testing steps, automated tests run, curl commands, etc.>
Guidelines for the body:
- State the purpose clearly — explain why, not just what
- Cover ALL changes in the branch, not just the latest commits
- Provide context and background with links to relevant issues/docs
- Include Mermaid diagrams when they simplify explanation of workflows or architecture
- Keep PRs focused on a single concern — suggest splitting if the PR is too large
- Before overwriting the PR body, compare the existing body against the standard template sections (Summary, Changes, Diagrams, Test Plan). Flag any sections or content that appear to have been manually added after PR creation (e.g., reviewer notes, deployment checklists, linked discussions) and ask the user whether to preserve them.
- Do NOT include any "Generated with Claude Code" footer or bot attribution lines
- Do NOT include
Co-Authored-Bylines
Step 5: Apply Updates
Write the body to a temp file and use --body-file to avoid shell argument length limits:
cat > /tmp/pr_body.md <<'EOF'
## Summary
...
## Changes
...
## Test Plan
...
EOF
gh pr edit --title "the pr title" --body-file /tmp/pr_body.md
Do NOT add:
--authorflag- Any
Co-Authored-Bytrailer - Any "Generated with Claude Code" footer
Draft/Ready handling: If the user wants to mark a draft PR as ready for review, run gh pr ready. If the user wants to convert to draft, run gh pr ready --undo.
Step 6: Report
- Return the PR URL so the user can review it
- Summarize what changed in the PR description compared to before
- If
gh pr editfails, diagnose the error and suggest fixes
Best Practices Encoded
PR Size: Keep PRs small and focused. If the diff is very large (>500 lines changed), suggest splitting into smaller PRs.
Commit History: If the commit history is messy, suggest rebasing to clean it up. Clean commits that explain why make review much easier.
Feedback Requests: If the user mentions wanting specific feedback, add a "Feedback Requested" section to the body.
Screenshots: For frontend changes, remind the user to add screenshots or recordings to the PR after updating.
Next.js App Router Expert
Development
A skill that turns Claude into a Next.js App Router expert.
README Generator
Development
Creates professional and comprehensive README.md files for your projects.
API Documentation Writer
Development
Generates comprehensive API documentation in OpenAPI/Swagger format.