samber/cc-skills-golang / skills/golang-troubleshooting
golang-troubleshooting
VerifiedTroubleshoot 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).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 13.0 KB |
| evals/evals.json | config | 45.0 KB |
| references/code-review-flags.md | markdown | 1.9 KB |
| references/common-go-bugs.md | markdown | 25.4 KB |
| references/compilation.md | markdown | 647 B |
| references/concurrency-debug.md | markdown | 3.0 KB |
| references/diagnostic-tools.md | markdown | 3.6 KB |
| references/methodology.md | markdown | 10.0 KB |
| references/performance-debug.md | markdown | 1.5 KB |
| references/pprof.md | markdown | 5.1 KB |
| references/production-debug.md | markdown | 3.7 KB |
| references/testing-debug.md | markdown | 3.2 KB |
references/code-review-flags.md
View on GitHub# Code Review Red Flags
If you see these in code review, flag them:
| Pattern | Why It's Bad |
| --- | --- |
| `result, _ := doSomething()` | Silent error — mystery bugs later |
| `go func() { }()` without context | Can't cancel, leaks goroutine |
| Channel without close | Goroutine leak when sender exits |
| `time.After` in hot loop | Repeated timer allocation/churn; use a reusable timer when reset semantics matter |
| Global map without mutex | Data race |
| `defer` inside hot loop | Deferred calls pile up until return |
| `json.Marshal` in hot path | Expensive, causes GC pressure |
| `for range` without `ok` check | Misses channel close |
| `var err *MyError; return err` | Interface nil gotcha |
| `http.Get` without timeout | Default client has no timeout |
| `fmt.Errorf("...: %v", err)` | Use `%w` to preserve error chain |
| `:=` shadowing outer `err` | Inner err is a new variable, outer stays nil |
| `func (c Counter) Lock()` | Value receiver copies sync types |
| `wg.Add(1)` inside goroutine | Race: Wait() may return before Add() |
| `http.Error(...)` without return | Handler keeps executing after error |
| `iota` starting at 0 for enums | Zero value ambiguous with first constant |
| `strings.Trim(s, "prefix")` | Strips char set, not substring |
| `log.Fatal(err)` in func w/ defer | `os.Exit` skips all deferred cleanup |
| `t1 == t2` for `time.Time` | Use `.Equal()` — monotonic clock differs |
| `rows, _ := db.Query(...)` no Close | Leaks database connections |
| `ch <- val` after `close(ch)` | Panics — only sender should close |
| `select { default: }` in loop | Busy loop — burns CPU without blocking |
| `int32(bigInt64)` | Silent truncation — no overflow check |
| `filepath.Join(base, userInput)` | Doesn't prevent `../` path traversal |
| `regexp.MustCompile` in handler | Recompiles every call — move to package var |
| `fallthrough` in switch | Executes next case unconditionally |
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |