golang-benchmark
Golang benchmarking, profiling, and performance measurement. Use when writing, running, or comparing Go benchmarks, profiling hot paths with pprof,…
Troubleshoot Golang programs systematically - find and fix the root cause. Use when encountering bugs, crashes, deadlocks, races, or unexpected behavior in Go code. Covers debugging methodology, common Go pitfalls, test-driven debugging, pprof setup and capture, Delve, race
$ npx -y skills add samber/cc-skills-golang --skill golang-troubleshooting --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/golang-troubleshootingContext preview
The summary Claude sees to decide when to auto-load this skill.
Troubleshoot Golang programs systematically - find and fix the root cause. Use when encountering bugs, crashes, deadlocks, races, or unexpected behavior in Go code. Covers debugging methodology, common Go pitfalls, test-driven debugging, pprof setup and capture, Delve, race
name: golang-troubleshooting
description: "Troubleshoot Golang programs systematically - find and fix the root cause. Use when encountering bugs, crashes, deadlocks, races, or unexpected behavior in Go code. Covers debugging methodology, common Go pitfalls, test-driven debugging, pprof setup and capture, Delve, race detection, GODEBUG tracing, and production debugging. Start here for any 'something is wrong' situation. Not for interpreting profiles or benchmarking (→ See `samber/cc-skills-golang@golang-benchmark` skill), applying optimization patterns (→ See `samber/cc-skills-golang@golang-performance` skill), or designing new code (→ See `samber/cc-skills-golang@golang-safety` skill for defensive coding, `samber/cc-skills-golang@golang-concurrency` skill for concurrency design)."
user-invocable: true
license: MIT
compatibility: Designed for Claude Code, Codex or similar harness, and for projects using Golang.
metadata:
author: samber
version: "1.3.1"
openclaw:
emoji: "🔍"
homepage: https://github.com/samber/cc-skills-golang
requires:
bins:
- go
- dlv
install:
- kind: go
package: github.com/go-delve/delve/cmd/dlv@latest
bins: [dlv]
allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Bash(dlv:*) Agent WebFetch WebSearch AskUserQuestion
paths:
- "**/*.go"**Persona:** You are a Go systems debugger. You follow evidence, not intuition — instrument, reproduce, and trace root causes systematically.
**Thinking mode:** Reason as thoroughly as possible for debugging and root cause analysis — rushed reasoning leads to symptom fixes, deep thinking finds the actual root cause. On Claude Code, use `ultrathink` to trigger extended thinking explicitly.
**Orchestration mode:** Fan out the five bug-category sub-agents described in Codebase bug hunt mode for a codebase-wide bug hunt. A single-issue debug session should stay sequential; orchestration only pays off when scanning broadly for unknown bugs. On Claude Code, use `ultracode` to opt into multi-agent orchestration explicitly.
**Modes:**
**Dependencies:**
**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:
1. **Start with the Decision Tree** below to identify the symptom category and jump to the relevant section. 2. **Follow the Golden Rules** — especially: reproduce before you fix, one hypothesis at a time, find the root cause. 3. **Work through the General Debugging Methodology** step by step. Do not skip steps. 4. **Watch for Red Flags** in your own reasoning. If you catch yourself guessing at fixes without understanding the cause, stop and gather more evidence. 5. **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. 6. **Never propose a fix you cannot explain.** If you do not understand why the bug happens, say so and investigate further.
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)
**Remember:** Read the Error → Reproduce → Measure One Thing → Fix → Verify
Most Go bugs are: missing error checks, nil pointers, forgotten context cancel, unclosed resources, race conditions, or silent error swallowing.
Go error messages are precise. Read them fully before doing anything else:
AI agent skills are reusable instruction sets that extend your coding assistant with domain-specific expertise, loaded on demand so they don't bloat your context. This repository covers Go-specific skills only (language, testing, security, observability, etc.)
Golang benchmarking, profiling, and performance measurement. Use when writing, running, or comparing Go benchmarks, profiling hot paths with pprof,…
Golang CLI application development. Use when building, modifying, or reviewing a Go CLI tool — especially for command structure, flag handling, configuration…
Golang code style conventions — line length and breaking, variable declarations, control flow clarity, when comments help vs hurt. Use when writing or…
Golang concurrency design — goroutine lifecycle and leak prevention, channels and `select`, channel ownership and direction,…
Idiomatic context.Context usage in Golang — propagation through API boundaries, cancellation, timeouts and deadlines, request-scoped values,…
GitHub Actions CI/CD pipeline configuration for Golang projects — workflow files for test, lint, SAST, coverage and vulnerability-scan jobs, Dependabot and…