mcore-split-pr
nvidia/skills
必要となるCODEOWNERSレビュアーグループの数を減らすために、1つのPRを複数のPRに分割します。
...すべて拡張しますmcore-split-prについて
mcore-split-prというスキルは、大規模なMegatron-LMのPull Requestを複数の小規模なPRに分割し、各PRができるだけ少ないCODEOWNERSレビュアーグループのみに関わるようにします。これにより、コア部分、例示コード、ツール類、トレーニングディレクトリをすべて含むPRが多くのレビュアーグループのチェックを受けてマージが遅れるという問題を解決します。一方、単一のディレクトリに限定されたPRの場合は、そのディレクトリのレビュアーのみで済みます。
このワークフローは3つのフェーズで構成されています。まず、gh CLIを使ってPRの詳細や差分統計を取得し、.github/CODEOWNERSファイルを解析してファイルのパターンと所有者グループを対応付け、現在そのPRに必要なレビュアーグループの数を数えます。次に、CODEOWNERSグループごとにファイルをまとめ、テストコードはそれらが検証する本番コードと一緒に扱い、異なるPR間の依存関係(例えば、あるPRで名前が変更されたシンボルを別のPRが参照している場合など)を特定し、各分割後のPRが独立してマージ可能であることを確認します。その後、ユーザーの承認を得るために計画内容を表形式で提示します。最後に、承認が得られた後にのみ、適切なベースブランチからブランチを作成し、git applyを使ってファイル単位の差分を適用した上でコミットし、ユーザーが作成したフォークにプッシュします。常にPRはドラフトとして作成され、上流のリポジトリに直接プッシュすることはありません。また、元のPRを絞り込むような強制プッシュを行う前には必ずユーザーの確認を得、現在のユーザーが元のPRの作成者でない場合は元の作成者にクレジットを付与します。
対象ユーザーは、規模が大きくなりすぎたPRに対応しなければならないMegatron-LMの貢献者やメンテナーで、各分割後のPRが独立してレビューやマージが可能な状態でありつつ、1つのPRあたりに必要なレビュアーグループの数を減らしたいと考えている人々です。このスキルは、PRのURLまたは番号を引数としてユーザーが呼び出す形で利用できます。
よくある質問
PRを分割することでどのような問題が解決されますか?
1つのPRに必要なCODEOWNERSレビュアーグループの数を最小限に抑えることで、レビュー作業の負担を軽減します。ただし、分割後の各PRは依然として独立してマージ可能であり、レビュー可能でなければなりません。
メインリポジトリに直接プッシュされますか?
いいえ。常にPRはドラフトとして作成され、ユーザーのフォークにプッシュされるだけで、上流のリポジトリに直接プッシュすることはありません。また、元のPRを絞り込むような強制プッシュを行う前には必ずユーザーの確認を得ます。
分割時にテストコードはどのように扱われますか?
テストファイルは、それらが検証する本番コードと一緒に扱われます。このスキルでは、レビュアーグループの数を減らすためだけにテストコードを別のPRに分割することは明確に避けています。
1つの分割後のPRが別のPRに依存している場合はどうなりますか?
依存関係は明確に示され、後続のPRがそれらを参照できるように、後方互換性のあるエイリアスや再エクスポート、シムが最初のPRに追加されます。また、必要なマージの順序も記載されます。
実行するために何が必要ですか?
リポジトリに対して認証済みのgh CLI、上流リモートが設定されたローカルのチェックアウト環境、そしてブランチをプッシュするためのユーザーのフォークが必要です。分割処理を実行する前には、必ずユーザーの承認を待ちます。
全ファイル
5ファイルSKILL.md4.4 KB表示skill.oms.sig4.5 KB表示BENCHMARK.md2.7 KB表示evals/evals.json0.0 KB表示skill-card.md2.4 KB表示
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
- Fetch the PR details:
gh pr view <number> --repo NVIDIA/Megatron-LM --json title,body,headRefName,authorandgh pr diff <number> --repo NVIDIA/Megatron-LM --stat. Also determine the current GitHub user withgh api user --jq .login. - Parse
.github/CODEOWNERSto build a mapping from file path patterns to owner groups. - For each changed file in the PR, determine which CODEOWNERS groups would be required to review it.
- Build a summary table grouped by CODEOWNERS group, showing which files pull in which groups.
- 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:
- Cluster files by their CODEOWNERS groups. Files owned by the same set of groups naturally belong together.
- Identify the largest cluster — this becomes the first (and usually largest) PR.
- Remaining files form one or more additional PRs, each ideally requiring only one or two reviewer groups.
- 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.
- 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:
- Create a new branch from the appropriate base (
main, or a dependency PR's branch). - Extract the relevant changes:
git diff upstream/main..<source-branch> -- <file paths> | git apply. - Stage, commit with a clear message, and push to the user's fork.
- Create the PR as a draft (per repo contributing guidelines).
- If the original PR needs to be narrowed in scope, confirm with the user before force-pushing.
- 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 #").
すべてのファイル
0件のファイルmcore-split-prをインストール
該当するスキルファイルをダウンロードし、.claude/skills/ ディレクトリに展開してください。
ZIPをダウンロードリポジトリをクローンし、スキルファイルをプロジェクトにコピーしてください。
git clone https://github.com/NVIDIA/skills/blob/main/skills/mcore-split-pr/SKILL.md # Copy SKILL.md to your .claude/skills/ directory
コピー





家
