split-pr
Installation
SKILL.md
Split PR
Turn one oversized PR (or local branch) into a few small, reviewer-aligned PRs — and leave the original PR gracefully retired.
This skill uses GitHub's native stacked pull requests via the gh-stack CLI extension (gh extension install github/gh-stack) instead of hand-rolled branch chains. GitHub now owns the stack: it retargets and cascades base branches automatically on merge, so the old failure mode this skill used to guard against — a squash-merged parent leaving its child PR full of stale commits, requiring a manual rebase --onto — no longer happens. Verify the extension is installed (gh extension list | grep gh-stack) before starting; if missing, install it first.
Hard rules
- Exactly one pause: the split-plan approval in Step 2 (which includes the independent-vs-stacked choice). After approval, run to completion autonomously.
- Never discard work. No destructive git (
reset --hard,clean, branch deletion, manual force-push, history rewrite). Record a backup ref before creating any branch. - Clean working tree required — this skill splits committed work only. If
git status --porcelainis non-empty, stop and ask the user to commit or stash first. - Stage only named files or hunks. Never
git add ./git add -A. When usinggh stack add -A, that rule doesn't apply — see Step 4. - Never skip or bypass commit hooks (no
--no-verify, noSKIP). - Force-push is scoped to gh-stack.
gh stack push/sync/rebaseforce-push with--force-with-leaseas a normal part of cascading rebases — that's expected and safe on branches this skill created. Never run a manualgit push --forceyourself, and if any slice branch has commits you didn't make (a reviewer pushed a fixup directly to it), stop and confirm with the user before runningsyncorrebaseon that stack. - Commit messages and PR bodies: plain, direct, neutral voice. State what changed, not what you're about to do.
- Use
ghCLI for all GitHub operations (PR reads/writes, stack management). If a GitHub MCP server is connected in-session, prefer it for read-only lookups, butghremains the tool of record for mutations sincegh-stackitself is aghextension.