pr-splitter
Skill0 starsChanged 3 months agoUnlicenseView on GitHub
Breaks one large branch into a chain of small, reviewable stacked PRs, each of which builds and passes its tests on its own, and proves the last PR has exactly the same tree as the original branch. Writes local split branches, PR bodies with the task, the prompt and the real test output, and the gh commands to open the stack. Never pushes and never rebases. Use when the user runs /pr-splitter or asks to split, break up, slice or stack a big branch, PR or diff into smaller PRs.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- crbnos/carbontheir own version, first seen Nov 7, 2026
- kabudu/engineering-agent-skillstheir own version, first seen Oct 31, 2026
- mastra-ai/mastratheir own version, first seen Oct 8, 2026
- dzevs/zynktheir own version, first seen Jun 24, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- mastra-ai/mastra★ 29ksame name
- crbnos/carbon★ 2.8ksame name
- dzevs/zynk★ 4same name
- kabudu/engineering-agent-skills★ 3same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository16 other files it gives its agents.
- claude-agents-md/AGENTS.mdAGENTS.md
- claude-agents-md/CLAUDE.mdCLAUDE.md
- bash-skillSkill
- bug-recordingSkill
- bundle-sizeSkill
- changelog-skillSkill
- container-skillSkill
- fact-checkerSkill
- git-gh-skillSkill
- html-researchSkill
- index-html-skillSkill
- macos-electron-appsSkill
- readme-skillSkill
- rerenderSkill
- scripts-skillSkill
- stacks-skillSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. 0 are common, 6 are distinctive, and 7 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 70
If base is not an ancestor of source, tell the user to merge base into source first.
- Distinctive: line 73
Run them on the source branch first.
- Very specific: line 75
Run scripts/plan.sh <base> <source>.
- Very specific: line 77
Write prompt.md in the work dir with the user's whole prompt, verbatim.
- Very specific: line 86
When one file must be split across slices, write the partial version as a patch: git diff <base> <source> -- <file> > patches/<name>.patch, …
- Distinctive: line 89
Never invent code. If a slice can only build with a stub or flag that is not in the source, stop and ask the user.
- Very specific: line 91
Run scripts/split.sh <work dir>/plan.md.
- Very specific: line 96
Never push. Tell the user to push the split/<source>/* branches and then run create-prs.sh.
- Very specific: line 99
After review comments: commit the fix on the slice it belongs to, then run scripts/restack.sh <work dir>/plan.md.
- Distinctive: line 104
Never push, never rebase, never force anything, never touch the source branch.
- Very specific: line 105
Only ever delete branches under split/<source>/.
- Distinctive: line 108
Every slice builds and passes the tests alone.
- Distinctive: line 112
No comments in any file you write.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PR Splitter
Turn one big branch into a stack of small PRs a reviewer can read in one sitting. Every PR builds, every PR passes the tests alone, and the last PR equals the original branch byte for byte, so the split never loses or changes code.
Inputs
$ARGUMENTS, all optional:
- the source branch, default the current branch
- the base branch, default the repository default branch (
mainormaster) - the target size per PR in changed lines, default 400
Engine
Scripts live in scripts/ beside this skill. They run from any directory of the repository.
| Script | What it does |
plan.sh <base> <source> | Creates the work dir .git/pr-split/<source>/ with inventory.txt (lines added, removed, file) and a starter plan.md |
split.sh <plan.md> | Refuses a plan that drops or invents a file, builds one stacked branch per slice, runs build and tests on each, writes PR bodies and create-prs.sh, and checks the last branch equals the source |
restack.sh <plan.md> | After a review fix on one slice, merges each slice into the next in order and runs build and tests again |
cleanup.sh <source> | Deletes the split/<source>/* branches and the out/ folder, keeps the plan |
test-all.sh | Runs the engine's own test suite |
The work dir lives inside .git, so the plan, patches and output are never committed and survive
branch switches.
Plan format
base: main
source: feature/big
build: mvn -q compile
test: mvn -q test
prompt: prompt.md
## user table and model
> Adds the users table and the User model the service needs.
src/main/resources/db/V2__users.sql
src/main/java/app/User.java
src/test/java/app/UserTest.java
patch patches/service-part1.patch
## user service
> Adds the user service and its endpoint on top of the model.
src/main/java/app/UserService.java
src/main/java/app/Service.javabuild:is optional,test:andprompt:are required.## titlestarts a slice. The title becomes the branchsplit/<source>/NN-<slug>and the commit<project>: <title>.> lineis the slice description, 3 to 5 lines, used as the PR task.- A bare path takes the final version of that file from the source branch, or deletes it when the source deleted it. Every changed file is listed as a bare path in exactly one slice.
patch <file>applies a patch, relative to the plan, before the bare paths. Use it to land part of a file early. The same file is then listed as a bare path in a later slice, which brings it to its final version.
Steps
- Resolve source and base. Run
git status; if the tree is dirty, stop and tell the user. If base is not an ancestor of source, tell the user to merge base into source first. Never rebase. - Find the real build and test commands:
scripts/test-all.shwhen it exists, otherwise readpackage.json,pom.xml,build.gradle,Cargo.toml,go.mod,pyproject.toml,Makefile. Run them on the source branch first. If the source itself is red, stop and report it: a split of a red branch cannot have green slices. - Run
scripts/plan.sh <base> <source>. Readinventory.txtand the full diffgit diff <base> <source>. Read the files, not only the diff, to learn what depends on what. - Write
prompt.mdin the work dir with the user's whole prompt, verbatim. - Design the slices and write
plan.md:- Order by dependency: what is used lands before what uses it. Schema, then model, then logic, then API, then UI, then docs.
- Tests travel with the code they test.
- Pure refactors, renames, moves and formatting get their own slice, before the behavior change.
- Generated files, lockfiles and dependency bumps get their own slice.
- Aim for the target size per slice; a slice may be larger only when it cannot be cut and still build. Prefer 2 to 8 slices.
- When one file must be split across slices, write the partial version as a patch:
git diff <base> <source> -- <file> > patches/<name>.patch, keep only the hunks the earlier slice needs, check it withgit apply --check, and list the file as a bare path in the later slice. - Never invent code. If a slice can only build with a stub or flag that is not in the source, stop and ask the user.
- Run
scripts/split.sh <work dir>/plan.md. When a slice fails, read its log inout/NN.log, fix the plan by moving files or hunks, runscripts/cleanup.sh <source>and split again. Stop after 5 failed attempts and report what blocks the split. - Report a table with every branch, its files,
+/-lines and the test result, the linesame tree as <source>: yes, the path of the PR bodies and ofcreate-prs.sh. - Never push. Tell the user to push the
split/<source>/*branches and then runcreate-prs.sh. Each PR targets the previous slice, so GitHub shows only that slice's diff. Merge them in order with merge commits; when one merges, GitHub retargets the next to the base. - After review comments: commit the fix on the slice it belongs to, then run
scripts/restack.sh <work dir>/plan.md. It merges forward, never rebases, and reruns the checks.
Hard Rules
- Never push, never rebase, never force anything, never touch the source branch.
- Only ever delete branches under
split/<source>/. - The split is lossless:
split.shmust printsame tree as <source>: yes. Never report success without that line. - Every slice builds and passes the tests alone. A slice with a skipped or failing test is a failure, say so.
- PR bodies carry the task (3 to 5 lines), the whole prompt and the real test output.
- Commits are
<project>: <title>with noCo-Authored-Bylines. - No comments in any file you write.
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.

