pr-split
Skill0 starsChanged 41 days agoMITView on GitHub
Split a large branch or PR into smaller draft PRs, either stacked (each on the previous) or all targeting main. Use on 'pr split', 'split this PR', 'break up this branch', '--stacked', '--main'.
- Commits and pushes
In this repository8 other files it gives its agents.
- grill-meSkill
- multiphase-pr-review-asyncSkill
- multiphase-pr-reviewSkill
- publish-prSkill
- ship-reviewSkill
- take-feedbackSkill
- thermo-nuclear-code-quality-reviewSkill
- ticketedSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 8 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 19
Run git status. If the working tree is dirty, stop and ask the user to commit or stash.
- Very specific: line 26
Read git diff origin/<base>...HEAD and git log origin/<base>..HEAD.
- Distinctive: line 32
Keep tests together with the code they test.
- Distinctive: line 33
Put refactors and renames first, separate from behavior changes.
- Distinctive: line 51
If a file has to be split by hunk across parts, say which hunks go where.
- Very specific: line 68
Commit with a message starting with the ticket key.
- Distinctive: line 75
If the diff isn't empty, show what's missing and fix the parts before pushing.
- Distinctive: line 79
Follow the publish-pr skill for every part (draft, ticket-key title, New/Old Behavior body written about that part's behavior only).
- Very specific: line 88
After all PRs exist, post one comment on each linking the whole set in order, and in --stacked mode note that they should be merged from 1 …
- Distinctive: line 96
Leave the original branch and any original PR untouched.
- Distinctive: line 97
Check out the original branch again.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PR Split
Turn one large branch into several small, reviewable draft PRs. Small PRs get faster, better reviews, but only if each one makes sense on its own and nothing from the original change is lost.
Modes
--stacked: PR 1 targets the base branch, PR 2 targets PR 1's branch, and so on. Use when later parts build on earlier ones.--main: every PR targets the base branch (usuallymain) and can be merged in any order. Use when the parts are independent.
Accept natural phrasing too ("stacked", "both towards main", "all against main"). If no mode is given, ask the user which one before doing anything else. Don't pick one for them.
1. Check the starting point
- Run
git status. If the working tree is dirty, stop and ask the user to commit or stash. Splitting rewrites the checkout repeatedly and uncommitted work can be lost. - Note the original branch:
git branch --show-current. - Find the base: an existing PR's base (
gh pr view --json baseRefName), otherwiseorigin/HEAD(usuallymain). Rungit fetch originfirst. - Find the ticket key the same way as the publish-pr skill (branch name, then commits, then ask).
2. Understand the change
Read git diff origin/<base>...HEAD and git log origin/<base>..HEAD. Group the changes by logical concern, for example: contracts/messages, infrastructure/config, domain logic, consumers/handlers, tests, pure refactors or renames.
Good parts:
- Compile and pass tests on their own (in stacked mode, on top of the previous parts).
- Have one clear purpose a reviewer can describe in a sentence.
- Keep tests together with the code they test.
- Put refactors and renames first, separate from behavior changes.
In --main mode every part must be independent of the others. If a part needs another part's code (a new interface, a message contract, a migration), say so and suggest either moving that shared piece into every part that needs it, or switching to --stacked.
3. Propose the plan and wait
Show the plan and wait for the user to approve or adjust it. Don't create branches before they confirm.
Mode: stacked | main Base: main Ticket: NOVA-1234
1/3 NOVA-1234-part-1 Add retry contract and config (base: main)
src/Contracts/RetryMessage.cs, appsettings.json
2/3 NOVA-1234-part-2 Retry failed deliveries in consumer (base: part-1 | main)
src/Consumers/DeliveryConsumer.cs, tests/...
3/3 ...If a file has to be split by hunk across parts, say which hunks go where.
4. Build the branches
Name branches <original-branch>-part-<n>. For each part, in order:
git checkout -b <part-branch> <start><start> is origin/<base> in --main mode, and the previous part's branch in --stacked mode (origin/<base> for part 1).
Bring the part's changes over from the original branch:
- Whole files:
git checkout <original-branch> -- <paths>(for deleted files usegit rm). - Partial files:
git diff origin/<base>...<original-branch> -- <path> > part.patch, trim it to the wanted hunks, thengit apply part.patch.
Commit with a message starting with the ticket key. Build and run tests for the part if the project supports it (e.g. dotnet build, dotnet test). If a part doesn't build, fix the split (move the missing piece in) rather than shipping a broken PR.
5. Verify nothing is lost
--stacked:git diff <last-part-branch> <original-branch>must be empty.--main: create a throwaway branch fromorigin/<base>, merge every part into it, thengit diff <throwaway> <original-branch>must be empty. Delete the throwaway branch afterwards.
If the diff isn't empty, show what's missing and fix the parts before pushing.
6. Push and open draft PRs
Follow the publish-pr skill for every part (draft, ticket-key title, New/Old Behavior body written about that part's behavior only). Add the part number to the title:
NOVA-1234: (1/3) Add retry contract and config
git push -u origin <part-branch>
gh pr create --draft --base <base-or-previous-part> --head <part-branch> --title "<title>" --body-file <file>After all PRs exist, post one comment on each linking the whole set in order, and in --stacked mode note that they should be merged from 1 upward:
gh pr comment <pr> --body "Split of <original-branch>: 1/3 #101, 2/3 #102, 3/3 #103"7. Finish
- Leave the original branch and any original PR untouched. Don't force-push or close it; mention the user can close it once the split PRs are reviewed.
- Check out the original branch again.
- Reply with one line per PR: number, title, link.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

