Hugging Face Kernels is a system that lets Python libraries and applications load compute kernels directly from the Hugging Face Hub. It is used by Python and PyTorch developers who need portable kernels that can support multiple versions and build configurations. The catalogue skills help agents work with the kernels system and its kernel-building tools.
Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add huggingface/kernels --skill cuda-kernelsgit clone --depth 1 https://github.com/huggingface/kernelsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/huggingface/kernels/cuda-kernels)<a href="https://agentmods.dev/skills/huggingface/kernels/cuda-kernels"><img src="https://agentmods.dev/badge/skills/huggingface/kernels/cuda-kernels/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/huggingface/kernels/cuda-kernels"><img src="https://agentmods.dev/badge/skills/huggingface/kernels/cuda-kernels.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00120 | $0.07419 |
| Opus 5.5 | $0.00048 | $0.02968 |
| Sonnet 5.5 | $0.00024 | $0.01484 |
| Haiku 4.5 | $0.00012 | $0.00742 |
Grade A, and why
cuda-kernels scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 664 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CUDA Kernels for Diffusers & Transformers
This skill provides patterns and guidance for developing optimized CUDA kernels targeting NVIDIA GPUs (H100, A100, T4) for use with HuggingFace diffusers and transformers libraries.
Hard Constraints — Read Before Writing Any Code
Kernels MUST build with kernel-builder and meet the Kernel Hub requirements. kernel-builder compiles against the Python limited API (ABI3) so a single binary works for Python 3.9+ across versions. Several patterns that are standard in generic PyTorch-extension tutorials are therefore hard build failures here. Do not use them, even if PyTorch documentation or your training data suggests them.
Disallowed patterns — never generate these
| ❌ Never use | Why it fails | ✅ Use instead |
|---|---|---|
pybind11 in any form: #include <torch/extension.h>, #include <pybind11/...>, PYBIND11_MODULE(...), py::arg, any py:: symbol |
pybind11 is incompatible with the limited API (ABI3); the build does not compile | TORCH_LIBRARY_EXPAND in torch-ext/torch_binding.cpp (see below). Note: torch/extension.h transitively includes pybind11 — include torch/torch.h + torch/library.h instead |
Hand-written setup.py / pyproject.toml using torch.utils.cpp_extension (CUDAExtension, BuildExtension, cpp_extension.load, load_inline) |
setuptools extensions are not ABI3 and bypass build.toml; kernel-builder owns the build |
build.toml + nix run .#build-and-copy -L. For an editable dev install, generate the project files with kernel-builder create-pyproject -f — never write them by hand |
TORCH_LIBRARY(my_kernel, m), TORCH_LIBRARY_FRAGMENT(...), or TORCH_LIBRARY_IMPL(...) with a hardcoded namespace |
kernel-builder suffixes the op namespace with a per-build hash (e.g. _my_kernel_a1b2c3d); a hardcoded name never resolves |
TORCH_LIBRARY_EXPAND(TORCH_EXTENSION_NAME, ops) from the generated registration.h |
Hardcoded torch.ops.my_kernel.fn(...) calls in Python |
Same namespace mangling — the op namespace name is only known at build time | from ._ops import ops then ops.fn(...) |
Hand-written PyMODINIT_FUNC PyInit__... or any manual CPython module init |
Generated by REGISTER_EXTENSION; duplicating it breaks module loading |
REGISTER_EXTENSION(TORCH_EXTENSION_NAME) exactly once, in torch_binding.cpp |
Non-limited CPython API calls (PyArg_ParseTuple, direct PyObject* manipulation) |
Violates ABI3 | Stay within the torch C++ API: torch::Tensor, TORCH_CHECK, at::cuda::* |
Absolute imports of your own package inside torch-ext/ (from my_kernel.utils import x) |
The package directory is renamed when loaded from the Hub; absolute imports break | Relative imports only: from .utils import x, from ._ops import ops |
Runtime Python deps beyond torch (and einops if truly needed) |
Hub compliance restricts kernel dependencies; imports of numpy, triton, packaging, etc. are rejected | Standard library + torch only |
Python-side @torch.library.custom_op as the primary binding |
The op must be registered in C++ so it ships in the compiled extension | C++ registration via TORCH_LIBRARY_EXPAND; Python-side torch.library.register_fake is only for adding a fake/meta impl (see torch.compile section) |
What ships with it
15 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- manifest.txt 542 B
- references/a100-optimization-guide.md 8.1 KB
- references/diffusers-h100.md 14 KB
- references/diffusers-integration.md 9.8 KB
- references/h100-optimization-guide.md 12 KB
- references/huggingface-kernels-integration.md 15 KB
- references/kernel-templates.md 21 KB
- references/t4-optimization-guide.md 11 KB
- references/transformers-integration.md 11 KB
- references/troubleshooting.md 9.9 KB
- scripts/benchmark_example.py 20 KB runs code
- scripts/benchmark_rmsnorm.py 5.0 KB runs code
- scripts/huggingface_kernels_example.py 11 KB runs code
- scripts/ltx_kernel_injection_example.py 8.7 KB runs code
- scripts/transformers_injection_example.py 5.5 KB runs code
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 664 lines · 120 tokens per session scan A fba19d37df83
cuda-kernels is a skill published in the GitHub repository huggingface/kernels (776 stars, last pushed today), licensed Apache-2.0. It adds 120 tokens to every session and 7,419 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
ax-cpp-ai
Use when writing C++ code with axllm for named deployment profiles, generic provider clients, model selection, OpenAI-compatible calls, Responses, Gemini, Anthropic, routers, and balancers.
ax-cpp-gen
Use when writing C++ code with axllm for AxGen programs, forward calls, indexed multi-sampling, result pickers, streaming, tools, assertions, traces, usage, and output parsing.
ax-cpp-signature
Use when writing C++ code with axllm for string signatures, field descriptors, JSON schema output, validation, and typed tool argument shapes.
ax-cpp-typesafe
Use when writing C++ code with axllm for Typesafe Jev image inputs, boolean/class/rubric score/box signatures, decision evidence and provenance, native Noul/Choice/Score/Box, structured criteria and hybrid generation.
ax-cpp-gepa
Use when writing C++ code with axllm for GEPA, Pareto tradeoffs, reflection clients, metric budgets, optimizer state, and artifacts.
ax-cpp-llm
Use when writing C++ code with axllm for using the generated Ax package, factory functions, package docs, examples, and API reference.