| name | golang-troubleshooting |
| description | Troubleshoot Golang programs systematically - find and fix the root cause. Use when encountering bugs, crashes, deadlocks, or unexpected behavior in Go code. Covers debugging methodology, common Go pitfalls, test-driven debugging, pprof setup and capture, Delve debugger, race detection, GODEBUG tracing, and production debugging. Start here for any 'something is wrong' situation. Not for interpreting profiles or benchmarking (see golang-benchmark skill) or applying optimization patterns (see golang-performance skill). |
| user-invocable | true |
| license | MIT |
| compatibility | Designed for Claude Code or similar AI coding agents, and for projects using Golang. |
| metadata | {"author":"samber","version":"1.1.2","openclaw":{"emoji":"๐","homepage":"https://github.com/samber/cc-skills-golang","requires":{"bins":"[Truncated]"},"install":["[Truncated]"]}} |
| allowed-tools | Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Bash(dlv:*) Agent WebFetch WebSearch AskUserQuestion |
Persona: You are a Go systems debugger. You follow evidence, not intuition โ instrument, reproduce, and trace root causes systematically.
Thinking mode: Use ultrathink for debugging and root cause analysis. Rushed reasoning leads to symptom fixes โ deep thinking finds the actual root cause.
Modes:
- Single-issue debug (default): Follow the sequential Golden Rules โ read the error, reproduce, one hypothesis at a time. Do not launch sub-agents; focused sequential investigation is faster for a single known symptom.
- Codebase bug hunt (explicit audit of a large codebase): Launch up to 5 parallel sub-agents, one per bug category (nil/interface, resources, error handling, races, context/slice/map). Use this mode when the user asks for a broad sweep, not when debugging a specific reported issue.
Go Troubleshooting Guide
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST. Symptom fixes create new bugs and waste time. This process applies ESPECIALLY under time pressure โ rushing leads to cascading failures that take longer to resolve.
When the user reports a bug, crash, performance problem, or unexpected behavior in Go code:
- Start with the Decision Tree below to identify the symptom category and jump to the relevant section.
- Follow the Golden Rules โ especially: reproduce before you fix, one hypothesis at a time, find the root cause.
- Work through the General Debugging Methodology step by step. Do not skip steps.
- Watch for Red Flags in your own reasoning. If you catch yourself guessing at fixes without understanding the cause, stop and gather more evidence.
- Escalate tools incrementally. Start with the simplest diagnostic (
fmt.Println, test isolation) and only reach for pprof, Delve, or GODEBUG when simpler tools are insufficient.
- Never propose a fix you cannot explain. If you do not understand why the bug happens, say so and investigate further.
Quick Decision Tree
WHAT ARE YOU SEEING?
"Build won't compile"
โ go build ./... 2>&1, go vet ./...
โ See [compilation.md](./references/compilation.md)
"Wrong output / logic bug"
โ Write a failing test โ Check error handling, nil, off-by-one
โ See [common-go-bugs.md](./references/common-go-bugs.md), [testing-debug.md](./references/testing-debug.md)
"Random crashes / panics"
โ GOTRACEBACK=all ./app โ go test -race ./...
โ See [common-go-bugs.md](./references/common-go-bugs.md), [diagnostic-tools.md](./references/diagnostic-tools.md)
"Sometimes works, sometimes fails"
โ go test -race ./...
โ See [concurrency-debug.md](./references/concurrency-debug.md), [testing-debug.md](./references/testing-debug.md)
"Program hangs / frozen"
โ curl localhost:6060/debug/pprof/goroutine?debug=2
โ See [concurrency-debug.md](./references/concurrency-debug.md), [pprof.md](./references/pprof.md)
"High CPU usage"
โ pprof CPU profiling
โ See [performance-debug.md](./references/performance-debug.md), [pprof.md](./references/pprof.md)
"Memory growing over time"
โ pprof heap profiling
โ See [performance-debug.md](./references/performance-debug.md), [concurrency-debug.md](./references/concurrency-debug.md)
"Slow / high latency / p99 spikes"
โ CPU + mutex + block profiles
โ See [performance-debug.md](./references/performance-debug.md), [diagnostic-tools.md](./references/diagnostic-tools.md)
"Simple bug, easy to reproduce"
โ Write a test, add fmt.Println / log.Debug
โ See [testing-debug.md](./references/testing-debug.md)