slowlyc/cuda-skill
Query current NVIDIA CUDA, PTX ISA, Runtime API, Driver API, Programming Guide, Best Practices, Nsight Compute, and Nsight Systems references. Use for direct CUDA C++ or PTX work, and for framework tasks only when they need NVIDIA ISA, API, architecture, or tool facts. Triggers include inline PTX, WMMA, WGMMA, TMA, tcgen05, mbarrier, fabric operations, CUDA APIs and Graphs, memory ordering, compute capability, Ampere, Hopper, Blackwell, Rubin, nsys, ncu, and compute-sanitizer.
npx skills add https://github.com/slowlyC/agent-gpu-skills --skill cuda-skill
Use this skill as the source of truth for CUDA, PTX, NVIDIA GPU architecture, and NVIDIA profiling or debugging tools. Prefer the local official-document snapshots, then verify against NVIDIA's current online documentation when a fact is version-sensitive or absent locally.
For framework-specific implementation, use the corresponding skill first:
Add this skill when those tasks require CUDA API, PTX ISA, architecture, or NVIDIA tool facts.
Resolve the directory containing this SKILL.md, then use its references/ child. Do not assume a Cursor, Claude, or Codex-specific install path.
In examples below, set a task-scoped variable to the resolved absolute path:
CUDA_REFS=/absolute/path/to/cuda-skill/references
Read MANIFEST.md before making version claims. It records the snapshot version, source URL, and document inventory.
| Question | Primary source |
|---|---|
| PTX syntax, semantics, ISA or target requirements | ptx-docs/ |
| CUDA Runtime functions, errors, and structs | cuda-runtime-docs/ |
| CUDA Driver functions, contexts, modules, VMM | cuda-driver-docs/ |
| CUDA programming model and feature behavior | cuda-guide/ |
| General CUDA optimization guidance | best-practices-guide/ |
| Nsight Compute metrics, sections, and CLI | ncu-docs/, ncu-guide.md |
| Nsight Systems tracing and CLI | nsys-docs/, nsys-guide.md |
| Correctness tools and cuda-gdb | debugging-tools.md |
| NVTX instrumentation | nvtx-patterns.md |
| Frequent performance mistakes | performance-traps.md |
The short guide files are search maps, not substitutes for the full official snapshots.
Start with file discovery. Do not load a large chapter or the whole specification when a focused page exists.
rg -l -i 'wgmma\.mma_async' "$CUDA_REFS/ptx-docs"
rg -n -C 12 'Target ISA Notes|PTX ISA Notes|wgmma\.mma_async' \
"$CUDA_REFS/ptx-docs/9-instruction-set"
rg -l 'cudaStreamSynchronize' "$CUDA_REFS/cuda-runtime-docs"
rg -l 'cuMemMap' "$CUDA_REFS/cuda-driver-docs"
rg -l -i 'thread block cluster' "$CUDA_REFS/cuda-guide"
rg -l -i 'coalesc' "$CUDA_REFS/best-practices-guide"
For PTX instructions, inspect all of the following before answering:
Keep these four layers separate:
PTX ISA version
→ virtual target accepted by the assembler
→ toolkit/compiler support
→ physical GPU capability
A documented target does not by itself prove that the local toolkit accepts it or that the current machine implements it. For unreleased or preview architectures such as Rubin, verify the current official online documentation.
Search by exact symbol first, then read the containing module and related type pages.
rg -n -C 20 'cudaErrorInvalidValue' "$CUDA_REFS/cuda-runtime-docs"
rg -n -C 25 'cudaLaunchKernelEx' "$CUDA_REFS/cuda-runtime-docs"
rg -n -C 25 'cuCtxCreate' "$CUDA_REFS/cuda-driver-docs"
rg -n -C 25 'cuMemCreate|cuMemMap' "$CUDA_REFS/cuda-driver-docs"
Check parameter lifetime, synchronization behavior, error propagation, version notes, and deprecation status. Do not infer Runtime API behavior from a similarly named Driver API function.
Minimize the reproducer, preserve the failing launch configuration, then use the narrowest correctness tool:
compute-sanitizer --tool memcheck ./program
compute-sanitizer --tool racecheck ./program
compute-sanitizer --tool initcheck ./program
compute-sanitizer --tool synccheck ./program
Use debugging-tools.md for tool options and limitations. After a fix, rerun the original workload because sanitizer execution changes scheduling and timing.
Use Nsight Systems to locate time and overlap problems, then Nsight Compute to explain one selected kernel.
nsys profile -o report ./program
nsys stats report.nsys-rep --report cuda_gpu_kern_sum
ncu --list-sets
ncu --list-sections
ncu --query-metrics
ncu --kernel-name regex:myKernel --launch-count 1 -o report ./program
Metric names, section identifiers, predefined sets, and report formats can change between releases and architectures. Discover what the active tool supports, then confirm semantics in the latest local Nsight documentation. Do not bind guidance to the machine's installed NCU version.
Base conclusions on measured evidence:
Change one hypothesis at a time and remeasure against the same baseline.
For Ampere, Hopper, Blackwell, or Rubin questions, distinguish public architecture disclosures from ISA availability. Check:
Do not identify a GPU architecture solely from a failed CUDA runtime query or a product label. Use explicit compute-capability or compilation-target evidence when available.
Always scrape into a fresh staging root. --force overwrites matching files but does not delete the output directory or unrelated files.
cd /path/to/agent-gpu-skills
uv run scrape_docs.py all \
--output-dir /tmp/cuda-docs-staging \
--force
diff -qr cuda_skill/references/ptx-docs \
/tmp/cuda-docs-staging/ptx-docs
Review version changes, page-count changes, renamed files, and representative instruction/API pages before merging. Do not remove obsolete live files without explicit user approval.
Run the repository validator after any update:
python3 scripts/validate_cuda_skill.py
State which document version supports the answer. Cite the focused local file and section when possible. If online verification was required, link the official NVIDIA page and label any inference. Avoid hardcoded performance thresholds unless they come from the user's measurements or a cited document.
Take slowlyc/cuda-skill from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.