npx skills add ...
npx skills add mastra-ai/mastra --skill pr-splitter
npx skills add mastra-ai/mastra --skill 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.
Preserve the original PR as source material, build smaller reviewable PRs intentionally, and track drift locally as review feedback changes the stack.
Snapshot before touching history
git status.git branch backup/original-large-pr.Inventory the original PR
git diff --stat <base>...HEAD, git diff --name-only <base>...HEAD, and git log --oneline <base>..HEAD.Create a local scratchpad
.notes/pr-split.md..notes/ is ignored or leave it untracked. Do not commit scratchpad notes unless the user explicitly asks.Choose the split shape
Extract changes safely
git checkout backup/original-large-pr -- path/to/file.git restore -p --source backup/original-large-pr -- path/to/file.Verify each PR independently
Manage drift deliberately
backup/original-large-pr to find remaining intent, not to force byte-for-byte equality..notes/pr-split.md.Use range-diff for rewritten stacks
git range-diff after rebases, conflict resolution, or force-pushes to understand what changed.Keep PR descriptions concise and reviewer-facing:
Do not put the full split ledger in PR descriptions. Keep detailed extraction notes and drift tracking in .notes/pr-split.md.
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):
@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: