agents/skills/combine-prs/SKILL.md
Compare two competing PRs implementing the same feature, identify strengths of each, and combine the best parts into a single branch. Use when comparing PRs, combining implementations, cherry-picking between PRs, or resolving competing approaches.
npx skillsauth add drn/dots combine-prsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
$ARGUMENTS - Two PR numbers or branch names to compare (e.g., "230 231" or "#230 #231")If no arguments are provided, ask the user for two PR numbers.
git branch --show-currentgit status --shortgh repo view --json nameWithOwner --jq .nameWithOwner 2>/dev/null | head -1git branch -r 2>/dev/null | grep -oE 'origin/(main|master)' | head -1git remote -v 2>/dev/null | head -6Compare two PRs that implement the same feature, analyze strengths and weaknesses, present a comparison, and on approval combine the best parts into one branch.
Extract two PR numbers from the arguments (strip any leading "#" characters). If branch names are given instead, find their associated PRs via gh pr list.
For each PR, fetch metadata:
gh pr view <number> --json number,title,body,headRefName,baseRefName,author,state,additions,deletions,changedFiles
Verify both PRs target the same base branch and address the same feature. If they do not appear related, warn the user and ask whether to proceed.
For each PR, get the full diff:
gh pr diff <number>
Also read the actual changed files from each branch to understand full context (not just diff hunks). Check out each branch temporarily or use git show <branch>:<file> to read files without switching.
Analyze each PR across these dimensions:
Present a structured comparison to the user:
## PR Comparison: #<A> vs #<B>
| Dimension | #<A> | #<B> | Verdict |
|-----------|------|------|---------|
| Files changed | ... | ... | ... |
| Lines +/- | ... | ... | ... |
| Package placement | ... | ... | ... |
| Code liveness | ... | ... | ... |
| Test coverage | ... | ... | ... |
| Error handling | ... | ... | ... |
| API design | ... | ... | ... |
| Future implications | ... | ... | ... |
## Recommended Combination Strategy
Take from #<A>:
- ...
Take from #<B>:
- ...
Resulting branch: #<winner> (will be updated, #<loser> will be superseded)
Wait for the user to approve, modify, or reject the strategy before proceeding.
After user approval:
Determine the surviving PR. Use whichever branch has the better foundation (or whichever the user specified). Check it out.
Reset to base. Soft-reset to the merge base so all changes become staged:
git checkout <surviving-branch>
git reset --soft <base-branch>
git reset HEAD .
Apply the combined changes. Read the relevant files from both branches using git show <branch>:<file> and write the combined version that incorporates the best parts of each. This requires judgment — it is not a mechanical merge. For files where both PRs made changes:
Stage and commit with a descriptive squashed commit message:
git add <files...>
git commit -m "$(cat <<'EOF'
<concise summary of the combined feature>
Combined from #<A> and #<B>:
- From #<A>: <what was taken>
- From #<B>: <what was taken>
EOF
)"
git push --force-with-lease origin <surviving-branch>
Update the surviving PR body to note the combination:
gh pr edit <surviving-number> --body "$(cat <<'EOF'
<original or updated description>
---
Supersedes #<other-number>. Combined the best of both implementations:
- From #<other>: <what was taken>
- From this PR: <what was kept>
EOF
)"
Ask the user whether to close the superseded PR. If approved:
gh pr close <other-number> --comment "Superseded by #<surviving-number>, which combines the best parts of both implementations."
If the user declines, leave it open but add a comment noting the relationship:
gh pr comment <other-number> --body "See #<surviving-number> for a combined implementation that incorporates the best of both PRs."
Summarize what was done:
## Combined PR Result
- **Surviving PR:** #<number> (<url>)
- **Superseded PR:** #<number> (<status>)
- **Commit:** <short-sha> - <message>
- **From #<A>:** <what was taken>
- **From #<B>:** <what was taken>
| Failure | Action |
|---------|--------|
| PR not found | Report and ask for correct number |
| PRs target different base branches | Warn user, ask to proceed |
| PRs are unrelated (no file overlap) | Warn user, ask to proceed |
| Merge conflicts during combination | Resolve manually, show user what was resolved |
| Force-push rejected | Report error, suggest git pull --rebase first |
| User rejects combination strategy | Ask what they want changed, revise the plan |
development
Walk every unresolved review thread on a PR, triage each one, reply with a rationale of whether or not the comment will be acted upon, make the code change if warranted, and mark the thread resolved. Use when the user asks to address only the open PR comments without re-running CI, respond to review feedback, resolve review threads, or clear bot comments on a PR.
tools
Iteratively run /rereview, fix the findings, and loop until reviewers approve clean. Use for iterative automated review, when you want /rereview to loop until clean, or for a paranoid pre-merge review that auto-addresses every blocker.
development
Generate self-contained HTML visualizations with Plannotator theming. Use for implementation plans, PR explainers, architecture diagrams, data tables, slide decks, and any visual explanation of technical concepts. Plans and PR explainers follow Plannotator's prescriptive approach; all other visual content delegates to nicobailon/visual-explainer.
development
Create reviewed Codex goal setup packages for long-running /goal work. Use when the user wants to turn an idea, backlog, project mission, or vague objective into durable goal files under a project goals slug folder, with Plannotator review gates for brief, narrative plan with acceptance criteria, verification, blockers, and the final /goal prompt.