MR Split Analysis

VerifiedSafe

Analyzes all changes on the current branch (uncommitted and committed) and recommends whether to split them into smaller, focused MRs. Uses heuristics like backend/frontend separation, migration-first, and cohesion.

Sby Skills Guide Bot
DevelopmentIntermediate
8/29/2026
Claude Code
#git#merge-requests#code-review#gitlab#branch-management

Recommended for

Automated summary

Analyzes all changes on the current branch relative to its merge base and recommends whether to keep them as one MR or split them into smaller, focused MRs.

Strengths

  • Examines both uncommitted work and existing commits, so it works on a PoC or an open MR branch as well as on fresh changes.
  • Provides concrete split heuristics (backend/frontend, migrations first, independent refactors, topology-first) rather than generic advice.
  • Distinguishes true dependencies (stacked MRs) from convenience bundling and favors shallow stacks with parallel MRs.
  • Can carry the plan through execution by resetting commits and creating GitLab MRs with glab.

Limitations

  • Assumes a GitLab workflow and a `master` base branch by default; repositories on other forges or with a different default branch need adjustment.
  • The execution path can run `git reset` on existing commits, which rewrites local history and should be used carefully.
  • Split quality depends on the agent's reading of the diff; it does not run tests or verify that each proposed MR builds independently.
When to use it

Use when a branch contains a mix of changes, committed or uncommitted, and you want a reasoned plan for splitting it into reviewable MRs.

When not to use it

Do not use for a tiny single-concern change or when you cannot tolerate rewriting local commit history.

Security analysis

Safe
Quality score92/100

The skill operates exclusively within Git version control and GitLab MR creation workflows using declared tools. It reads diffs, logs, and statuses, and may perform git reset, branch creation, and push operations, but only after explicit user confirmation as part of a standard code review and splitting process. No destructive system commands, network exfiltration, or obfuscated payloads are present.

No concerns found

How this analysis is made

Examples

Review branch for splitting
Analyze the full diff of my current branch against master and tell me whether it should be split into smaller MRs. If it should, give me a concrete split plan.
PoC plus uncommitted changes
This branch has a PoC commit and some uncommitted follow-up changes. Review everything and propose which files should go into parallel MRs versus stacked MRs.
Split and create GitLab MRs
Split my current changes into a migration MR, a backend MR, and a frontend MR, then create the GitLab MRs with glab.

name: split-mr description: Analyze the changes on the current branch — both uncommitted work and commits already made (e.g. a PoC or existing MR) — and reason about whether they should be split into smaller, more focused MRs. Identifies natural boundaries (backend/frontend, model/spec, feature/refactor) and proposes a split plan or confirms the changes are cohesive enough to keep as one. argument-hint: "" disable-model-invocation: false allowed-tools: Bash(git diff:), Bash(git log:), Bash(git status:), Bash(git show:), Bash(git checkout:), Bash(git branch:), Bash(git push:), Bash(glab mr create:), Bash(glab mr view:*), Read, Grep, Glob

MR Split Analysis

Establish the base the branch diverges from (usually master) with git merge-base HEAD master, then run git diff <base>...HEAD --stat and --name-only to get the full file list. This covers all changes on the branch — both uncommitted work and commits already made — so the analysis works the same whether the user has staged nothing yet or is pointing the skill at a branch that already has commits (a PoC or an open MR). Reason about whether to split from that complete picture.

When the changes are already committed and the user wants to act on a split, the existing commits can be unwound with git reset <base> (or git reset HEAD~N for the last N commits) before re-distributing files across the proposed MRs in the Execution step.

