sglang: Skill for Claude Code

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

debug-cuda-crash is a skill for Claude Code, Codex from sgl-project/sglang. It costs 24 tokens per session (5,261 once invoked), scanned A, original, Apache-2.0.

A debugging workflow for CUDA crashes in SGLang using kernel API logging. CUDA is the software layer used to run work on NVIDIA GPUs; the logging records inputs before a GPU operation that may crash.

In plain words
What is it for?
Investigating illegal memory access, device-side assertions, out-of-bounds errors, and numerical problems at SGLang’s attention, linear, quantization, and custom GPU-operation boundaries.
Why use it?
GPU errors can terminate a process before ordinary debug output is written. Recording tensor shapes, data types, values, and possible NaN or infinity values preserves clues about the cause.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

This is sgl-project/sglang's own configuration. It tells Claude Code and Codex how to work on sglang 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 sglang configures →

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is python3 /tmp/sglang_llm_crash.py.

About the project

SGLang is a framework for running inference for large language models and multimodal models, meaning it processes inputs to produce model outputs such as text or other media. It is used to serve and accelerate open AI models and related workloads.

sgl-project/sglang · 38,324 stars · on GitHub · sglang.io

Reuse

Borrowing it

Nothing to install: this file belongs to sgl-project/sglang. 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/sgl-project/sglang/main/.agents/skills/debug-cuda-crash/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/sgl-project/sglang

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/sgl-project/sglang/debug-cuda-crash/github.svg)](https://agentmods.dev/skills/sgl-project/sglang/debug-cuda-crash)
Your own site
<a href="https://agentmods.dev/skills/sgl-project/sglang/debug-cuda-crash"><img src="https://agentmods.dev/badge/skills/sgl-project/sglang/debug-cuda-crash/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.

agentmods 80×15 button for debug-cuda-crash

Your own site · 80×15
<a href="https://agentmods.dev/skills/sgl-project/sglang/debug-cuda-crash"><img src="https://agentmods.dev/badge/skills/sgl-project/sglang/debug-cuda-crash.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 24 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,261 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. Third-party audits
  • Snyk pass 7 Sept 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00024 $0.05261
Opus 5.5 $0.00010 $0.02104
Sonnet 5.5 $0.00005 $0.01052
Haiku 4.5 $0.00002 $0.00526

Measured 2mo ago against content hash 748f8a4449b4, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 2mo 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.

.agents/skills/debug-cuda-crash/SKILL.md · 658 lines

How it starts

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

Tutorial: Debugging CUDA Crashes with Kernel API Logging

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

Goal

When your code crashes with CUDA errors such as illegal memory access, device-side assert, out-of-bounds, or NaN/Inf, use kernel API logging to:

  • Capture input tensors BEFORE the crash occurs
  • Understand what data caused the problem
  • Track tensor shapes, dtypes, and values through the call boundary that triggered the crash
  • Detect numerical issues such as NaN, Inf, or obviously wrong shapes

Why Use Kernel API Logging?

Problem: CUDA errors often crash the program before normal debugging output is flushed.

Solution: SGLang's @debug_kernel_api decorator logs inputs before execution, so you can still see what caused the crash even after the program aborts.

What Is Covered?

The current logging coverage focuses on the highest-value kernel boundaries in SGLang:

  • Custom ops registered through register_custom_op(...)
  • External custom ops registered through register_custom_op_from_extern(...)
  • LLM attention, linear, quantization, and multi-platform wrapper entry points
  • Diffusion attention impl, linear, rotary, and custom-op wrapper entry points
  • Selected direct torch.ops.sglang.* hotspots and model-specific bypasses

This means the logging is useful for both LLM and diffusion kernel debugging, but it does not automatically cover every pure PyTorch call in the repository.

Step 1: Enable Kernel API Logging

Basic Logging (Function Names Only)

export SGLANG_KERNEL_API_LOGLEVEL=1
export SGLANG_KERNEL_API_LOGDEST=stdout

python my_script.py

Output:

================================================================================
[2026-03-19 00:47:06] SGLang Kernel API Call: RMSNorm.forward
================================================================================
[2026-03-19 00:47:06] SGLang Kernel API Call: sglang.quant_method.UnquantizedLinearMethod.apply
================================================================================
[2026-03-19 00:47:06] SGLang Kernel API Call: sglang.custom_op.fused_inplace_qknorm

Read the full file on GitHub · 658 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. 2mo ago First seen · 658 lines · 24 tokens per session scan A 748f8a4449b4

Subscribe to this mod's changes

debug-cuda-crash is a skill published in the GitHub repository sgl-project/sglang (38,324 stars, last pushed today), licensed Apache-2.0. It adds 24 tokens to every session and 5,261 once invoked, about $0.0001 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.