Agent skill

Debug

by LuisaGroup in LuisaGroup/LuisaCompute

Debug crashes and test failures via stack-traces, host/device logging, and DSL buffer inspection.

Apache-2.0Auto-check passedDevelopment

Install Debug

skills CLI
$ npx skills add LuisaGroup/LuisaCompute --skill debug -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install LuisaGroup/LuisaCompute debug --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/LuisaGroup/LuisaCompute.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/debug .claude/skills/debug && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
debug
GitHub stars
1.1k
Token cost
~2.3k tokens
SKILL.md length
850 words
Files
1
Skills in repo
12
Repo updated
First seen
Licence
Apache-2.0

At a glance

Debug crashes and test failures via stack-traces, host/device logging, and DSL buffer inspection.

  • Works in 8 steps: Interpreting Stack-Traces → Plan Before Fixing → When There Is No Stack-Trace → …
  • Tasks that involve Debugging
  • SKILL.md covers 1. Interpreting Stack-Traces, 2. Plan Before Fixing, 3. When There Is No Stack-Trace and 4. DSL / Device-Side Logging, plus 5 more sections
  • Calls python

What it does

Debug is an agent skill from LuisaGroup/LuisaCompute. Debug crashes and test failures via stack-traces, host/device logging, and DSL buffer inspection.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Debugging and Failing and flaky tests. It works with CUDA. The repository describes itself as: High-Performance Rendering Framework on Stream Architectures. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Debugging
  • Tasks that involve Failing and flaky tests

Example prompts

  • “/debug”

Requirements

  • Python 3

Workflow steps

8 steps, taken from the step headings in SKILL.md.

  1. Interpreting Stack-Traces
  2. Plan Before Fixing
  3. When There Is No Stack-Trace
  4. DSL / Device-Side Logging
  5. Using Buffer for DSL Debug
  6. Environment Variables for Backend Diagnosis
  7. Decision Checklist
  8. Windows Crash Debugging with scripts/debugger.py

What it can do on your machine

Read from SKILL.md and the folder at commit 0c84a1a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Debug loads about 2.3k tokens when it runs. Until then it costs about 26 tokens; SKILL.md has 850 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~26
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from LuisaGroup/LuisaCompute at commit 0c84a1a, republished under its Apache-2.0 licence (© LuisaGroup). 850 words, ~2,287 tokens.

