flashinfer: Skill for Claude Code

.claude/skills/debug-cuda-crash/SKILL.md

debug-cuda-crash is a skill for Claude Code from flashinfer-ai/flashinfer. It costs 14 tokens per session (3,612 once invoked), scanned A, original, Apache-2.0.

A tutorial for diagnosing CUDA crashes, which are failures in programs running work on NVIDIA graphics processors, using FlashInfer API logging.

In plain words
What is it for?
Use it to capture function calls and tensor inputs before a crash, trace tensor metadata, and identify issues such as invalid memory access, wrong shapes, NaN values, or infinity values.
Why use it?
CUDA failures can end the program before useful details are shown; logging inputs before a call helps reveal the data, shapes, types, and values involved.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions CLAUDE.md.

This is flashinfer-ai/flashinfer's own configuration. It tells Claude Code how to work on flashinfer itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything flashinfer configures →

About the project

FlashInfer is a library and kernel generator that supplies GPU operations used to run large language model inference, including attention, matrix multiplication, and mixture-of-experts computations. It helps engineers build and optimize LLM serving systems across supported GPU hardware and backend implementations. Its catalogue add-ons provide skills and instructions for working with FlashInfer.

flashinfer-ai/flashinfer · 6,340 stars · on GitHub · flashinfer.ai

Reuse

Borrowing it

Nothing to install: this file belongs to flashinfer-ai/flashinfer. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/flashinfer-ai/flashinfer/main/.claude/skills/debug-cuda-crash/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/flashinfer-ai/flashinfer

Made for: Claude Code.

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 debug-cuda-crash

README.md
[![agentmods](https://agentmods.dev/badge/skills/flashinfer-ai/flashinfer/debug-cuda-crash.svg)](https://agentmods.dev/skills/flashinfer-ai/flashinfer/debug-cuda-crash)
Your own site
<a href="https://agentmods.dev/skills/flashinfer-ai/flashinfer/debug-cuda-crash"><img src="https://agentmods.dev/badge/skills/flashinfer-ai/flashinfer/debug-cuda-crash.svg" alt="Measured on agentmods" height="20"></a>
Per session 14 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,612 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00014 $0.03612
Opus 5 $0.00007 $0.01806
Sonnet 5 $0.00003 $0.00722
Haiku 4.5 $0.00001 $0.00361

Measured 7d ago against content hash d0b39248d13e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

debug-cuda-crash 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 7d 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.

.claude/skills/debug-cuda-crash/SKILL.md · 575 lines

How it starts

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

Tutorial: Debugging CUDA Crashes with API Logging

This tutorial shows you how to debug CUDA crashes and errors in FlashInfer using the @flashinfer_api logging decorator.

Goal

When your code crashes with CUDA errors (illegal memory access, out-of-bounds, NaN/Inf), use API logging to:

  • Capture input tensors BEFORE the crash occurs
  • Understand what data caused the problem
  • Track tensor shapes, dtypes, and values through your pipeline
  • Detect numerical issues (NaN, Inf, wrong shapes)

Why Use API Logging?

Problem: CUDA errors often crash the program, leaving no debugging information.

Solution: FlashInfer's @flashinfer_api decorator logs inputs BEFORE execution, so you can see what caused the crash even after the program terminates.

Step 1: Enable API Logging

Basic Logging (Function Names Only)

export FLASHINFER_LOGLEVEL=1        # Log function names
export FLASHINFER_LOGDEST=stdout    # Log to console

python my_script.py

Output:

[2025-12-18 10:30:45] FlashInfer API Call: batch_decode_with_padded_kv_cache

Detailed Logging (Inputs/Outputs with Metadata)

export FLASHINFER_LOGLEVEL=3        # Log inputs/outputs with metadata
export FLASHINFER_LOGDEST=debug.log # Save to file

python my_script.py

Output in debug.log:

================================================================================
[2025-12-18 10:30:45] FlashInfer API Logging - System Information
================================================================================
FlashInfer version: 0.6.0
CUDA toolkit version: 12.1
GPU 0: NVIDIA H100 PCIe
  Compute capability: 9.0 (SM90)
PyTorch version: 2.1.0
================================================================================

================================================================================
[2025-12-18 10:30:46] FlashInfer API Call: batch_decode_with_padded_kv_cache
--------------------------------------------------------------------------------
Positional input arguments:
  arg[0]:
    Tensor(
      shape=(32, 8, 128)
      dtype=torch.bfloat16
      device=cuda:0
      requires_grad=False
      is_contiguous=True
    )
Keyword input arguments:
  kv_cache=
    Tensor(
      shape=(1024, 2, 8, 128)
      dtype=torch.bfloat16
      device=cuda:0
      requires_grad=False
      is_contiguous=True
    )

Read the full file on GitHub · 575 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. 7d ago First seen · 575 lines · 14 tokens per session scan A d0b39248d13e

Subscribe to this mod's changes

debug-cuda-crash is a skill published in the GitHub repository flashinfer-ai/flashinfer (6,340 stars, last pushed yesterday), licensed Apache-2.0. It adds 14 tokens to every session and 3,612 once invoked, about $0.0001 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.

Related

Other skills, from other repositories

perf-analyze

Launch and operate this repo's perf-analyze workflow, which DIAGNOSES a TensorRT-LLM serving deployment without applying changes — benchmark at one concurrency or a Pareto curve of them (tok/s/user vs tok/s/gpu), analytical SOL projection on by default (via the internal-perf-sol-analysis skill), nsys + torch-profiler…

NVIDIA/TensorRT-LLM · 163 tokens

cuda-kernel-optimizer

Use when optimizing or diagnosing GPU workload performance with CUDA, CUTLASS, Triton, PyTorch, vLLM or TensorRT-LLM; interpreting NCU, Nsys or PyTorch Profiler evidence; or preparing the workload and correctness checks for such optimization. General coding, skill maintenance and conceptual GPU questions do not…

troycheng/cuda-kernel-optimizer · 77 tokens

gpu-server-setup

Prepare a Linux server with NVIDIA GPUs for neural-network and LLM workloads, or diagnose one that misbehaves. Use when the user asks to set up or prepare a GPU server, install NVIDIA drivers or CUDA on Debian/Ubuntu, wire Docker to GPUs (NVIDIA Container Toolkit), deploy vLLM / Infinity / OpenWebUI / Ollama /…

EvilFreelancer/gpu-server-setup · 167 tokens

sglang-diffusion-benchmark-profile

Use when benchmarking denoise latency or profiling a diffusion bottleneck in SGLang.

sgl-project/sglang · 26 tokens

test-amplification

Methodical bug-driven test amplification for pygraphistry features. Use when hardening a feature area via user-workflow exploration, 5-Whys retrospectives, bug-taxonomy derivation, concrete test planning, implementation, and safety-gated validation.

graphistry/pygraphistry · 56 tokens

neuron-debugger

Debug and monitor Neuron AI applications with Inspector APM, event observability, logging, and performance analysis. Use this skill whenever the user mentions debugging, monitoring, observability, performance analysis, tracing, Inspector, or needs to understand why an agent is behaving a certain way. Also trigger for…

neuron-core/neuron-ai · 90 tokens