cxuu avatar

Go Concurrency

Go concurrency guidance covering goroutine lifetimes, channel-versus-mutex choice, and safe shared state.

skills.sh installs
1.4K
GitHub stars
196
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers goroutine lifetimes, channels versus mutexes, synchronous function design, and documenting thread-safety
  • Includes reference files for goroutine patterns, sync primitives, buffer pooling, and advanced worker and pipeline patterns
  • Enforces that every goroutine has a stop mechanism and that channels are unbuffered or size one unless justified
  • Designed for Go code that spawns goroutines, shares state, or fixes data races, and points to go-context for context.Context patterns

Install

$ npx -y skills add cxuu/golang-skills --skill go-concurrency -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Go Concurrency

Compatibility: Atomic examples may use standard-library typed atomics where available or go.uber.org/atomic where a project already depends on it.

Resource Routing

  • references/GOROUTINE-PATTERNS.md - Read when starting, stopping, or waiting for goroutines.
  • references/SYNC-PRIMITIVES.md - Read when choosing between mutexes, atomics, channels, and once-like primitives.
  • references/BUFFER-POOLING.md - Read when considering channel-backed or sync.Pool-style reuse.
  • references/ADVANCED-PATTERNS.md - Read for worker pools, pipelines, errgroup, and cancellation-heavy patterns.

Goroutine Lifetimes

Normative: When you spawn goroutines, make it clear when or whether they exit.

Goroutines can leak by blocking on channel sends/receives. The GC will not terminate a blocked goroutine even if no other goroutine holds a reference to the channel. Even non-leaking in-flight goroutines cause panics (send on closed channel), data races, memory issues, and resource leaks.

Core Rules

Details

Repository
github.com/cxuu/golang-skills
Category
Go
First seen
May 16, 2026

More from cxuu/golang-skills

All 20

Similar to Go Concurrency

More Go