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 agentmods add skills/huggingface/kernels/cuda-kernelsnpx skills add huggingface/kernels --skill cuda-kernelsgit clone --depth 1 https://github.com/huggingface/kernelsWhat 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 | $0.00120 | $0.07419 |
| Opus 5 | $0.00060 | $0.03710 |
| Sonnet 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 2d 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.
- 2d ago First seen · 664 lines · 120 tokens per session scan A fba19d37df83
cuda-kernels is a skill published in the GitHub repository huggingface/kernels (729 stars, last pushed 4d ago), licensed Apache-2.0. It adds 120 tokens to every session and 7,419 once invoked, about $0.0006 per session on Opus 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
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.
next-cache-components-adoption
Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…
babysit-pr
Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep…
imagegen
Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output…
cpu-profile-analysis
Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…
next-cache-components-optimizer
Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…