ort-lint
Lint and format ONNX Runtime code. Use this skill when asked to lint, format, or check code style for C++ or Python files in ONNX Runtime.
- License 许可
- MIT
- 最近更新
- 2026-11-11
- Stars
- ★ 2.2w
- Forks
- 4.4k
01 前言 Front Matter
- name
- ort-lint
- description
- Lint and format ONNX Runtime code. Use this skill when asked to lint, format, or check code style for C++ or Python files in ONNX Runtime.
03 SKILL.md 正文
Linting and Formatting ONNX Runtime Code
ONNX Runtime uses lintrunner for both C++ (clang-format) and Python (ruff).
Setup (one-time)
pip install -r requirements-lintrunner.txt
lintrunner init
Commands
lintrunner -a # auto-fix changed files
lintrunner -a --all-files # auto-fix all files
lintrunner -a path/to/file.py path/to/other_file.cc # auto-fix specific files
lintrunner f --all-files # format Python files only
lintrunner # check without fixing (dry run)
Style rules
C++
- Google C++ Style with modifications (see
docs/Coding_Conventions_and_Standards.mdfor full details) - Max line length: 120 characters, but aim for 80 when possible
- Configured in
.clang-formatand.clang-tidy
Python
- Google Python Style Guide (extension of PEP 8)
- Max line length: 120 characters
- Configured in
pyproject.toml
Agent tips
- Activate a Python virtual environment before installing dependencies. See "Python > Virtual environment" in
AGENTS.md. - If lintrunner is not yet set up, install and initialize first (see Setup).
- Prefer
lintrunner -a(changed files only) over--all-filesunless the user asks for a full sweep.
04 同仓库更多 Skills
workspace-estimation-shared-header
Use when editing a boundary-safe shared header meant to be included by both in-tree and shared-provider/plugin-bridge code (e.g. include/onnxruntime/core/framework/workspace_requirement.h, or any future header supporting OrtKernelWorkspaceEstimateFunc / DeclareWorkspaceRequirements per issue #29775's Phase-A workspace-estimation roadmap), or when a workspace-estimation math helper needs to be callable from a future plugin EP DLL. Covers a Node forward-declaration ODR trap and the math-helper vs. graph-parsing-wrapper reuse boundary discovered while implementing PR #29811 (MatMulNBits pilot).
webgpu-local-testing
Build and run ONNX Runtime WebGPU provider tests on Linux WITHOUT a real GPU, using a software Vulkan adapter (Mesa lavapipe). Use when you need to exercise WebGPU EP kernels off-Mac — the Linux webgpu CI leg is build-only, so software Vulkan is how you actually run WebGPU correctness tests locally. SCOPE - lavapipe only validates host-side enforce/shape bugs and MatMul-free kernels; any graph containing MatMul (including the expanded-Attention node tests) crashes lavapipe and runs ONLY on macOS-arm64 Metal, which is the source of truth for those. Covers install (dnf on Azure Linux), the --use_webgpu build flag, the onnxruntime_provider_test target, VK_ICD_FILENAMES, and the lavapipe MatMul crash gotcha.
python-kwargs-setattr-security
When reviewing or fixing Python code that uses setattr() with user-controlled kwargs to configure C++ extension objects (SessionOptions, RunOptions, etc.) in ONNX Runtime. Use this to apply the allowlist pattern that prevents arbitrary file writes and other attacks via reflected property access.
ort-transformers-gpu-pytest
Run the ONNX Runtime transformers Python tests (onnxruntime/test/python/transformers) against a GPU wheel, and confirm real cuDNN/flash SDPA dispatch. Use when a transformers pytest fails with ModuleNotFoundError onnxruntime.capi, when torch's bundled CUDA/cuDNN libs shadow the ORT-built ones (wrong-version dispatch or load errors), or when you must PROVE a test exercised the cuDNN SDPA decode tier instead of silently skipping/falling back to MATH.
ort-test
Run ONNX Runtime tests. Use this skill when asked to run tests, debug test failures, or find and execute specific test cases in ONNX Runtime.
ort-release-notes
Draft ONNX Runtime release notes using preset configurations for full ORT or scoped component releases. Use when generating highlights with PR links, compiling human contributor acknowledgments from compile_contributors.py output, and applying preset path filtering.