/git-workflow:split-prfrom git-workflow
Analyzes the current diff and proposes how to split it into smaller, reviewable PRs, grouped by logical concern with a suggested creation order. Use when a changeset feels too large to review, the user says a PR is "too big" or "should be split up", or before opening a PR with many unrelated files changed.
Ships in git-workflow. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Help developers break down large changesets into logical, reviewable pull requests. This skill analyzes the current diff and proposes a splitting strategy that keeps changes atomic and reviewable. It only reads and recommends — it never stages, commits, or pushes anything itself.
Never use git -C <path> — always run git commands from the current working directory. The -C flag rewrites the command in a way that doesn't match allowed-tools patterns, forcing unnecessary user approval.
Don't assume main. Resolve it in order of preference, falling back as needed:
BASE=$(git rev-parse --abbrev-ref --symbolic-full-name @{upstream} 2>/dev/null | sed 's#^[^/]*/##') \
|| BASE=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's#^refs/remotes/origin/##') \
|| BASE=""
If both resolve to nothing (detached HEAD, no origin, no upstream tracking), ask the user which branch to diff against instead of guessing main.
Run these commands to understand the scope (substitute $BASE from step 1):
# Get detailed file statistics
git diff "${BASE}...HEAD" --stat
# List all changed files
git diff "${BASE}...HEAD" --name-only
# Show commit history for context
git log "${BASE}...HEAD" --oneline
Exclude generated files. The most reliable cross-language signal is git's own linguist-generated attribute (respected by GitHub, set via .gitattributes) — check that first rather than guessing extensions:
git diff "${BASE}...HEAD" --name-only | while read -r f; do
git check-attr linguist-generated -- "$f" | grep -q 'linguist-generated: true' || echo "$f"
done > /tmp/split-pr-files.txt
If the repo has no linguist-generated markers, fall back to common conventions for that repo's ecosystem — vendor/, node_modules/, dist/, build/, *.lock, *.min.*, or a docs/ tree — but confirm which apply by looking at what's actually in the diff rather than assuming one language's layout.
# Count non-generated files changed
wc -l < /tmp/split-pr-files.txt
# Lines changed, excluding generated files
git diff "${BASE}...HEAD" --stat -- $(tr '\n' ' ' < /tmp/split-pr-files.txt) | tail -1
Assess whether the changes exceed recommended limits:
These are starting points, not hard rules — code review research generally finds reviewer defect-detection drops off past a few hundred changed lines and attention fades past a handful of files. Adjust for the team and the nature of the change.
If changes exceed these limits or mix multiple concerns, proceed to split analysis.
Examine the changed files and identify natural boundaries:
Use these commands to help (language-agnostic — group by path and extension rather than assuming a specific ecosystem's layout):
# Group non-generated changed files by top-level directory
cut -d'/' -f1-2 /tmp/split-pr-files.txt | sort | uniq -c
# Group by file extension, to spot mixed concerns (e.g. schema + implementation)
sed 's/.*\.//' /tmp/split-pr-files.txt | sort | uniq -c
Adapt the directory depth (f1-2) to how deep this repo's package/module structure actually goes — check git diff --stat output first rather than assuming.
Create a structured plan with multiple PRs:
For each proposed PR, specify:
Determine the optimal order for creating PRs:
Provide a clear, actionable plan:
## Proposed PR Split
### Summary
Currently [X] files changed with [Y] lines modified. Recommend splitting into [N] PRs:
### PR 1: [Name] (Create First)
**Purpose**: [What and why]
**Files**:
- path/to/file1
- path/to/file2
**Size**: ~100 LOC
**Dependencies**: None
**Tests**: Includes unit tests for new functionality
### PR 2: [Name] (After PR 1)
**Purpose**: [What and why]
**Files**:
- path/to/file3
**Size**: ~150 LOC
**Dependencies**: Requires PR 1 (uses new interface)
**Tests**: Integration tests
[... continue for each PR ...]
## Next Steps
1. Would you like me to help create PR 1 first?
2. Should I create a tracking issue for the overall work?
3. Any changes to this split strategy?
This skill only analyzes and proposes — it doesn't stage, commit, or push. If the user confirms a proposed PR:
git add <file1> <file2> ...) — never git add -A, since precise file selection is the entire point of the split.commit skill to craft the commit(s) for that group.pr skill once that group's commits are ready to open as a PR.git diff "${BASE}...HEAD" between PRs since the working tree changes as each one is committed and (optionally) removed from the branch.Refactoring + Feature:
Multi-layer Feature:
Package Restructuring:
Schema/Codegen-Driven Changes (e.g. protobuf, GraphQL, Kubernetes CRDs, OpenAPI):
Current state: 8 files changed, 450 lines
Split strategy:
Rationale: Business logic is independently testable and reusable
Current state: 15 files changed, 800 lines
Split strategy:
Rationale: Each PR is independently valuable and testable
Current state: 12 files changed, 600 lines
Split strategy:
Rationale: Each PR represents a complete vertical slice of functionality
After presenting the split strategy:
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub meaganewaller/marketplace --plugin git-workflow4 skills in this plugin
/commitUse when committing code changes, including amending the last commit or adding files to it. Enforces intentional file selection, conventional commits, and why-focused messages./issueCreate well-structured GitHub issues with clear titles, descriptions, and acceptance criteria. Use when filing bugs, requesting features, or structuring issue content./prCreates a pull request and opens it in the browser for final human review before submission. Use when the user asks to open a PR, create a pull request, or ship the current branch for review.