go-concurrency-patterns

Standardize goroutine lifecycle management and synchronization primitive selection in Go services.

1|Updated Jun 20, 2026
One-click install
npx skills add https://github.com/shafibabar/SDLC-Artifact-Factory --skill go-concurrency-patterns-shafibabar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-concurrency-patterns
Source: https://github.com/shafibabar/SDLC-Artifact-Factory/tree/main/skills/go-concurrency-patterns
Command: npx skills add https://github.com/shafibabar/SDLC-Artifact-Factory --skill go-concurrency-patterns-shafibabar

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill eliminates common concurrency pitfalls like deadlocks, race conditions, and goroutine leaks by enforcing a strict, standardized lifecycle for all concurrent Go code.

Core Features & Use Cases

  • Goroutine Lifecycle Standard: Enforces the Owned, Bounded, and Joined checklist to prevent orphan goroutines and resource exhaustion.
  • Sync Primitive Decision Table: Provides a clear heuristic for choosing between channels, mutexes, atomics, and errgroups based on real-world usage.
  • Incident Response: Includes a comprehensive runbook for diagnosing partial deadlocks, livelocks, and starvation using pprof and chaos testing.

Quick Start

Apply the go-concurrency-patterns standard to verify that all goroutines in the current package are properly owned, bounded, and joined.

Frequently Asked Questions about go-concurrency-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent goroutine leaks and deadlocks in Go backend services?

Prevent goroutine leaks and deadlocks by enforcing an Owned, Bounded, and Joined checklist for all concurrent Go code. This standardizes goroutine lifecycle management, ensuring every process is properly owned, resource-bounded, and explicitly joined to prevent orphan routines.

When should I use channels vs mutexes vs errgroups for Go concurrency?

Select between channels, mutexes, atomics, and errgroups using a sync primitive decision table. This heuristic maps real-world concurrency usage patterns to the appropriate synchronization primitive, ensuring reliable state management and parallel processing in Go architectures.

How do I standardize goroutine lifecycle management across a Go codebase?

Standardize goroutine lifecycle management by applying a strict Owned, Bounded, and Joined checklist across your Go service architectures. This enforces a uniform lifecycle for all concurrent implementations, eliminating orphan goroutines and preventing resource exhaustion.

Do I need to run the race detector for all concurrent Go implementations?

Yes, mandatory race-detector testing is required for all concurrent Go implementations. This strict adherence ensures your parallel processing, event consumption, and high-contention state management code remains free of race conditions and reliable under load.

How do I choose synchronization primitives for high-contention state management in Go?

Choose synchronization primitives for high-contention state management by consulting a sync primitive decision table. This provides clear heuristics for selecting between channels, mutexes, atomics, and errgroups based on your specific backend concurrency requirements.