A Claude Code skill that splits a large branch into N stacked logical branches with hunk-level granularity.
Large branches are hard to review. /split analyzes your branch's diff against its base, groups changes into logical units (models, API, tests, etc.), and creates stacked branches — each building on the previous — ready for separate PRs.
/plugin marketplace add Iron-Ham/split
/plugin install split@split
Clone the repo and copy the skill files into Claude Code's skills directory:
git clone https://github.com/Iron-Ham/split.git ~/split
cd ~/split
mkdir -p ~/.claude/skills/split/scripts
cp skills/split/SKILL.md ~/.claude/skills/split/
cp skills/split/scripts/split_diff.py ~/.claude/skills/split/scripts/
chmod +x ~/.claude/skills/split/scripts/split_diff.pygit clone https://github.com/Iron-Ham/split.git ~/split
mkdir -p ~/.codex/skills/public/split/scripts
cp ~/split/skills/split/SKILL.md ~/.codex/skills/public/split/
cp ~/split/skills/split/scripts/split_diff.py ~/.codex/skills/public/split/scripts/
chmod +x ~/.codex/skills/public/split/scripts/split_diff.pyFor Cursor or other agents, clone the repo and copy skills/split/SKILL.md and skills/split/scripts/split_diff.py to wherever your agent reads custom instructions from.
- Python 3.10+ (stdlib only, no dependencies)
ghCLI (for automatic PR creation)
/split # Auto-detect number of groups
/split 3 # Split into 3 groups
/split --base dev # Diff against 'dev' instead of main
/split 4 --base dev # Both
- Analyze — Diffs your branch against the base, summarizes files and hunks
- Propose — Groups changes into N logical units by layer/feature/dependency
- Approve — Shows the plan; you can approve, adjust, or cancel
- Execute — Creates stacked branches, each with cumulative changes
- Summary — Prints push and PR creation commands
Branch 2 contains all changes from branch 1 plus its own. Branch 3 contains branches 1+2 plus its own. Each PR targets the previous branch.
main ─── branch-1-models ─── branch-2-api ─── branch-3-tests
If a single file has changes belonging to different groups, the skill splits at the hunk level — only the relevant hunks are applied to each branch.
- Requires a clean worktree (no uncommitted changes)
- The original branch is never modified
- On failure, cleanup commands are printed but branches are not auto-deleted
MIT