From split-pr
Use when a feature branch is too large for review and needs to be split into multiple smaller PRs by architectural layer - manual invocation via /split-pr
How this skill is triggered — by the user, by Claude, or both
Slash command
/split-pr:split-prThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Split a large feature branch into multiple smaller PRs, each covering one architectural layer. The combined result is verified to be identical to the original branch.
Split a large feature branch into multiple smaller PRs, each covering one architectural layer. The combined result is verified to be identical to the original branch.
Announce at start: "I'm using the split-pr skill to split this branch into smaller PRs."
Verify az CLI is ready. Run each check sequentially — stop at first failure.
Check 1 — az installed?
az --version 2>/dev/null
If missing:
"Azure CLI is not installed. Install it: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli Then run:
az extension add --name azure-devopsThen:az login"
Wait for user to confirm installation before proceeding.
Check 2 — azure-devops extension?
az extension show --name azure-devops 2>/dev/null
If missing → run: az extension add --name azure-devops
If outdated → run: az extension update --name azure-devops
Check 3 — logged in?
az account show 2>/dev/null
If not logged in → ask user to run az login and wait for confirmation.
Check 4 — parse remote URL and configure defaults
git remote get-url origin
# Expected format: https://<company>@dev.azure.com/<company>/<project>/_git/<repository>
Extract <company>, <project>, <repository> from the URL.
az devops configure --defaults organization=https://dev.azure.com/<company> project=<project>
If any check fails and user skips setup: Set a flag to fall back to manual PR links at the end.
Ask the user two questions (one at a time):
2231)KAS, BZG, RDW)Then detect:
# Source branch
git branch --show-current
# Changed files
git diff --name-only master...<source-branch>
Classify each changed file by path pattern. First match wins.
| Layer | Branch suffix | Path patterns |
|---|---|---|
| 1 | db-contracts | */Database/**, */Migrations/**, */Contracts/**, */Models/**, */Enums/**, */Events/**, */Dtos/** |
| 2 | unit-tests | *.Tests.Unit/**, *Tests.Unit*/** |
| 3 | infrastructure | */Infrastructure/**, */Repositories/**, */Adapters/**, */Persistence/**, */Clients/** |
| 4 | application | */Application/**, */Handlers/**, */Pipeline/**, */Services/**, */UseCases/** |
| 5 | integration-tests | *.Tests.Integration/**, *Tests.Integration*/** |
| 6 | pipelines | **/Dockerfile*, **/docker-compose*, **/pipelines/**, **/*.yaml, **/*.yml |
Unmatched files → Layer 4 with explanation printed:
⚠️ Unclassified → Layer 4: path/to/File.cs (reason)
Skip layers with zero files silently.
Present the complete plan before touching git:
Split plan for <source-branch> → <N> PRs:
Layer 1 — dtoll-<ticket>-<vertical>-db-contracts (from master)
path/to/Models/Foo.cs
path/to/Enums/Bar.cs
Commit: [DTOLL-<ticket>] <Vertical> - add db migration, models and enums
Layer 2 — dtoll-<ticket>-<vertical>-unit-tests (from layer 1)
path/to/Tests.Unit/FooTests.cs
Commit: [DTOLL-<ticket>] <Vertical> - add unit tests
⚠️ Unclassified → Layer 4: path/to/Helper.cs (business logic)
Approve this plan? [y/n]
Wait for approval. If user says no → abort, no git changes made.
For each non-empty layer:
Layer 1 — from master:
git checkout master
git checkout -b dtoll-<ticket>-<vertical>-db-contracts
git checkout <source-branch> -- <file1> <file2> ...
git add .
git commit -m "[DTOLL-<ticket>] <Vertical> - <description>"
Layers 2–6 — from previous layer's branch:
git checkout dtoll-<ticket>-<vertical>-<prev-suffix>
git checkout -b dtoll-<ticket>-<vertical>-<suffix>
git checkout <source-branch> -- <file1> <file2> ...
git add .
git commit -m "[DTOLL-<ticket>] <Vertical> - <description>"
Default commit descriptions per layer:
| Layer | Description |
|---|---|
| 1 | add db migration, models and enums |
| 2 | add unit tests |
| 3 | add repositories and infrastructure |
| 4 | add application handlers and pipeline |
| 5 | add integration tests |
| 6 | add docker and pipeline configuration |
After each layer, pause and ask:
✓ Branch dtoll-<ticket>-<vertical>-<suffix> created (<N> files, 1 commit).
Continue to layer <next> (<suffix>)? [y/n]
If user says no → stop. Already-created branches remain intact.
Compare combined result with original source branch:
git diff master...<last-layer-branch> > /tmp/split_combined.diff
git diff master...<source-branch> > /tmp/split_original.diff
diff /tmp/split_original.diff /tmp/split_combined.diff
rm -f /tmp/split_combined.diff /tmp/split_original.diff
✓ Verification passed: all changes from <source-branch> are present in the split branches.For each layer branch, push and create a draft PR:
git push -u origin dtoll-<ticket>-<vertical>-<suffix>
az repos pr create \
--title "[DTOLL-<ticket>] <Vertical> - <description>" \
--source-branch dtoll-<ticket>-<vertical>-<suffix> \
--target-branch <target> \
--repository <repository> \
--org https://dev.azure.com/<company> \
--project <project> \
--draft
<target> is master for layer 1, or the previous layer's branch for layers 2+.
Fallback (if az unavailable): Display manual PR creation links:
https://dev.azure.com/<company>/<project>/_git/<repository>/pullrequestcreate?sourceRef=<branch>&targetRef=<target>
Display all PRs in one place:
─────────────────────────────────────────────
✓ Split complete. PRs created:
1. [DTOLL-<ticket>] <Vertical> - add db migration, models and enums
PR #42 → https://dev.azure.com/.../pullrequest/42
2. [DTOLL-<ticket>] <Vertical> - add unit tests
PR #43 → https://dev.azure.com/.../pullrequest/43
...
─────────────────────────────────────────────
| Layer | Suffix | Base | Description |
|---|---|---|---|
| 1 | db-contracts | master | DB, Models, Enums, Contracts |
| 2 | unit-tests | layer 1 | Unit test projects |
| 3 | infrastructure | layer 2 | Repositories, Adapters |
| 4 | application | layer 3 | Handlers, Services + unmatched files |
| 5 | integration-tests | layer 4 | Integration test projects |
| 6 | pipelines | layer 5 | Dockerfiles, YAML pipelines |
Forgetting az CLI pre-flight
Wrong branch base
masterMultiple commits per branch
[DTOLL-<ticket>] <Vertical> - <description>Skipping verification
Never:
Always:
Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub tichara1/claude.marketplace --plugin split-pr