go-concurrency

Go concurrency patterns. Routes to specific patterns.

⭐2stars🔀0forks📁View on GitHub🕐Updated Dec 28, 2025⬇️1downloads

When & Why to Use This Skill

This Claude skill serves as a comprehensive technical reference for Go concurrency patterns, providing structured guidance on goroutine management, channel communication, and synchronization primitives. It helps developers architect robust, leak-free concurrent systems by offering decision trees, safety checklists, and best practices for context propagation and resource cleanup in Golang.

Use Cases

  • Designing Scalable Systems: Use the decision tree to select the most appropriate synchronization method—such as Channels for data flow or Mutexes for mutual exclusion—ensuring efficient architectural choices.
  • Preventing Resource Leaks: Apply the 'Quick Check' list during the design phase to ensure every goroutine has a defined exit path and that context cancellation is correctly implemented.
  • Code Review and Optimization: Identify and rectify common concurrency pitfalls, such as closing channels from the receiver side or improper WaitGroup counter placement, to enhance system stability.
  • Implementing Graceful Shutdowns: Utilize standardized context-based cancellation patterns to ensure all background processes in a microservice terminate correctly upon receiving stop signals.
namego-concurrency
descriptionGo concurrency patterns. Routes to specific patterns.

Concurrency

Route by Pattern

Quick Check

  • Every goroutine has exit path
  • Context passed and checked
  • Channels closed by sender only
  • WaitGroup Add before go

Common Pitfalls

  1. Launching goroutines without shutdown mechanism
  2. Not propagating context through call chains
  3. Closing channels from receiver side
  4. Using WaitGroup counter incorrectly

Decision Tree

Need coordination? → Use context for cancellation
Need data flow? → Use channels
Need to wait? → Use sync.WaitGroup
Need mutual exclusion? → Use sync.Mutex

References