triton-kernels

triton-kernels is a skill for Claude Code, Codex from huggingface/kernels. It costs 0 tokens per session (5,062 once invoked), scanned A, original, Apache-2.0.

A guide for writing Triton GPU kernels, which are small programs optimized for operations on graphics processors. It focuses on code that runs on both NVIDIA and AMD GPUs and covers performance tuning, numeric formats, testing, and benchmarking.

In plain words
What is it for?
Use it to develop or benchmark kernels for operations such as matrix multiplication, normalization, activation, reductions, or element-wise calculations.
Why use it?
It helps developers write kernel code that is portable, correct, and measured for speed across supported GPU types.

Skill for Claude CodeCodex

Install

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.

agentmods
npx agentmods add skills/huggingface/kernels/triton-kernels
Any agent
npx skills add huggingface/kernels --skill triton-kernels
Clone the repo
git clone --depth 1 https://github.com/huggingface/kernels

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for triton-kernels

README.md
[![agentmods](https://agentmods.dev/badge/skills/huggingface/kernels/triton-kernels.svg)](https://agentmods.dev/skills/huggingface/kernels/triton-kernels)
Your own site
<a href="https://agentmods.dev/skills/huggingface/kernels/triton-kernels"><img src="https://agentmods.dev/badge/skills/huggingface/kernels/triton-kernels.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,062 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.05062
Opus 5 $0.00000 $0.02531
Sonnet 5 $0.00000 $0.01012
Haiku 4.5 $0.00000 $0.00506

Measured 3d ago against content hash c4225b81fbdf, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

triton-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 3d ago.

The scan reads SKILL.md. This mod also ships 4 executable files (examples/fused_softmax.py, examples/skill_test_layernorm.py, scripts/benchmark_template.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

kernel-builder/skills/triton-kernels/SKILL.md · 541 lines

How it starts

The opening of the file, as written. The whole thing — 541 lines — stays where its author put it; the contents beside it link to each section on GitHub.

name triton-kernels
description Provides guidance for writing and benchmarking portable Triton kernels targeting NVIDIA and AMD GPUs. Covers core DSL patterns, @triton.autotune, numerics (fp16/bf16/fp8), masked loads, reductions, tiling, benchmarking harness, correctness testing, and integration with HuggingFace Kernels Hub (get_kernel). Vendor-neutral: points to rocm-kernels and xpu-kernels for backend-specific tuning.
disable-model-invocation false
user-invocable true
allowed-tools Read, Grep, Glob, Bash
argument-hint kernel type: softmax, matmul, rmsnorm, layernorm, activation, reduction, element-wise, autotune, benchmark, correctness, get_kernel, transformers, diffusers

Portable Triton Kernels

This skill provides patterns and guidance for developing portable, optimized Triton kernels that run on NVIDIA and AMD GPUs without modification. For backend-specific tuning, see rocm-kernels (AMD) and xpu-kernels (Intel).

When This Skill Applies

Use this skill when:

  • Writing new Triton kernels for normalization, activation, attention, or linear algebra ops
  • Deciding block sizes, num_warps, num_stages, and autotune configs
  • Handling numerics (fp32 accumulation, bf16/fp16 input/output, masked values)
  • Setting up correctness tests against a PyTorch reference
  • Benchmarking kernel throughput (GB/s or TFLOPS)
  • Publishing a Triton kernel to the HuggingFace Kernels Hub via get_kernel
  • Fusing multiple ops into a single kernel to reduce DRAM round-trips

Hard Constraints

  1. BLOCK_SIZE for reductions must cover the full reduction dimension. Use triton.next_power_of_2(dim) in the Python wrapper. Never autotune BLOCK_SIZE when it controls the reduction axis — partial rows give wrong results silently.

  2. Masked loads need a safe other value. Use other=0.0 for additive contexts (sum, dot product). Use other=float('-inf') for max-based reductions (softmax numerator). Using the wrong fill value is the #1 cause of subtle numerical bugs.

Read the full file on GitHub · 541 lines

Changes

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.

  1. 3d ago First seen · 541 lines · 0 tokens per session scan A c4225b81fbdf

Subscribe to this mod's changes

triton-kernels is a skill published in the GitHub repository huggingface/kernels (729 stars, last pushed 5d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 5,062 tokens. 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.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

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…

microsoft/vscode · 71 tokens