Download SKILL.mdSave it as .claude/skills/debug/SKILL.md (or your agent's skills folder).
name
debug
description
Debug crashes and test failures via stack-traces, host/device logging, and DSL buffer inspection.

Debugging LuisaCompute

1. Interpreting Stack-Traces

When a crash or LUISA_ERROR is emitted, capture the full console output first.

What to look for:

  • Top frames — the actual fault (null dereference, assertion, backend error).
  • LuisaCompute frames — functions prefixed with luisa::, especially luisa::compute:: or luisa::dsl::.
  • Backend frames — cuda, dx, metal, cpu backend symbols tell you which path failed.
  • Last log line — often the preceding LUISA_INFO/LUISA_VERBOSE shows the dispatch or shader name that triggered the bug.

Action:

  1. Read the innermost frame (first after the crash header). This is the immediate cause.
  2. Walk upward until you hit a recognizable LuisaCompute API call (e.g., Device::compile, Stream::dispatch, Buffer::copy_from). That is the call-site.
  3. If the trace ends inside a driver/shared library, suspect (a) invalid resource usage (out-of-bounds buffer/image access), or (b) backend-specific limitation.

2. Plan Before Fixing

Once the stack-trace points to a file/line or API call, write a debug plan in this order:

  1. Hypothesis — state what you believe caused the failure in one sentence.
  2. Verification — describe the smallest code change or log addition that can confirm/disprove the hypothesis.
  3. Fix strategy — if verified, what exactly will you change.
  4. Rollback marker — note the original state so you can undo cleanly.

If the fix fails:

  • Save the failed attempt with memory.
  • Re-read the stack-trace and the saved steps. Do not repeat a failed hypothesis.
  • Pick the next most likely cause and repeat from step 1.

3. When There Is No Stack-Trace

Silent failures (hang, wrong result, test timeout) provide no trace.

Find the entry point:

  • Read CMakeLists.txt or xmake.lua near the failing target to locate the executable source file and its main().
  • Identify the test harness (e.g., test_device.h, boost::ut) and how the device is created.

Add host-side logging:

cpp
#include <luisa/core/logging.h>

// In host code (C++ runtime)
LUISA_VERBOSE("Entering {}::{}", __FILE__, __func__);
LUISA_INFO("Buffer size = {}", buf.size());
LUISA_VERBOSE_WITH_LOCATION("Dispatching kernel X");

Set log level early (before Context creation if possible):

cpp
luisa::log_level_verbose();  // or log_level_info()

Progressive narrowing:

  1. Log at the start of main() and at every major phase (context → device → stream → compile → dispatch).
  2. If the failure happens during a kernel dispatch, move to device-side logging (Section 4).
  3. If the failure is a wrong numerical result, move to buffer read-back (Section 5).

4. DSL / Device-Side Logging

Inside kernels, use device_log to emit per-thread messages. They are collected by the stream and flushed to the host callback or default logger.

Basic usage:

cpp
#include <luisa/dsl/syntax.h>
#include <luisa/dsl/sugar.h>

Kernel2D k = [&]() noexcept {
    UInt2 coord = dispatch_id().xy();
    $if (coord.x == 1) {
        device_log("hello {} {}", coord, make_float3x3());
    };
};

Custom log callback on the stream:

cpp
Stream stream = device.create_stream();
stream.set_log_callback([](luisa::string_view message) {
    LUISA_INFO("device: {}", message);
});
stream << shader().dispatch(128u, 128u) << synchronize();

Structured severity prefixes (for custom routing):

cpp
// Example pattern from test_printer_custom_callback.cpp
#define DEVICE_INFO(FMT, ...) \
    device_log(luisa::format("I" FMT) __VA_OPT__(, ) __VA_ARGS__)
#define DEVICE_WARNING(FMT, ...) \
    device_log(luisa::format("W" FMT) __VA_OPT__(, ) __VA_ARGS__)
#define DEVICE_ERROR(FMT, ...) \
    device_log(luisa::format("E" FMT) __VA_OPT__(, ) __VA_ARGS__)

stream.set_log_callback([](luisa::string_view msg) {
    if (!msg.empty()) {
        switch (msg.front()) {
            case 'I': luisa::log_info("{}", msg.substr(1)); break;
            case 'W': luisa::log_warning("{}", msg.substr(1)); break;
            case 'E': luisa::log_error("{}", msg.substr(1)); break;
            default:  luisa::log_verbose("{}", msg); break;
        }
    }
});

Important: Device logs are asynchronous. Always synchronize() the stream before assuming all logs have arrived. If a kernel hangs, the callback may never fire for logs buffered inside the failing dispatch.

5. Using Buffer for DSL Debug

When you need to inspect many values or avoid per-thread log flooding, write results into a Buffer and read back on the host.

Buffer-based inspection:

cpp
#include <luisa/core/stl/vector.h>
#include <luisa/dsl/syntax.h>
#include <luisa/dsl/sugar.h>

Buffer<float4> debug_buf = device.create_buffer<float4>(1024);

Kernel1D k = [](BufferVar<float4> out) noexcept {
    UInt idx = dispatch_id().x;
    Float4 v = make_float4(cast<float>(idx),
                           cast<float>(idx) * 2.0f,
                           cast<float>(idx) * 3.0f,
                           0.0f);
    out.write(idx, v);
};

auto shader = device.compile(k);
stream << shader(debug_buf).dispatch(1024)
       << synchronize();

// Read back
luisa::vector<float4> host(1024);
stream << debug_buf.copy_to(luisa::span{host}) << synchronize();
for (size_t i = 0; i < 8; ++i) {
    LUISA_INFO("host[{}] = {}", i, host[i]);
}

Reducer pattern for conditional values:

  • Allocate a Buffer<uint> counter at index 0.
  • In the kernel, atomically increment the counter and write the debug payload into debug_buf[counter].
  • This captures the first N interesting threads without over-allocating.
Show full SKILL.md (369 more words)Show less

6. Environment Variables for Backend Diagnosis

VariableEffect
LUISA_DUMP_SOURCE=1Dumps generated shader sources/bytecode for the active backend.
LUISA_LOG_LEVEL=verboseEquivalent to log_level_verbose() at startup.
LUISA_ENABLE_VALIDATION=1Wraps the device in the validation layer (catches API misuse, out-of-bounds accesses, etc.).
LUISA_OPTIX_VALIDATION=1Enables OptiX validation on the CUDA backend.

Use LUISA_DUMP_SOURCE=1 when you suspect a code-generation bug (wrong instruction, missing binding, incorrect type).

Where to find the dumps:

  • DirectX: hlsl_output_<name>.hlsl in the current working directory.
  • Vulkan user compute (XIR→SPIR-V path): spv_code_<name>.spvasm in the current working directory.
  • Vulkan user compute (LLVM→SPIR-V path): spv_code_llvm_<name>.spvasm.
  • Vulkan internal HLSL consumers: backend builtins/raster may dump hlsl_output_<name>.hlsl; ordinary Device::compile(Function) compute shaders must not.
  • CUDA: .cu source in the runtime .cache directory; PTX/metadata in the runtime .data directory.
  • Metal: .metal source in the runtime .cache directory.
  • Fallback/CPU: CPU backend also respects LUISA_DUMP_SOURCE and may dump intermediate sources.

The runtime directories are printed by LUISA_INFO at context creation; they default to the executable directory. When running under xmake run, dumps written directly to the current working directory will appear in the project root.

7. Decision Checklist

SymptomFirst ActionNext Action
Crash with stack-traceRead innermost + first Luisa frameHypothesize → plan → fix
Silent wrong resultAdd LUISA_INFO at host entry pointsUse buffer read-back to inspect values
Kernel dispatch hangsCheck synchronize() and stream callbackAdd minimal device_log at start of kernel
Backend compilation errorSet LUISA_DUMP_SOURCE=1Inspect generated .spvasm or .hlsl
Suspected API/resource misuseSet LUISA_ENABLE_VALIDATION=1Re-run and read validation messages
Test timeoutRead build file for target entryNarrow phase with host logging

8. Windows Crash Debugging with scripts/debugger.py

A lightweight Python debugger using Windows Debug API + DbgHelp.dll to launch an x64 executable, catch second-chance exceptions, and print a symbolic stack trace from PDB symbols.

Usage:

bash
python scripts/debugger.py <path_to_exe> [pdb_search_path] [-- <args>...]
  • Arguments after -- are forwarded to the target executable.
  • The PDB must be next to the EXE or in pdb_search_path.
  • Works on Windows x64 with Python 3.x (64-bit recommended).

Example:

bash
python scripts/debugger.py build/bin/test.exe -- --gtest_filter=MyTest

Summary

  • Stack-traces → innermost frame = cause; upward walk = call-site.
  • Always plan before editing; StepMemory saves failed attempts.
  • No trace → read CMakeLists.txt/xmake.lua, add LUISA_INFO/LUISA_VERBOSE, then device_log.
  • DSL values → prefer Buffer write + host read-back for bulk inspection; use device_log for targeted per-thread messages.
  • Backend/codegen issues → set LUISA_DUMP_SOURCE=1 to inspect generated shaders and LUISA_ENABLE_VALIDATION=1 to catch API/resource misuse.

© LuisaGroup, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/debug of LuisaGroup/LuisaCompute.

Open the folder on GitHubat commit 0c84a1a

Compare with similar skills

Debug next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Debug compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Debug this skillLuisaGroup/LuisaCompute1.1k—~2.3kAutomated safety check: PassApache-2.0
Veomni DebugByteDance-Seed/VeOmni2.2k—~2.8kAutomated safety check: PassApache-2.0
Aoti Debugpytorch/pytorch104k1 repos~1.7kAutomated safety check: PassCustom licence
Systematic Debuggingultralisp/ultralisp25851 repos~2.4kAutomated safety check: PassNone
Exposed Bug Fix WorkflowJetBrains/Exposed9.3k—~3.8kAutomated safety check: PassApache-2.0
Debug Distributed Hangsgl-project/sglang37k2 repos~2.4kAutomated safety check: PassApache-2.0

Similar skills

  • Veomni Debug

    ByteDance-Seed/VeOmni

    A skill your agent uses for ANY bug, error, crash, wrong output, loss divergence, gradient explosion, test failure, CUDA error, distributed training hang, checkpoint load failure, or unexpected…

    2.2k GitHub stars~2.8k tokensUpdated 7 days ago
    DevelopmentAuto-check passed
  • Aoti Debug

    pytorch/pytorch

    Debug AOTInductor (AOTI) errors and crashes. An agent skill from pytorch/pytorch.

    104k GitHub starsUsed in 1 repo~1.7k tokens
    DevelopmentAuto-check passed
  • Systematic Debugging

    ultralisp/ultralisp

    A skill your agent uses when encountering any bug, test failure, or unexpected behavior, before proposing fixes

    258 GitHub starsUsed in 51 repos~2.4k tokens
    DevelopmentAuto-check passed
  • Exposed Bug Fix Workflow

    JetBrains/Exposed

    Official

    Takes a GitHub or YouTrack issue for the Exposed project through reproduction, a failing test, a fix, validation and a pull request.

    9.3k GitHub stars~3.8k tokensUpdated today
    DevelopmentAuto-check passed
  • Debug Distributed Hang

    sgl-project/sglang

    Debug hanging issues in SGLang distributed inference (TP/PP/DP/EP).

    37k GitHub starsUsed in 2 repos~2.4k tokens
    DevelopmentAuto-check passed
  • Official

    Explains why editing CUTLASS fused-MHA headers in ONNX Runtime can leave stale CUDA kernels after an incremental build, and how to force and verify a real rebuild.

    22k GitHub stars~1.3k tokensUpdated today
    DevelopmentAuto-check passed

More from LuisaGroup/LuisaCompute

All 12 skills in this repo
  • Git

    LuisaGroup/LuisaCompute

    Show uncommitted changes and commit history via git. An agent skill from LuisaGroup/LuisaCompute.

    1.1k GitHub stars~544 tokensUpdated yesterday
    Auto-check passed
  • Ast

    LuisaGroup/LuisaCompute

    Manual AST construction with FunctionBuilder for kernels and callables without DSL sugar.

    1.1k GitHub stars~4.2k tokensUpdated yesterday
    Auto-check passed
  • Cmake

    LuisaGroup/LuisaCompute

    CMake build options, custom functions, and backend patterns for LuisaCompute.

    1.1k GitHub stars~2.4k tokensUpdated yesterday
    Auto-check passed
  • Cpp Style

    LuisaGroup/LuisaCompute

    C++ naming, formatting, static analysis, and RTTI rules for LuisaCompute.

    1.1k GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Hlsl

    LuisaGroup/LuisaCompute

    HLSL code generation, StringBuilder patterns, builtin headers, and DXIL embedding.

    1.1k GitHub stars~1.6k tokensUpdated yesterday
    Auto-check passed
  • Llvm Spirv

    LuisaGroup/LuisaCompute

    Experimental Vulkan AST-to-LLVM-to-SPIR-V backend, its fail-closed runtime-interface boundary, LLVM build integration, and validation path.

    1.1k GitHub stars~2.8k tokensUpdated yesterday
    Auto-check passed

Works with

Categories

Questions about Debug

What does Debug do?

Debug crashes and test failures via stack-traces, host/device logging, and DSL buffer inspection. Debug is an agent skill from LuisaGroup/LuisaCompute. Debug crashes and test failures via stack-traces, host/device logging, and DSL buffer inspection.

When should I use Debug?

Debug fits situations like: tasks that involve Debugging; tasks that involve Failing and flaky tests.

How do I install Debug in Claude Code?

Run `npx skills add LuisaGroup/LuisaCompute --skill debug -a claude-code`. Or copy the skill folder (.agents/skills/debug in LuisaGroup/LuisaCompute) into .claude/skills/debug in your project. Claude Code loads it when a task matches its description.

How do I install Debug in Codex?

Run `npx skills add LuisaGroup/LuisaCompute --skill debug -a codex`. Or copy the skill folder (.agents/skills/debug in LuisaGroup/LuisaCompute) into .agents/skills/debug in your project. Codex loads it when a task matches its description.

Can I use Debug in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add LuisaGroup/LuisaCompute --skill debug -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/debug, .gemini/skills/debug, .github/skills/debug and .opencode/skills/debug in your project.

What does Debug need to run?

Going by SKILL.md and its folder, Debug needs the command-line tools its instructions call (python). Our summary lists: Python 3.

Does Debug access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Debug safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Debug use?

Debug is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Debug use?

About 2.3k tokens (SKILL.md is roughly 9.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Debug?

Skills that share tags, products or a category with Debug: Veomni Debug (ByteDance-Seed/VeOmni, 2.2k stars), Aoti Debug (pytorch/pytorch, 104k stars), Systematic Debugging (ultralisp/ultralisp, 258 stars) and Exposed Bug Fix Workflow (JetBrains/Exposed, 9.3k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Debug?

LuisaGroup (a GitHub organization) maintains it in LuisaGroup/LuisaCompute, which has 1,051 GitHub stars. The repository holds 12 skills in this directory. The repository was last updated on October 6, 2026.

Source: LuisaGroup/LuisaCompute on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.