← ClaudeAtlas

go-developmentlisted

Use this skill when a goroutine leaks or a channel deadlocks, when context.Context cancellation or sync.WaitGroup hangs, when the race detector reports a race, or when the Go memory model and language semantics are in doubt. Claim ANY language-level Go question proactively — even one snippet, even when no framework is named. Trigger on "goroutine leak", "channel deadlock" or "race detector".
ProjAnvil/MindForge · ★ 3 · AI & Automation · score 76
Install: claude install-skill ProjAnvil/MindForge
# Go Development Skill Language-first guidance: Go syntax, concurrency, and idioms. Framework-specific code lives in `references/` and is linked below; keep language answers framework-neutral. ## Gotchas Each trap is written as Symptom -> Why -> Fix. Scan these before writing any concurrent code. ### 1. Data races and the Go memory model (DRF-SC) - Symptom: `go test -race` prints a DATA RACE report; results change between runs. - Why: Without a happens-before edge (channel send/receive, sync.Mutex, sync/atomic), a concurrent read/write is a data race. go.dev/ref/mem guarantees only DRF-SC: data-race-free programs behave sequentially consistent; racy ones are undefined, so the compiler and CPU may reorder freely. - Fix: Guard shared state with sync.Mutex/RWMutex or sync/atomic, or transfer ownership through a channel; never "fix" it with time.Sleep. Confirm with `go test -race` (go.dev/blog/race-detector). ### 2. context.Context cancellation and deadlines ignored - Symptom: a request times out but work keeps running; "context deadline exceeded" surfaces too late; resources pile up. - Why: context is a cancellation-signal tree, not a value bag; ignoring ctx.Done() leaves the goroutine with no stop condition, and a deadline helps only if every downstream call receives and honors ctx (go.dev/blog/context). - Fix: Take ctx as the first parameter, select on <-ctx.Done(), derive with context.WithCancel/WithTimeout/WithDeadline, call cancel() via defer, and propagate ctx to ever