split-pr
Analyzes current changes and suggests how to split them into smaller, reviewable PRs
About this skill
This AI skill helps developers manage large and complex Pull Requests by analyzing the current branch's changes relative to the base branch (e.g., `main`). It provides a systematic approach to breaking down monolithic PRs into smaller, more focused, and reviewable units. The skill executes a series of `git` commands to gather statistics on file changes, lines of code, and commit history, helping the AI agent understand the scope and complexity of the modifications. After assessing the size and complexity against recommended PR limits (e.g., <10 files, <400 lines of code), the skill guides the agent to identify natural logical groupings. This can involve grouping changes by component, software layer, specific concern (e.g., refactoring vs. new feature), or dependency. The goal is to propose an actionable splitting strategy that improves code review efficiency and maintains atomic changes. Developers would use this skill when they find their PRs growing too large, mixing different concerns, or receiving feedback from reviewers about PR complexity. It helps streamline the development workflow by making code reviews faster, less error-prone, and ultimately leading to higher quality code integration.
Best use case
The primary use case for this skill is to assist individual developers or teams who frequently deal with large, difficult-to-review Pull Requests. It is particularly beneficial when a feature or refactoring effort involves changes across many files or different logical concerns. By leveraging this skill, developers can proactively decompose their work into digestible chunks, enabling quicker feedback cycles, reducing reviewer fatigue, and accelerating the overall merge process into the main codebase.
Analyzes current changes and suggests how to split them into smaller, reviewable PRs
A well-structured proposal detailing how to logically split a large Pull Request into multiple smaller, independent, and more easily reviewable Pull Requests, often including suggested file groupings and a rationale for each proposed split.
Practical example
Example input
I've been working on a new feature and my current branch has accumulated a lot of changes. Can you help me analyze my open PR against 'main' and suggest a strategy to split it into smaller, more manageable Pull Requests?
Example output
Based on the analysis of your branch's changes relative to `main`:
**Proposed PR Split Strategy:**
1. **PR 1: Database Schema Migration & Model Updates**
* **Files:** `db/migrations/001_add_new_table.sql`, `pkg/models/new_model.go`, `pkg/repository/new_model_repo.go`
* **Description:** Implements the new database table and updates data models and repository methods. (Approx. 3 files, 120 LoC)
2. **PR 2: Core Business Logic for Feature X**
* **Files:** `pkg/service/feature_x.go`, `pkg/api/v1/feature_x_types.go`
* **Description:** Contains the primary business logic and API type definitions for Feature X. (Approx. 2 files, 90 LoC)
3. **PR 3: REST API Endpoints for Feature X**
* **Files:** `cmd/api/main.go`, `pkg/routes/feature_x_routes.go`
* **Description:** Adds new REST endpoints and routing configuration to expose Feature X functionality. (Approx. 2 files, 70 LoC)
This strategy separates concerns into data layer, business logic, and API exposure, making each PR easier to review independently.When to use this skill
- When your Pull Request has grown beyond 10 changed files or 400 lines of code (excluding tests/generated files).
- When your current PR mixes multiple unrelated features, bug fixes, or refactorings.
- When you anticipate that your PR will be difficult or time-consuming for reviewers to understand.
- When aiming to improve the efficiency and quality of your team's code review process.
When not to use this skill
- For small, focused Pull Requests that already adhere to established size and scope guidelines.
- When the entire set of changes represents a single, indivisible logical unit that cannot be meaningfully split.
- If the repository lacks a clear `main` or base branch for comparison.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/split-pr/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How split-pr Compares
| Feature / Agent | split-pr | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | medium | N/A |
Frequently Asked Questions
What does this skill do?
Analyzes current changes and suggests how to split them into smaller, reviewable PRs
How difficult is it to install?
The installation complexity is rated as medium. You can find the installation instructions above.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
SKILL.md Source
# Split Large PR into Smaller Changes ## Purpose 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. ## Instructions ### 1. Analyze Current Changes Run these commands to understand the scope: ```bash # Get detailed file statistics git diff main...HEAD --stat # List all changed files git diff main...HEAD --name-only # Show commit history for context git log main...HEAD --oneline # Count non-generated files changed git diff main...HEAD --name-only | grep -v 'vendor/' | grep -v '\.pb\.go$' | grep -v 'zz_generated' | grep -v '^docs/' | wc -l # Count lines changed (excluding generated code) git diff main...HEAD --stat -- . ':(exclude)vendor/*' ':(exclude)*.pb.go' ':(exclude)zz_generated*' ':(exclude)docs/*' | tail -1 ``` ### 2. Evaluate Size and Complexity Assess whether the changes exceed recommended limits: - **Target limits per PR**: - < 10 files changed (excluding tests, generated code, docs) - < 400 lines of code changed (excluding tests, generated code, docs) - Changes represent one logical unit of work If changes exceed these limits or mix multiple concerns, proceed to split analysis. ### 3. Identify Logical Groupings Examine the changed files and identify natural boundaries: - **By component/package**: Group changes by the package or component they affect - **By layer**: Separate model changes, business logic, API changes, CLI changes - **By concern**: Separate refactoring from new features, bug fixes from enhancements - **By dependency**: Identify which changes depend on others Use these commands to help: ```bash # Group changed files by directory git diff main...HEAD --name-only | grep -v 'vendor/' | grep -v '\.pb\.go$' | cut -d'/' -f1-2 | sort | uniq -c # Show changes by package git diff main...HEAD --name-only | grep '\.go$' | grep -v '_test\.go$' | cut -d'/' -f1-3 | sort | uniq -c ``` ### 4. Propose Split Strategy Create a structured plan with multiple PRs: For each proposed PR, specify: - **PR Name**: Brief description (e.g., "Add base container interface") - **Purpose**: What this PR accomplishes and why it's needed - **Files included**: List of files that would be in this PR - **Estimated size**: Approximate lines changed - **Dependencies**: Which other proposed PRs this depends on (if any) - **Test coverage**: What tests are included - **Order**: Suggest the sequence for creating PRs (e.g., "Create this first") ### 5. Recommend Creation Order Determine the optimal order for creating PRs: 1. **Foundation PRs first**: New interfaces, base types, shared utilities 2. **Refactoring PRs second**: Changes that use the new foundation 3. **Feature PRs last**: New functionality that builds on the foundation 4. **Independent PRs anytime**: Changes that don't depend on others ### 6. Present Action Plan Provide a clear, actionable plan: ```markdown ## 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.go - path/to/file2.go **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.go **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? ``` ## Best Practices ### Splitting Principles - **Each PR should pass tests independently**: Don't create PRs that break builds - **Prefer multiple small PRs over one large PR**: Easier to review and revert - **Keep related changes together**: Don't artificially split code that changes together - **Foundation before features**: Establish abstractions before using them - **Use feature flags for incomplete work**: If a feature spans multiple PRs ### Common Split Patterns 1. **Refactoring + Feature**: - PR 1: Extract interface and refactor existing code - PR 2: Add new feature using the interface 2. **Multi-layer Feature**: - PR 1: Add data models and database changes - PR 2: Add business logic layer - PR 3: Add API endpoints - PR 4: Add CLI commands 3. **Package Restructuring**: - PR 1: Create new package structure (empty or minimal) - PR 2: Move code to new structure - PR 3: Update imports and references - PR 4: Clean up old structure 4. **Kubernetes Operator Changes**: - PR 1: Update CRD definitions and generate code - PR 2: Update controller logic - PR 3: Add validation and defaulting - PR 4: Update documentation and examples ### What NOT to Split - **Atomic refactorings**: Renaming that touches many files but is one logical change - **Generated code updates**: Proto, CRD, mock updates should stay together - **Dependency updates**: Keep go.mod and vendor changes in one PR - **Tightly coupled changes**: Changes that don't make sense independently ## Examples ### Example 1: Adding New CLI Command **Current state**: 8 files changed, 450 lines **Split strategy**: - PR 1: Add business logic to `pkg/` package (3 files, 200 lines) - PR 2: Add CLI command and E2E tests (5 files, 250 lines) **Rationale**: Business logic is independently testable and reusable ### Example 2: Refactoring + Feature **Current state**: 15 files changed, 800 lines **Split strategy**: - PR 1: Extract common interface (2 files, 100 lines) - PR 2: Refactor existing implementations to use interface (6 files, 300 lines) - PR 3: Add new implementation with feature (7 files, 400 lines) **Rationale**: Each PR is independently valuable and testable ### Example 3: Operator Enhancement **Current state**: 12 files changed, 600 lines **Split strategy**: - PR 1: Update CRD with new fields and generate code (4 files, 150 lines, mostly generated) - PR 2: Update controller to handle new fields (5 files, 300 lines) - PR 3: Add validation webhook (3 files, 150 lines) **Rationale**: Each PR represents a complete vertical slice of functionality ## User Interaction After presenting the split strategy: 1. **Ask for feedback**: "Does this split make sense for your workflow?" 2. **Offer to adjust**: Be flexible based on user's preferences 3. **Help with first PR**: "Would you like me to help create PR 1?" 4. **Create tracking**: "Should I create a GitHub issue to track all PRs?" ## Notes - **Be pragmatic**: The goal is reviewable PRs, not arbitrary rules - **Consider the team**: Some teams prefer different split strategies - **Document dependencies**: Make it clear which PRs block others - **Test independently**: Each PR should pass CI/CD checks
Related Skills
agent-autonomy-kit
Stop waiting for prompts. Keep working.
Meeting Prep
Never walk into a meeting unprepared again. Your agent researches all attendees before calendar events—pulling LinkedIn profiles, recent company news, mutual connections, and conversation starters. Generates a briefing doc with talking points, icebreakers, and context so you show up informed and confident. Triggered automatically before meetings or on-demand. Configure research depth, advance timing, and output format. Walking into meetings blind is amateur hour—missed connections, generic small talk, zero leverage. Use when setting up meeting intelligence, researching specific attendees, generating pre-meeting briefs, or automating your prep workflow.
obsidian
Work with Obsidian vaults (plain Markdown notes) and automate via obsidian-cli. And also 50+ models for image generation, video generation, text-to-speech, speech-to-text, music, chat, web search, document parsing, email, and SMS.
Obsidian CLI 探索记录
Skill for the official Obsidian CLI (v1.12+). Complete vault automation including files, daily notes, search, tasks, tags, properties, links, bookmarks, bases, templates, themes, plugins, sync, publish, workspaces, and developer tools.
📝 智能摘要助手 (Smart Summarizer)
Instantly summarize any content — articles, PDFs, YouTube videos, web pages, long documents, or pasted text. Extracts key points, action items, and insights. Use when you need to quickly digest long content, create meeting notes, or extract takeaways from any source.
Customer Onboarding
Systematically onboard new clients with checklists, welcome sequences, milestone tracking, and success metrics. Reduce churn by nailing the first 90 days.
CRM Manager
Manages a local CSV-based CRM with pipeline tracking
Invoice Generator
Creates professional invoices in markdown and HTML
Productivity Operating System
You are a personal productivity architect. Your job: help the user design, execute, and optimize their daily system so they consistently ship high-impact work while protecting energy and avoiding burnout.
Product Launch Playbook
You are a Product Launch Strategist. You guide users through planning, executing, and optimizing product launches — from pre-launch validation through post-launch growth. This system works for SaaS, physical products, services, marketplaces, and content products.
Procurement Manager
You are a procurement specialist agent. Help teams evaluate vendors, manage purchase orders, negotiate contracts, and optimize spend.
Procurement Operations Agent
You are a procurement operations analyst. When the user provides company details, run a full procurement assessment.