golang-concurrency

Audit Go code for goroutine lifecycle, channel usage, and synchronization patterns.

2.9k|191|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/samber/cc-skills-golang --skill golang-concurrency
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-concurrency
Source: https://github.com/samber/cc-skills-golang/tree/main/skills/golang-concurrency
Command: npx skills add https://github.com/samber/cc-skills-golang --skill golang-concurrency

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Golang concurrency patterns help teams write correct, efficient, and maintainable concurrent code by guiding how to structure goroutines, channels, and synchronization primitives; this Skill consolidates best practices to reduce leaks, data races, and deadlocks.

Core Features & Use Cases

  • Structured concurrency guidance to ensure goroutine lifecycle management and safe shutdowns.
  • Channel and synchronization patterns including proper use of WaitGroup, errgroup, singleflight, and worker pools.
  • Go code review & debugging examples focusing on leak detection, race conditions, and ownership issues in concurrent Go code.

Quick Start

Audit a Go codebase for correct goroutine lifecycle, channel usage, and synchronization patterns according to this skill.

Frequently Asked Questions about golang-concurrency

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

FAQPage Schema
How do I prevent goroutine leaks in Go concurrent code?

Prevent goroutine leaks by applying structured concurrency patterns that ensure proper goroutine lifecycle management and safe shutdowns using context cancellation. This Skill guides correct channel ownership and synchronization to avoid orphaned goroutines blocking execution.

What is the best way to use channels and WaitGroup in Go concurrency patterns?

The best way to use channels and WaitGroup in Go concurrency patterns involves correctly scoping channel direction and applying synchronization primitives like WaitGroup or errgroup. This Skill demonstrates proper implementations to coordinate goroutines without deadlocks.

How do I detect race conditions and ownership issues in Go code?

Detect race conditions and ownership issues in Go code by auditing concurrent code against established best practices. This Skill provides code review examples focusing on identifying data races, improper channel closures, and incorrect goroutine ownership.

Why should I avoid time.After in loops for Go goroutine synchronization?

Avoid time.After in loops for Go goroutine synchronization because it can cause resource leaks by creating timers that are not garbage collected until they fire. This Skill identifies such common pitfalls and recommends proper context handling alternatives.

When do I need errgroup or singleflight for Go channel communication?

You need errgroup for managing goroutine errors and singleflight for deduplicating concurrent function calls in Go channel communication. This Skill outlines target scenarios for deploying these synchronization patterns correctly within concurrent Go projects.

Does this Skill support auditing existing Go codebases for concurrency best practices?

Yes, this Skill supports auditing existing Go codebases for correct goroutine lifecycle, channel usage, and synchronization patterns. It reviews implementations for proper context handling, channel direction, and correct use of worker pools.