Skip to content
Skills Library
Programming · Automation

mcore-split-pr

/mcore-split-pr

Split a PR into multiple PRs to reduce the number of required CODEOWNERS reviewer groups. Use when user asks to split a PR, reduce reviewer groups, or break up a large PR; 'too many CODEOWNERS', 'split this PR', 'break up PR', 'reduce reviewers needed'. Takes a PR URL or number as its argument.

Repository
megatron-lm ↗
Licence
MIT
Last repository change
27.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
5
Scripts
0
HTML comments
0
URLs in SKILL.md
1
Deprecation

No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Split a PR into multiple PRs to reduce the number of required CODEOWNERS reviewer groups. Use when user asks to split a PR, reduce reviewer groups, or break up a large PR; 'too many CODEOWNERS', 'split this PR', 'break up PR', 'reduce reviewers needed'. Takes a PR URL or number as its argument.

Triggers from the description

too many CODEOWNERSsplit this PRbreak up PRreduce reviewers needed
Original author description

Split a PR into multiple PRs to reduce the number of required CODEOWNERS reviewer groups. Use when user asks to split a PR, reduce reviewer groups, or break up a large PR; 'too many CODEOWNERS', 'split this PR', 'break up PR', 'reduce reviewers needed'. Takes a PR URL or number as its argument.

How it works

  1. Answer-First Constraints
  2. Workflow
  3. Important guidelines
Original SKILL.md headings · 86 lines, 815 words
SKILL.md preview
---
name: mcore-split-pr
description: Split a PR into multiple PRs to reduce the number of required CODEOWNERS reviewer groups. Use when user asks to split a PR, reduce reviewer groups, or break up a large PR; 'too many CODEOWNERS', 'split this PR', 'break up PR', 'reduce reviewers needed'. Takes a PR URL or number as its argument.
license: Apache-2.0
user-invocable: true
metadata:
  author: Philip Petrakian <ppetrakian@nvidia.com>
---

# Split PR by CODEOWNERS Groups

Split a large pull request into multiple smaller PRs, where each PR touches
the fewest possible CODEOWNERS reviewer groups. The goal is to reduce review
burden: 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 full
workflow:

- Minimize CODEOWNERS reviewer groups per PR, but each resulting PR must still
  be independently mergeable and reviewable.
- Tests travel with the production code they validate; do not split tests into a
  separate PR just to reduce reviewer groups.
- If PR B depends on symbols renamed in PR A, call out the dependency and put
  backward-compatible aliases, re-exports, or shims in PR A when needed.
- [GitHub's standard stacked-PR flow](https://docs.github.com/en/pull-requests/how-tos/create-pull-requests/creating-stacked-pull-requests)
  — push each branch to the upstream repo and base each PR on the previous
  branch — does not work here: contributors cannot push branches to
  `NVIDIA/Megatron-LM`, and a PR's base must be an upstream branch. The only
  upstream refs containing a fork PR's commits are the `pull-request/<N>`
  mirrors that copy-pr-bot creates, so stacking goes through them.
- Create every PR with base `main`; the `pull-request/<N>` mirror refs do not
  exist until a vetter comments `/ok to test <head-sha>` (copy-pr-bot). Once
  the mirror exists, stack a dependent PR with
  `gh pr edit <child> --base pull-request/<base PR number>`.
- Never merge a PR while its base is a `pull-request/*` ref: the squash lands
  in the bot's scratch ref, not `main`, and the PR ends up MERGED and
  unreopenable. Retarget to `main` first.
- Wait for user approval before execution.
- Execution creates draft PRs from the right base, applies file-scoped diffs
  with `git diff upstream/main..<source-branch> -- <paths> | git apply`, pushes
  to 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 local 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** with base `main` (per repo contributing guidelines). Retarget dependent PRs to `pull-request/<base PR number>` only after a vetter's `/ok to test` has created that mirror ref.
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 @<author> in #<number>").
Files in this package (5)
  • BENCHMARK.md 3 KB
  • SKILL.md 5 KB
  • skill-card.md 2 KB
  • skill.oms.sig 4 KB
  • evals/evals.json 1 KB

Versions

The database has no other skills named mcore-split-pr.

Database snapshot: 13.11.2026 · package version 5c1fa9a1eb7d (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100tt-split-pr-by-codeowners
    Decide whether a wide-ranging pull request should be broken up so each piece needs fewer CODEOWNERS approvals, and propose how. Use for 'too many reviewers on this', 'can this be broken up', 'why does this need six approvals'.
  • 100split-scripted-test
    Split a long scripted test (unittest/scripts/auto/*/scripts/*_norecord.py) into N parallel chunk groups for run_unit_tests.py, or rebalance the groups of a test that is already split, so every group takes about the same time. Use when asked to split, shard, parallelize, balance…
  • 100suggest-users
    Suggests reviewers for PRs and assignees for issues by ranking users based on CODEOWNERS match, file expertise, recent activity, and workload balancing. Use when creating PRs to suggest reviewers, creating issues to suggest assignees, or re-requesting review after addressing comments.
  • 90readme-and-co:github-templates
    This skill should be used when creating GitHub issue templates, pull request templates, CODEOWNERS files, or when user asks to "create issue template", "add PR template", "set up CODEOWNERS", "create bug report template", "add feature request form", or discusses GitHub…
  • 100wise-pr-add-reviewers
    Request human reviewers on the PR for the current branch: ask whether to add reviewers, then propose candidates (CODEOWNERS, recent authors, org members) as picks plus free-text logins. Never requests a review bot (Copilot code review, CodeRabbit). Idempotent - already-requested…
  • 100stacked-pr-splitter
    Break a large branch or pull request into a stack of small, independently reviewable and mergeable PRs, each building on the previous one, with a split plan, branch creation, per-PR descriptions and a verification step that the stack reproduces the original diff exactly. Use…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.