go-debug
БесплатноЗапускает вложенные скриптыНе проверенInteractively debug Go programs in a single context using Delve (dlv) driven through tmux. Use when a bug requires runtime inspection — stepping through code…
от Roasbeef★ 33 звезды на GitHubОб этом скилле
Go Debug
This skill drives an interactive dlv debugging session through tmux from a single context, without delegating to a subagent. The agent calls one helper script (scripts/dlv-session.sh) per dlv command and gets back just the new output, so each step is small enough to reason about.
When to Use
Reach for this skill when source reading alone is not enough:
- A bug only reproduces at runtime and the failure mode (panic, wrong value, hang) needs to be observed in flight.
- A test fails and the why is hidden — stepping into the failing line reveals state that logging would not.
- An integration test hangs, deadlocks, or behaves differently from the unit tests — attach to the process and inspect goroutines.
- A long-running server (lnd, eclair, a daemon under test) is misbehaving in a way that only shows up after warm-up. Use
attachrather than restarting under the debugger. - A concurrent bug needs goroutine-by-goroutine inspection (
goroutines,goroutine N,stack). - Stepping is wanted to confirm the exact control flow through a complex branch, not just "I think it takes this path."
Skip the skill when the bug is obvious from a grep or a unit test would be faster to write.
Prerequisites
dlvon PATH (go install github.com/go-delve/delve/cmd/dlv@latest).tmuxon PATH.- For
attachon macOS: the target process must be debuggable by the current user (typically fine for processes the user started). On Linux,ptracecapability may needsudoorkernel.yama.ptrace_scope=0.
The Helper Script
All session management goes through ~/.claude/skills/go-debug/scripts/dlv-session.sh. It manages a single active session at a time, persists state in $TMPDIR/claude-dlv/current, strips ANSI noise from output, and waits for the next (dlv) prompt after each command so output is bounded.
dlv-session.sh start <dlv args> # launch dlv, wait for first prompt
dlv-session.sh send '<dlv command>' # send one dlv command, return new output
dlv-session.sh send-raw '<text>' # send keys without waiting for a prompt
dlv-session.sh output [N] # last N lines of raw output (default 100)
dlv-session.sh status # is a session active?
dlv-session.sh stop # quit dlv, kill tmux session, clean state
send blocks until dlv prints the next (dlv) prompt or DLV_SEND_TIMEOUT (default 300s) elapses. Set DLV_SEND_TIMEOUT=600 in the environment for unusually long continue operations.
The Debugging Loop
A debugging session is a tight read–send–observe loop. After every send, read the returned output before deciding the next command — the program state may have moved in surprising ways.
- Start a session in the mode matching the bug (see Launch Modes below).
- Set breakpoints at the suspected fault site and at any choke points along the way.
continueto the first hit.- Inspect state:
print var,locals,args,stack,goroutines. - Step in (
step) or over (next) one line at a time when state diverges from expectation. - Form a hypothesis about what the program is doing wrong. Confirm it by inspecting the specific variable, slice, map key, or goroutine that the hypothesis implicates.
- Stop the session before exiting, and only then edit code.
Edit-then-debug, not edit-while-debugging: source changes are not reflected in the currently-running binary. After editing, stop and start again.
Launch Modes
debug — debug a main package
Build and run the program under the debugger. Use for reproducible crashes or wrong-output bugs.
dlv-session.sh start debug .
dlv-session.sh start debug ./cmd/myapp
dlv-session.sh start debug ./cmd/myapp -- --flag=value --other arg
Arguments after -- are forwarded to the program.
test — debug a test
Build and run a go test binary under the debugger. The most common entry point — most bugs have or can quickly get a failing test.
dlv-session.sh start test ./pkg/foo
dlv-session.sh start test ./pkg/foo -- -test.run TestSpecificCase
dlv-session.sh start test ./pkg/foo -- -test.run TestX -test.v
For a single test, always narrow with -test.run — otherwise breakpoints fire on the first matching frame from any test.
attach — attach to a running process
The most useful mode for integration tests and live services. Use when:
- An integration test launches a daemon (lnd, eclair, a microservice) as a child process and the daemon misbehaves. Find the PID (
pgrep,ps, the test's log output) and attach. - A long-running server is stuck or behaving incorrectly in a way that does not reproduce from a cold start.
- A bug only appears after specific runtime state has accumulated (cache warm-up, connections established, channels opened).
dlv-session.sh start attach <pid>
dlv-session.sh start attach <pid> ./path/to/binary
Passing the binary path is optional but speeds up symbol resolution and is
Установить go-debug в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл go-debug?
Interactively debug Go programs in a single context using Delve (dlv) driven through tmux. Use when a bug requires runtime inspection — stepping through code, examining variables, walking goroutines, attaching to a live process, or debugging a hanging integration test — rather than just reading the source. Triggers include "step through this", "set a breakpoint", "attach to the running server", "why is this goroutine stuck", "debug this failing test".
Как установить скилл go-debug?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл go-debug запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic