The skills/ directory contains structured guides for common tasks (running
tests, building containers, managing dependencies, submitting SLURM jobs, etc.).
Always read the relevant SKILL.md before starting any task it covers —
skills are mandatory context, not optional background reading.
Workflow — mandatory order for every task:
- Pull information first. Read the commit, PR, error log, file, or whatever artifact the task is about. Do not reason about it yet.
- Select and invoke the skill. Based on what you just read, identify the relevant skill and invoke it before forming any answer or plan.
- Answer or implement. Only after the skill is loaded, use its context to reason, diagnose, or write code.
Never skip or reorder these steps. Do not wait for the user to name the right skill keyword — infer it from the artifact you read.
- All PRs must be created as drafts. Use
gh pr create --draftor the GitHub UI draft option. - Never push branches directly to
https://github.com/NVIDIA/Megatron-LM. You must push your branch to a personal fork (e.g.https://github.com/<your-username>/Megatron-LM), then open a PR from the fork's branch againstNVIDIA/Megatron-LM. - Commit PR changes with both
-sand-S:-sadds the requiredSigned-off-bytrailer, and-Ssigns the commit so copy-pr-bot and/ok to testcan verify the pushed commit without manually specifying the SHA. Megatron Core engineers at NVIDIA should sign using their NVIDIA emails so they are automatically added to the right user groups on the internal Slack workspace. - Read @docs/developer/contribute.md for the full contribution policy, including code style, commit message conventions, and issue guidelines.
- After editing imports in any Python files, always run
uv run isorton those files to fix import order before committing.
- In
megatron/coreproduction code, avoid adding new direct reads of global process groups fromparallel_state(for example,parallel_state.get_tensor_model_parallel_group()or directly importedget_*_group()helpers). Prefer accepting aProcessGroupCollectionor an explicittorch.distributed.ProcessGroupfrom the caller and passing that through. - Allowed compatibility points include
megatron/core/parallel_state.py,megatron/core/process_groups_config.py, initialization/bootstrap code that materializes aProcessGroupCollectionfrom MPU globals, tests, docs, and migration fallbacks with an explicit comment. - This guidance targets Megatron Core library code. Do not apply it to
megatron/trainingor other training-loop code unless the PR explicitly opts into that migration. - In reviews, flag new direct
parallel_state.get_*_group()usage inmegatron/coreunless it is one of the compatibility points above. This is advisory guidance, not a CI gate.