standards-go-concurrency

Codify Go concurrency patterns for safe goroutine lifecycles and cancellation.

2|Updated Apr 10, 2024
One-click install
npx skills add https://github.com/gdurandvadas/dotfiles --skill standards-go-concurrency
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: standards-go-concurrency
Source: https://github.com/gdurandvadas/dotfiles/tree/main/config/opencode/skills/standards-go-concurrency
Command: npx skills add https://github.com/gdurandvadas/dotfiles --skill standards-go-concurrency

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a comprehensive set of best practices for safe and maintainable concurrency in Go, including lifecycle management of goroutines, context-aware cancellation, and clear channel ownership rules.

Core Features & Use Cases

  • Context-first cancellation, explicit goroutine ownership and lifecycle management to prevent leaks.
  • Errgroup-based fan-out/fan-in with bounded parallelism and safe pipeline patterns.
  • Documentation of thread-safety expectations and mutex discipline to avoid data races.

Quick Start

Review the Go concurrency standards and refactor critical paths to use context-aware cancellation, explicit goroutine ownership, and channel-based communication.

Frequently Asked Questions about standards-go-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?

You prevent goroutine leaks by enforcing explicit ownership and context-based cancellation. This Skill codifies lifecycle management rules to ensure every goroutine has a clear termination path, stopping leaks before they occur in concurrent Go applications.

What is the best way to handle error propagation with bounded parallelism in Go?

The best way to handle error propagation with bounded parallelism is using errgroup-based fan-out/fan-in patterns. This approach safely manages concurrent goroutines, limits parallel processing, and propagates errors back to the main routine efficiently.

How do I avoid data races when using mutexes in Go?

You avoid data races by following proper mutex discipline and documenting thread-safety expectations. These standards provide concrete requirements for mutex usage to ensure reliable, testable concurrent code without data races.

When do I need context-aware cancellation in Go channels?

You need context-aware cancellation when managing goroutine lifecycles and channel ownership. Applying context-first cancellation enables safe goroutine termination and prevents blocked channels from causing deadlocks or resource leaks.

Can I use these Go concurrency standards for code reviews?

Yes, you can apply these concurrency standards across code reviews and development tasks. They enforce concrete requirements for bounded fan-out, channel ownership, and leak prevention to evaluate and refactor critical paths reliably.