Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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от 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 attach rather 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

  • dlv on PATH (go install github.com/go-delve/delve/cmd/dlv@latest).
  • tmux on PATH.
  • For attach on macOS: the target process must be debuggable by the current user (typically fine for processes the user started). On Linux, ptrace capability may need sudo or kernel.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.

  1. Start a session in the mode matching the bug (see Launch Modes below).
  2. Set breakpoints at the suspected fault site and at any choke points along the way.
  3. continue to the first hit.
  4. Inspect state: print var, locals, args, stack, goroutines.
  5. Step in (step) or over (next) one line at a time when state diverges from expectation.
  6. 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.
  7. 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

Полный SKILL.md на GitHub

Установить go-debug в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/dlv-commands.mdscripts/dlv-session.sh

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 запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить go-debug с