Index of every page on this site: llms.txt
All skills
nvidia avatar

/mcore-linting-and-formatting

@6b75e9e
by NVIDIA Corporationnvidia/skills4.1k stars
547
Run it yourself

Linting and formatting for Megatron-LM. Covers running autoformat.sh, tools (ruff, black, isort, pylint, mypy), and code style rules.

Use this Skill: https://skilld.dev/gh/nvidia/skills/mcore-linting-and-formatting

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈41 tokens for metadata: the name and description. ≈292 when used: this file. ≈1.4k more on demand in 3 files.

Description uses 4.2% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈338 characters, or 4.2%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Linting and Formatting


Running the Formatter

Run before opening a PR:

# Check mode (no changes applied)
BASE_REF=main CHECK_ONLY=true SKIP_DOCS=false bash tools/autoformat.sh

# Fix mode
BASE_REF=main CHECK_ONLY=false bash tools/autoformat.sh

Tools invoked: black, isort, pylint, ruff, mypy.


Import Ordering

After editing imports in any Python files, always run uv run isort on those files before committing:

uv run isort <file1>.py <file2>.py

Setting Up the Linting Group

Inside the container:

uv sync --locked --only-group linting

This installs ruff, black, isort, pylint — the same tools used by tools/autoformat.sh and CI's linting job.


Code Style Rules

  • Type hints: required on all public API functions. Use X | None, not Optional[X].
  • Docstrings: Google-style on all public classes and functions.
  • Naming: follow Python conventions — snake_case for functions and variables, PascalCase for classes.
  • Line length: 119 characters (configured in pyproject.toml).
  • No bare except: always catch specific exception types.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts5mo3 checks · Risk SAFE
  • Gen Agent Trust Hub5mo

    The skill provides instructions for linting and formatting Megatron-LM code using standard tools like Ruff, Black, and Pylint. No security risks were identified.

  • Socket5mo

    No alerts

  • Snyk5mo

    Risk: LOW · No issues

Signed by skilld at 6b75e9e. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 6 months ago
metadata
{
  "author": "Philip Petrakian <ppetrakian@nvidia.com>"
}
Other metadata
when_to_use
Running linting or autoformat; fixing style violations before a PR; 'pre-commit fails', 'ruff error', 'isort', 'mypy', 'style violation', 'how do I format', 'autoformat.sh'.

README badge

README badge for nvidia/skills/mcore-linting-and-formatting