Split heuristics

  1. Backend/frontend split — Ruby and Vue/JS changes that depend on a new field or endpoint: split, with the frontend MR targeting the backend branch.

  2. Migration-first — Migrations that add columns/tables should land alone ahead of the code that uses them.

  3. Specs travel with code — Don't split specs out unless you're refactoring shared test infrastructure.

  4. Independent refactors — Unrelated cleanups or renames alongside a feature: separate them so reviewers can focus.

  5. Cohesion check — If every file works toward one clearly stated goal and no file is a prerequisite for another MR, keep it as one.

  6. Topology-first — Find the structural cut that lets every other MR be independent:

    • Removals: delete the entry point (route, webpack page, GraphQL mount) first; downstream files become unreachable and can be deleted in parallel MRs. Default to maximally fine-grained.
    • Additions: land the substrate first (feature flag off, base type, scaffolded route, empty service). Everything else becomes parallel leaf additions instead of a nested chain.
    • Refactors: MR 1 introduces the new shape alongside the old; downstream MRs convert callers in parallel; final MR removes the old shape.
  7. Frontend import graph — Before splitting frontend changes, trace what's imported by webpack entry points. A file may look standalone but still be imported elsewhere — deleting it alone breaks bin/rake gitlab:assets:compile.

When NOT to split: change is already small (< ~10 files, single concern); backend and frontend changes are trivial and tightly coupled (e.g. renaming a constant end-to-end); splitting would leave a branch in a broken/non-functional state with no guard.

Stacked vs. parallel (default: parallel)

Classify each pair:

  • True dependency (stack): MR B references symbols defined in MR A and won't compile against master alone.
  • Convenience bundling (parallelize): files are related but neither references the other.
  • Soft dependency (parallelize, accept transient CI red): MR B's CI is red until MR A lands, but runtime is fine — merge order handles it.

Prefer the shallowest stack possible (depth 2–3 max). Linear stacks force sequential review; if any MR stalls, the whole chain stalls.

"Shallowest stack" caps stack depth — it is not a reason to minimize MR count. Sibling leaves that each depend only on a shared substrate but not on each other (e.g. a write path, a read path, an operationally independent cron worker, a cross-component capability handshake) are parallel, not stacked: giving each its own MR does not deepen the stack — it keeps every MR small. Never fold independent leaves into one MR to "stay shallow"; that just rebuilds the oversized MR you set out to split. Only bundle leaves when each is trivially small and shares a single reviewer domain. After proposing a split, re-check every MR: if one still mixes two concerns that don't reference each other, split it again.

Output format

## Split Analysis

**Verdict:** [Split into N MRs | Keep as one MR]

### Proposed MRs
1. **MR 1 — [title]** (targets: master)
   Files: ...
   Why first: ...

2. **MR 2 — [title]** (targets: MR 1 branch | master)
   Files: ...

### Reasoning
[2–3 sentences]

Generated files

locale/gitlab.pot, doc/api/graphql/reference/_index.md, and public/-/graphql/introspection_result.json are derived from source. Each MR that changes their inputs must regenerate them in the same commit — run lefthook run autofix after edits and before each commit.

Execution (only if user confirms)

For each proposed MR, starting closest to master:

  1. git checkout <base> && git checkout -b <branch>
  2. git checkout <original-branch> -- <files>
  3. lefthook run autofix — regenerates derived files, applies linters. Never skip with --no-verify.
  4. Commit, push, glab mr create targeting the correct branch.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/mr-split-analysis-mte1lfzf/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/mr-split-analysis-mte1lfzf' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/mr-split-analysis-mte1lfzf/download' --output '.skill-downloads/mr-split-analysis-mte1lfzf/SKILL.md.part' && mv '.skill-downloads/mr-split-analysis-mte1lfzf/SKILL.md.part' '.skill-downloads/mr-split-analysis-mte1lfzf/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Bash(git diff:*), Bash(git log:*), Bash(git status:*), Bash(git show:*), Bash(git checkout:*), Bash(git branch:*), Bash(git push:*), Bash(glab mr create:*), Bash(glab mr view:*), Read, Grep, Glob

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/mr-split-analysis-mte1lfzf/SKILL.md' && test -s '.skill-downloads/mr-split-analysis-mte1lfzf/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/split-mr' && cp -R '.skill-downloads/mr-split-analysis-mte1lfzf' '.claude/skills/split-mr'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/mr-split-analysis-mte1lfzf'

openskills read 'mr-split-analysis-mte1lfzf'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/mr-split-analysis-mte1lfzf/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills