What problem does it solve?
Prevents goroutine leaks and concurrency bugs in Go by enforcing structured concurrency, clear ownership, safe channel practices, and correct synchronization choices.
Core Features & Use Cases
- Goroutine lifecycle discipline: ensures every goroutine has a clear exit via context cancellation, done signals, or coordinated shutdown.
- Correct channel ownership and usage: sender-only channel closing, explicit channel directions, and safe send/receive patterns to avoid panics and races.
- Safe concurrency primitives selection: chooses between channels, mutex/RWMutex, atomic types, sync.Map, sync.Once/singleflight, and errgroup vs WaitGroup based on the task’s error-handling and performance needs.
- Worker pools, pipelines, and bounded concurrency guidance: supports fan-out/fan-in, pipeline stage shutdown, and recommends errgroup.SetLimit to avoid unbounded goroutine spawning.
- Review and audit support: provides a checklist to inspect PR diffs and scan codebases for missing ctx.Done() cases, improper closure, unsafe shared memory patterns, and timing pitfalls like time.After in hot loops.
Quick Start
Use this skill to review a Go PR that adds goroutines for background work by checking for goroutine leaks, missing ctx.Done() handling in select statements, and incorrect channel closing or shared-memory patterns.