option
HomeHome Skill Code Review mcore-split-pr

mcore-split-pr

nvidia/skills nvidia/skills

Split a PR into multiple PRs to reduce the number of required CODEOWNERS reviewer groups.

...Expand all
11
Updated time August 26, 2026

About mcore-split-pr

The mcore-split-pr skill helps split a large Megatron-LM pull request into multiple smaller PRs, each touching the fewest possible CODEOWNERS reviewer groups. It solves a concrete review-burden problem: a PR spanning core, examples, tools, and training directories pulls in many reviewer groups, slowing merges, whereas a PR scoped to a single directory needs only that directory's reviewers.

The workflow has three phases. First it analyzes the PR by fetching its details and diff stat with the gh CLI, parsing .github/CODEOWNERS to map file patterns to owner groups, and counting the distinct reviewer groups the PR currently requires. Second it proposes a split that clusters files by their CODEOWNERS groups, keeps tests with the production code they validate, flags cross-PR dependencies (for example symbols renamed in one PR that another depends on), ensures each resulting PR is independently mergeable, and presents the plan as a table for user approval. Third, only after approval, it executes by creating branches from the correct base, applying file-scoped diffs with git apply, committing, and pushing to the user's fork. It always creates PRs as drafts, never pushes directly to upstream, confirms before any force-push, and credits the original author when the current user is not the PR author.

Target users are Megatron-LM contributors and maintainers dealing with sprawling PRs who want to reduce the number of reviewer groups per PR while keeping each split independently reviewable and mergeable. It is user-invocable with a PR URL or number as its argument.

FAQ

What problem does splitting a PR solve?

It minimizes the number of CODEOWNERS reviewer groups required per PR, reducing review burden. Each resulting PR must still be independently mergeable and reviewable.

Does it push directly to the main repository?

No. It always creates PRs as drafts and pushes to the user's fork, never directly to upstream, and it confirms with the user before any force-push that narrows the original PR.

How are tests handled during a split?

Test files travel with the production code they validate. The skill explicitly avoids splitting tests into a separate PR just to reduce reviewer groups.

What happens when one split PR depends on another?

It calls out the dependency explicitly and places backward-compatible aliases, re-exports, or shims in the first PR so subsequent PRs can depend on them, and notes the required merge order.

What does it need to run?

The gh CLI authenticated for the repository, a local checkout with an upstream remote, and a user fork to push branches to. It waits for user approval before executing the split.

All Files

5 filesSKILL.md4.4 KBViewskill.oms.sig4.5 KBViewBENCHMARK.md2.7 KBViewevals/evals.json0.0 KBViewskill-card.md2.4 KBView
View on GitHub

Split a large pull request into multiple smaller PRs, where each PR touchesthe fewest possible CODEOWNERS reviewer groups. The goal is to reduce reviewburden: a PR that only touches megatron/core/ needs only the core reviewers,while a PR that also touches examples/, tools/, and megatron/training/pulls in many additional groups.

Answer-First Constraints

For split-planning questions, lead with these constraints before the fullworkflow:

  • Minimize CODEOWNERS reviewer groups per PR, but each resulting PR must stillbe independently mergeable and reviewable.
  • Tests travel with the production code they validate; do not split tests into aseparate PR just to reduce reviewer groups.
  • If PR B depends on symbols renamed in PR A, call out the dependency and putbackward-compatible aliases, re-exports, or shims in PR A when needed.
  • Wait for user approval before execution.
  • Execution creates draft PRs from the right base, applies file-scoped diffswith git diff upstream/main..<source-branch> -- <paths> | git apply, pushesto the user's fork, and never pushes directly to upstream.

Workflow

1. Analyze the PR

  1. Fetch the PR details: gh pr view <number> --repo NVIDIA/Megatron-LM --json title,body,headRefName,author and gh pr diff <number> --repo NVIDIA/Megatron-LM --stat. Also determine the current GitHub user with gh api user --jq .login.
  2. Parse .github/CODEOWNERS to build a mapping from file path patterns to owner groups.
  3. For each changed file in the PR, determine which CODEOWNERS groups would be required to review it.
  4. Build a summary table grouped by CODEOWNERS group, showing which files pull in which groups.
  5. Count the total number of distinct reviewer groups the PR currently requires.

2. Propose a split that minimizes reviewer groups per PR

The primary optimization goal: minimize the number of CODEOWNERS reviewer groups required for each resulting PR.

Strategy:

  1. Cluster files by their CODEOWNERS groups. Files owned by the same set of groups naturally belong together.
  2. Identify the largest cluster — this becomes the first (and usually largest) PR.
  3. Remaining files form one or more additional PRs, each ideally requiring only one or two reviewer groups.
  4. If a split creates a dependency (e.g., PR B uses symbols renamed in PR A), the dependent PR must be merged after the first. Note this explicitly.
  5. Each PR must be independently mergeable to main — no broken imports, no missing symbols. Backward-compatible aliases and re-export stubs in the first PR can make this possible.

Present the proposed split as a table:

  • PR name/description
  • Files included
  • CODEOWNERS groups required
  • Dependencies on other PRs (if any)

Wait for user approval before proceeding.

3. Execute the split (after user approval)

For each new PR:

  1. Create a new branch from the appropriate base (main, or a dependency PR's branch).
  2. Extract the relevant changes: git diff upstream/main..<source-branch> -- <file paths> | git apply.
  3. Stage, commit with a clear message, and push to the user's fork.
  4. Create the PR as a draft (per repo contributing guidelines).
  5. If the original PR needs to be narrowed in scope, confirm with the user before force-pushing.
  6. Report all PR URLs when done.

Important guidelines

  • Always create PRs as drafts and push to the user's fork, never directly to upstream.
  • Backward-compatible changes (aliases, re-exports, deprecation shims) should go in the first PR so subsequent PRs can depend on them.
  • Test files should go with the production code they test, not in a separate PR.
  • Prefer a single clean commit per split PR over replaying the original commit history.
  • If a file is hard to categorize (e.g., it touches two groups), ask the user which PR it should go in.
  • If the current GitHub user is not the author of the original PR, each new PR's description must explicitly credit the original author (e.g., "Original changes by @ in #").

All Files

0 files

Install mcore-split-pr

Download and extract the skill files to your .claude/skills/ directory.

Download ZIP

Clone the repository and copy the skill files to your project.

git clone https://github.com/NVIDIA/skills/blob/main/skills/mcore-split-pr/SKILL.md # Copy SKILL.md to your .claude/skills/ directory

Copy Copy
Quick Setup: Copy the skill folder to .claude/skills/Claude will automatically detect and use the skill
Repository nvidia/skills

Related Skills

code-simplify
Updated time July 2, 2026
requesting-code-review
Updated time June 29, 2026
Git Commit Helper
Updated time June 29, 2026
commit-standards
Updated time June 29, 2026
OR