Golang Concurrency Patterns
Go concurrency patterns for production services: context cancellation, errgroup, worker pools, and race avoidance.
- CCM score
- 59 of 100
- skills.sh installs
- 429
- GitHub stars
- 79
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers context-driven goroutine lifetimes, errgroup fan-out with sibling cancellation, bounded parallelism, worker pools, and pipeline stages
- Includes correct and incorrect code pairs for each pattern, plus guidance on channels versus mutexes and when to use each
- Enforces explicit goroutine shutdown conditions, sender-only channel closing, and
time.NewTickerovertime.Afterin loops - Guides verification with
go test -raceand context timeouts, and troubleshooting for deadlocks and goroutine leaks
Install
$ npx -y skills add bobmatnyc/claude-mpm-skills --skill golang-concurrency-patterns -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Go Concurrency Patterns (Production)
Overview
Go concurrency scales when goroutine lifetimes are explicit, cancellation is propagated with context.Context, and shared state is protected (channels or locks). Apply these patterns to build reliable services and avoid common failure modes: goroutine leaks, deadlocks, and data races.
Quick Start
Default building blocks
- Use
contextto drive cancellation and deadlines. - Use
errgroup.WithContextfor fan-out/fan-in with early abort. - Bound concurrency (avoid unbounded goroutines) with a semaphore or worker pool.
- Prefer immutable data; otherwise protect shared state with a mutex or make a single goroutine the owner.
Avoid
- Fire-and-forget goroutines in request handlers.
time.Afterinside hot loops.- Closing channels from the receiver side.
- Sharing mutable variables across goroutines without synchronization.
Core Concepts
Goroutine lifecycle
Treat goroutines as resources with a clear owner and shutdown condition.
✅ Correct: stop goroutines via context
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Details
- Repository
- github.com/bobmatnyc/claude-mpm-skills
- Categories
- Go, Backend & APIs
- First seen
- Jun 3, 2026
Questions
Is golang-concurrency-patterns a good Go skill for goroutine and channel work?
It sits in the Go category on Claude Marketplaces and ranks in the top 100 there, alongside golang-code-style, golang-testing, golang-error-handling, golang-design-patterns and golang-concurrency. It sets itself apart by covering context cancellation, errgroup, worker pools, bounded parallelism and fan-in/fan-out with common race and deadlock pitfalls.
How do I install the golang-concurrency-patterns skill?
Run npx -y skills add bobmatnyc/claude-mpm-skills --skill golang-concurrency-patterns -y in your project. Once installed, the agent can write race-free, cancellation-aware Go using context, errgroup, channels and bounded concurrency patterns.
What does the golang-concurrency-patterns skill help with?
It helps when implementing concurrent pipelines, background workers, fan-out/fan-in, or fixing goroutine leaks, deadlocks and data races in Go services. It explains when to use channels versus mutexes and when to choose errgroup over WaitGroup.
Does the golang-concurrency-patterns skill need any tools or accounts?
The skill lists no required tools, and its guidance uses standard Go packages such as context, sync and errgroup. Testing advice relies on the Go race detector run with go test -race.
More from bobmatnyc/claude-mpm-skills
All 154- Hono Validation429
- Digitalocean Overview428
- Digitalocean Networking425
- Openrouter424
- Digitalocean Storage423
- Golang Database Patterns423
- Shadcn Ui421
- Digitalocean Managed Databases413
- Test Driven Development412
- Verification Before Completion410
- Better Auth Authentication408
- Kubernetes407
- Kysely407
- Json Data Handling404
- Systematic Debugging402
- Api Documentation400
- Vue400
- Screenshot399
- Software Patterns392
- Nextjs V16391
- Root Cause Tracing391
- Testing Anti Patterns390
- Vercel Deployments Builds388
- Security Scanning387
Similar to Golang Concurrency Patterns
More Gogo-concurrency-patternswshobson/agents12K installsConcurrency primitives and worked patterns for Go, covering goroutines, channels, sync, and context-driven cancellation.
golang-concurrencysamber/cc-skills-golang44.7K installsGo concurrency design guide covering goroutine lifecycles, channels, sync primitives, and worker pools.
go-concurrencycxuu/golang-skills1.4K installsGo concurrency guidance covering goroutine lifetimes, channel-versus-mutex choice, and safe shared state.
golang-prosickn33/agentic-awesome-skills455 installsExpert Go 1.21+ guidance for concurrency, performance tuning, and production-ready microservices with testing and profiling.
golang-design-patternssamber/cc-skills-golang44.8K installsIdiomatic Go design patterns covering constructors, error flow, lifecycle, and architecture choices for production code.