52 Files in One PR? I Built a Claude Code Plugin That Splits It For Me
How It Happens
I love building features End-to-End. From the Database to the UI.
This means that when I work on something, I touch a lot of files. Types, Services, API, Components, Tests. Everything together, everything connected, everything working.
Three days later, I look at my PR and see: 52 changed files. +1,300 lines. -200.
And that's the moment I know: I created a problem for myself.
Why is a Large PR a Real Problem?
If you work in a team, you probably already know. But let's elaborate:
Cognitive Load on the Reviewer
When someone has to review 52 files, they don't really read the code. They scroll fast, look at the first few lines, maybe check the tests, write "LGTM" and Approve because they don't have the energy to sit on it for two hours.
The result? Things get missed. Comments that could have improved the code simply aren't written.
Long Closing Time
Large PR = higher chance of conflicts. More time until someone is free to review it. More Rebases. More frustration.
Hard to Revert
Something broke in production? Congratulations, now you need to figure out which part of the 52 files caused it. Or Revert the entire PR and lose three days of work.
Statistics Don't Lie
Studies show that effective Review occurs when reviewing up to 400 lines of code. Beyond that, the quality of the Review drops dramatically.
The Obvious Solution (That No One Does)
"So split the PR into several small PRs!"
Yes, that is the solution. And that is exactly what someone tells you in Code Review.
And then the real nightmare begins:
- Need to understand what should go in with what
- Need to mess with Git - branches, cherry-picks, rebases
- Need to ensure each PR compiles separately
- Need to manage the merge order
- Need to deal with conflicts between the PRs
This can take hours. Hours that could have been invested in writing new code.
Meet PR Splitter
After encountering this problem one time too many, I decided to build a solution.
PR Splitter is a Claude Code Plugin that does exactly what the name suggests: lets AI split a large PR into several small, organized PRs.
How Does It Work?
The process is divided into two stages:
Stage 1: Analysis (AI suggests, you approve) - And the most important stage
This stage is the most critical, and for good reason: You know your code best.
The Agent analyzes your changes, understands the dependencies between files (who imports who), and suggests a logical division. But the final decision is yours.
Why is this so important? Because only you know:
- What is the logical order - which change needs to go in first from a business perspective
- How it fits into the architecture - what fits the way your system is built
- Where there are hidden connections - dependencies not seen in imports but exist in logic
- What can be split and what must stay together - business logic that requires coherence
The AI is an excellent tool for technical analysis, but the business and architectural knowledge is yours. Therefore, the Agent presents you with a proposal and makes you a partner in the process:
Agent: I suggest 3 PRs:
**PR 1** (2 files):
- src/types/user.ts
- src/types/order.ts
**PR 2** (3 files) - depends on PR 1:
- src/services/user.service.ts
- src/services/order.service.ts
**PR 3** (4 files) - depends on PR 2:
- src/api/user.controller.ts
- tests/user.test.ts
Please provide branch names:
1: <name>
2: <name>
3: <name>
At this stage, your role is to give feedback. You can:
- Approve the division as is
- Ask to combine certain PRs together
- Ask to split a PR into more small parts
- Change the order of dependencies if you know it makes more sense
This is the most important dialogue in the entire process - because you bring your deep understanding of the code into the equation.
Stage 2: Execution (AI creates the PRs)
After you approved the division and gave names, the Agent creates all the branches using Git Worktrees. Each PR is isolated in a separate folder, ready for push.
Why Git Worktrees?
The magic here is in the use of Git Worktrees. Instead of creating regular branches and doing checkout back and forth, each "slice" gets a separate folder:
your-repo/
├── .claude/
│ └── worktrees/
│ ├── slice-1/ # First PR - fully isolated
│ ├── slice-2/ # Second PR - fully isolated
│ └── slice-3/ # Third PR - fully isolated
└── src/ # Your main working directory
This means:
- No need for checkout - work on multiple branches in parallel
- Full isolation - each PR in a separate folder
- Easy cleanup - one command deletes everything
Installation and Usage
Installation via Claude Code Marketplace
claude plugin marketplace add danielsinai/pr-splitter
claude plugin install pr-splitter
Usage
Simply run the Slash Command inside Claude Code:
/split-pr
And that's it. The Agent does the rest.
The Bottom Line
I still love writing a lot of code. I still get carried away and reach changes of dozens of files.
But now, instead of sitting for an hour and splitting manually, I simply let the AI do the grunt work for me.
PR Splitter is an excellent example of how AI can solve real and daily problems for developers. Not something sophisticated and complicated - just a tool that saves time and produces higher quality code.
The code is open at GitHub. Give a star if it helped you.
P.S.
Do you have your own tricks for dealing with large PRs? Send me a message, I'm interested to hear how others deal with this challenge.