mastra-ai/pr-splitter
Use when breaking a large, complex, messy, or hard-to-review pull request into multiple smaller PRs; planning stacked PRs; extracting independent changes from a branch; splitting mixed refactor and behavior changes; managing drift after review feedback; rebasing follow-up PRs as earlier PRs change; or preserving original branch intent while shipping incrementally.
npx skills add https://github.com/mastra-ai/mastra --skill pr-splitter
Preserve the original PR as source material, build smaller reviewable PRs intentionally, and track drift locally as review feedback changes the stack.
git status.git branch backup/original-large-pr.git diff --stat <base>...HEAD, git diff --name-only <base>...HEAD, and git log --oneline <base>..HEAD..notes/pr-split.md..notes/ is ignored or leave it untracked. Do not commit scratchpad notes unless the user explicitly asks.git checkout backup/original-large-pr -- path/to/file.git restore -p --source backup/original-large-pr -- path/to/file.backup/original-large-pr to find remaining intent, not to force byte-for-byte equality..notes/pr-split.md.git range-diff after rebases, conflict resolution, or force-pushes to understand what changed.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.
# 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:
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:
.mastracode/commands/changeset.md): pnpm changeset -s -m "your scoped message" (--major | --minor | --patch) pkg-name
@mastra/core, the new changeset should only reference @mastra/core.patch; a PR introducing new API surface is minor; a PR with breaking changes is major.Add changeset creation to the scratchpad template under each planned PR's verification checklist so it is not forgotten.
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.
When asked to split a PR, produce:
Take mastra-ai/pr-splitter from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.