Agent skill

split-graphite-stack

Split monolithic branches into logical PR stacks. Use when user says "split this branch into PRs", "break up my changes", "create a PR stack", "split stack", "make this reviewable", or has a large branch with many changes that needs to be broken into smaller, reviewable pieces.

Stars 30
Forks 9

Install this agent skill to your Project

npx add-skill https://github.com/Uniswap/ai-toolkit/tree/next/packages/plugins/development-pr-workflow/skills/split-graphite-stack

SKILL.md

Stack Splitter

Automatically split a monolithic branch with many changes into a logical, reviewable stack of PRs using semantic analysis and Graphite.

Note: This skill requires Graphite CLI (gt) as PR stacking is a Graphite-specific concept. For standard Git workflows without stacking, consider creating separate branches and PRs manually or using the standard PR creator.

When to Activate

  • User has a large branch with many commits
  • User wants to break changes into reviewable pieces
  • User asks to "split" or "stack" their changes
  • User needs help creating a PR stack
  • User mentions Graphite stack management

Prerequisites

  • Graphite CLI installed: npm install -g @withgraphite/graphite-cli@latest (required - this is a Graphite-only feature)
  • Repository initialized with Graphite: gt repo init
  • Clean working directory: No uncommitted changes
  • Feature branch with 3+ commits to split

Why Graphite-only? PR stacking (having multiple dependent PRs that automatically rebase when lower PRs are merged) is a core Graphite feature. Standard Git doesn't support this workflow natively.

Quick Process

  1. Analyze Changes: Examine all commits and file changes since branch diverged
  2. Semantic Grouping: Group related changes by functionality
  3. Dependency Analysis: Use Nx project graph to understand dependencies
  4. Plan Generation: Create logical split plan optimized for reviewability
  5. User Approval: Present plan and wait for approval/modifications
  6. Execute Splits: Use gt split to create the stack

Semantic Analysis Principles

Logical Boundaries

Group changes that:

  • Implement the same feature or fix the same bug
  • Share the same domain/context (auth, payments, UI)
  • Have natural dependencies (types → implementation → tests)

Dependency Awareness

  • Use Nx project graph for package dependencies
  • Foundational changes go at bottom of stack
  • Integration/glue code goes at top
  • Each PR reviewable independently

Reviewability Optimization

Each PR should:

  • Tell a coherent story with clear purpose
  • Be small enough to review in 15-30 minutes
  • Include relevant tests
  • Have descriptive title and description

Output Format

markdown
## 📋 Proposed Stack Split Plan

**Current Branch:** `feature/big-changes`
**Base Branch:** `main`
**Total Commits:** 15

### Stack Structure (bottom to top)

#### PR #1: `feat: add authentication types`

**Commits:** 3 commits
**Files:** 5 files (+123 -12)
**Rationale:** Foundational types that other changes depend on
**Reviewability Score:** 9/10

#### PR #2: `feat: implement JWT service`

**Commits:** 5 commits
**Files:** 12 files (+456 -89)
**Dependencies:** PR #1
**Reviewability Score:** 7/10

[... continues for each PR ...]

Examples

"Split this branch into PRs"
"Break up my changes into a reviewable stack"
"Create a PR stack from my feature branch"
"Help me split these 15 commits into logical PRs"

Delegation

Invokes the stack-splitter-agent with:

  • Current branch name and base branch
  • All commits since divergence
  • File changes with diff
  • Nx project structure (if available)

Expand your agent's capabilities with these related and highly-rated skills.

Uniswap/ai-toolkit

review-plan

Review implementation plans for completeness and feasibility. Use when user says "review this plan before I start", "is this implementation plan complete", "check if this plan aligns with our patterns", "give me feedback on my implementation strategy", or "validate this plan before we execute it".

30 9
Explore
Uniswap/ai-toolkit

plan-implementation

Create implementation plans for features and changes. Use when user says "plan how to implement user authentication", "how should I add dark mode to the app", "what's the best way to refactor the database layer", "create a plan for migrating to the new API", or "I need to implement [feature] - help me plan it out".

30 9
Explore
Uniswap/ai-toolkit

execute-plan

Execute implementation plans step-by-step. Use when user says "execute the plan", "implement the plan we created", "start building based on the plan", "go ahead and implement it", "proceed with the implementation", "execute as a stack", "create a PR stack while implementing", "implement with one PR per step", or references a plan file and wants to begin coding.

30 9
Explore
Uniswap/ai-toolkit

generate-commit-message

Generate well-structured git commit messages. Use when user says "generate commit message", "write a commit", "what should my commit message be", "create commit message for these changes", or needs help crafting conventional commit messages.

30 9
Explore
Uniswap/ai-toolkit

plan-swarm

Refine plans through multi-agent expert discussion. Use when user says "get multiple expert opinions on this plan", "I want different perspectives on this approach", "have the agents discuss this strategy", "refine the plan through collaborative review", or "what would different specialists think about this design".

30 9
Explore
Uniswap/ai-toolkit

create-pr

Create or update pull requests with conventional commits. Use when user says "create a PR for these changes", "submit this for review", "open a pull request", "push these changes and create a PR", "I'm ready to submit this work", or "create PR and link to issue

30 9
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results