go-concurrency-web
Installation
SKILL.md
Go Concurrency for Web Applications
Quick Reference
| Topic | Reference |
|---|---|
| Worker Pools & errgroup | references/worker-pools.md |
| Rate Limiting | references/rate-limiting.md |
| Race Detection & Fixes | references/race-detection.md |
Core Rules
- Goroutines are cheap but not free — each goroutine consumes ~2-8 KB of stack. Unbounded spawning under load leads to OOM.
- Always have a shutdown path — every goroutine you start must have a way to exit. Use
context.Context, channel closing, orsync.WaitGroup. - Prefer channels for communication — use channels to coordinate work between goroutines and signal completion.
- Use mutexes for state protection — when goroutines share mutable state, protect it with
sync.Mutex,sync.RWMutex, orsync/atomic. - Never spawn raw goroutines in HTTP handlers — use worker pools,
errgroup, or other bounded concurrency primitives.