
PR Splitter
FreeEfficiently break down large pull requests into manageable pieces.
Free · Opens the source repo
What PR Splitter does
The PR Splitter skill is designed to assist developers in managing large and complex pull requests (PRs) by breaking them down into smaller, more reviewable units. This process is essential when dealing with messy or hard-to-review changes that may include a mix of refactoring, behavior changes, and other modifications. By using this skill, developers can preserve the original PR as a reference while creating new branches for each smaller PR, ensuring that each one is independently buildable and reviewable.
The workflow begins with taking a snapshot of the original PR to create a backup branch. This step is crucial to avoid losing any context or intent from the original changes. Developers are guided to inventory the changes, classifying them by type, which helps in planning how to split the changes effectively. The skill emphasizes the importance of maintaining a scratchpad for notes, allowing developers to document their thought process and track the status of each planned PR.
When extracting changes, the skill provides clear instructions on how to do so safely, recommending fresh branches and selective restores to maintain a clean history. Developers are encouraged to verify each PR independently by running relevant builds and tests, ensuring that nothing is left behind. The skill also addresses the management of drift, meaning that as feedback from reviewers comes in, developers can adapt their PRs accordingly without losing sight of the original intent.
Overall, the PR Splitter skill is particularly useful for teams that work with large codebases or frequently engage in code reviews. It streamlines the process of creating manageable PRs, which can lead to more efficient reviews and better collaboration among team members. This skill is ideal for developers who need to maintain clarity and organization in their version control practices, especially in complex projects.
When to use it
Use this skill when you have a large or complex PR that needs to be split into smaller, more manageable units for review.
When not to use it
This skill may not be suitable for small, straightforward changes that can be reviewed in a single PR without confusion.
What you can build with it
Splitting a Mixed Refactor and Feature Change
When a single PR includes both refactoring and new feature implementations, use this skill to separate the changes into distinct PRs, enhancing clarity and review focus.
Managing Review Feedback Drift
After receiving feedback on an initial PR, utilize the skill to adapt subsequent PRs, ensuring they align with the latest reviewer-approved changes.
Creating Stacked Pull Requests
When later changes depend on earlier ones, this skill helps in organizing and managing stacked PRs effectively, maintaining a clear development flow.
How to install PR Splitter
View source1. Install with the skills CLI
npx skills add mastra-ai/mastra/pr-splitter --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by mastra-aiPR Splitter
Preserve the original PR as source material, build smaller reviewable PRs intentionally, and track drift locally as review feedback changes the stack.
Required workflow
-
Snapshot before touching history
- Check
git status. - Create an immutable local reference to the original branch:
git branch backup/original-large-pr. - Do not delete or rewrite the original branch until the split is complete.
- Check
-
Inventory the original PR
- Inspect
git diff --stat <base>...HEAD,git diff --name-only <base>...HEAD, andgit log --oneline <base>..HEAD. - Classify changes by review unit: prep/refactor, API/type changes, behavior, tests, docs, cleanup, generated/lock files.
- Inspect
-
Create a local scratchpad
- Write split notes to an uncommitted local file, preferably
.notes/pr-split.md. - Ensure
.notes/is ignored or leave it untracked. Do not commit scratchpad notes unless the user explicitly asks. - Track: original branch, base branch, planned PRs, files/hunks extracted, verification per PR, remaining original diff, and intentional drift from review feedback.
- Write split notes to an uncommitted local file, preferably
-
Choose the split shape
- Use stacked PRs when later work depends on earlier work.
- Use parallel PRs only when changes are truly independent.
- Use foundation + parallel follow-ups when one shared prep change unlocks independent work.
-
Extract changes safely
- Prefer fresh branches from the correct base plus selective restore over rewriting messy history.
- Use path-level extraction for clean file ownership:
git checkout backup/original-large-pr -- path/to/file. - Use hunk-level extraction for mixed files:
git restore -p --source backup/original-large-pr -- path/to/file. - Keep each PR independently buildable and reviewable.
-
Verify each PR independently
- Run the narrowest relevant build, typecheck, lint, and tests for that PR's scope.
- Do not leave tests, docs, or generated files separated from the code they validate unless the split plan explicitly calls for it.
-
Manage drift deliberately
- Treat reviewer-approved changes as the new source of truth for the stack.
- After changing an earlier PR, rebase dependent PRs onto it and resolve conflicts in favor of the reviewed direction, not blindly in favor of the original branch.
- Compare the evolving stack against
backup/original-large-prto find remaining intent, not to force byte-for-byte equality. - Record intentional differences in
.notes/pr-split.md.
-
Use range-diff for rewritten stacks
- Use
git range-diffafter rebases, conflict resolution, or force-pushes to understand what changed. - Summarize meaningful range-diff results for reviewers when updating a stacked PR.
- Use
PR description pattern
Keep PR descriptions concise and reviewer-facing:
## Summary
This is PR N of M split from a larger change.
## Scope
- ...
## Intentionally excluded
- Follow-up PR will handle ...
## Verification
- ...
Do not put the full split ledger in PR descriptions. Keep detailed extraction notes and drift tracking in .notes/pr-split.md.
Scratchpad template
# PR split scratchpad
Original branch: backup/original-large-pr
Base branch: main
## Planned PRs
1. branch-name
- Scope:
- Files/hunks extracted:
- Verification:
- Changeset: (package names, bump type, scoped message)
- Status:
## Remaining original intent
- ...
## Drift notes
- Date / branch / reason:
Changesets
Each split PR must carry its own changeset scoped to the changes in that PR. Do not keep the original changeset from the source branch — it covers the full combined change and does not belong in any single split PR.
After extracting changes into a split branch:
- Delete any changeset files carried over from the original branch. These were written for the combined diff and will produce incorrect changelog entries.
- Create a new changeset for each PR using the CLI (see
.mastracode/commands/changeset.md):pnpm changeset -s -m "your scoped message" (--major | --minor | --patch) pkg-name - Scope the message to that PR's changes only. The changeset message should describe what this specific PR does, not the full original feature.
- Include only the packages actually changed in this PR. If the original changeset listed five packages but this PR only touches
@mastra/core, the new changeset should only reference@mastra/core. - Match the version bump type to the PR's scope. A prep/refactor PR is typically
patch; a PR introducing new API surface isminor; a PR with breaking changes ismajor.
Add changeset creation to the scratchpad template under each planned PR's verification checklist so it is not forgotten.
Common failure modes
Avoid splitting by file when behavior spans files, extracting tests without code, leaving follow-up PRs uncompilable, force-pushing without a reviewer summary, deleting the original branch early, reverting review feedback while resolving stack conflicts, and keeping the original branch's changeset in every split PR instead of creating scoped changesets per PR.
Default output
When asked to split a PR, produce:
- proposed PR sequence,
- branch strategy,
- scratchpad path and initial contents,
- extraction commands,
- verification plan for each PR,
- drift-management plan.
Frequently asked questions about PR Splitter
Similar skills
Quality Playbook Generator
Run comprehensive quality audits on any codebase.
PR Draft Summary
Automate PR summary generation for openai-agents-python.
Final Release Review
Streamline your release candidate audits with ease.
Unit Test Vue Pinia
Efficiently write and review unit tests for Vue 3 applications.
Slang Shader Expert
Optimize and integrate Slang shaders with ease.
Telemetry Standards
Ensure consistent event tracking in Supabase Studio.
