# Build Reliable Go Concurrency

Concurrent Go code can leak goroutines, deadlock, or mishandle cancellation. This skill provides production patterns for worker pools, pipelines, synchronization, and graceful shutdown.

## Install

```bash
npx skillstore add sickn33/go-concurrency-patterns
```

## Metadata

- Status: approved
- Slug: sickn33-go-concurrency-patterns
- Skillstore revision: r2
- Version status: missing
- Tree hash: bf5387ba523ad0720493c6d593027aede41a70dec4c93da6fa6cd02c3b6bf5d6
- Author: sickn33
- GitHub username: sickn33
- License: MIT
- Repository: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/go-concurrency-patterns
- Ref: 88a8e9a07f4c54ab105c1c41b6267c287146b07b
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: scripts, filesystem, external\_commands
- Quality score: 79
- Quality tier: bronze
- Public page: https://skillstore.pages.dev/skills/sickn33-go-concurrency-patterns
- Manifest: https://skillstore.pages.dev/api/skills/sickn33-go-concurrency-patterns/manifest

## Capabilities

- Explains goroutines, channels, select statements, mutexes, wait groups, and context cancellation.
- Designs worker pools with bounded concurrency, explicit channel ownership, and result collection.
- Builds fan-out and fan-in pipelines with cancellation-aware stages.
- Applies semaphores and errgroup limits to control concurrent workloads.
- Reviews graceful shutdown flows using signals, contexts, timeouts, and wait groups.
- Identifies common race, deadlock, channel, and goroutine lifecycle risks.

## Use Cases

- Build a Worker Pool: Create a bounded worker pool with cancellation, result handling, and clear channel ownership.
- Review Concurrent Services: Assess goroutine lifecycles, shutdown behavior, synchronization, and error propagation before release.
- Debug Race Conditions: Trace likely races, deadlocks, blocked channels, and leaks, then define focused verification steps.

## Prompt Templates

### Explain Channel Basics

```
Explain how buffered and unbuffered Go channels differ, including blocking behavior and one practical example for each.
```

### Design a Worker Pool

```
Design a cancellable Go worker pool for [job type] with [worker count] workers, bounded queues, result collection, and clear channel ownership.
```

### Review Concurrency Risks

```
Review this concurrent Go design for goroutine leaks, deadlocks, races, and cancellation gaps, then propose focused fixes and verification steps.
```

### Architect a Production Pipeline

```
Architect a Go pipeline for [workload] with fan-out, fan-in, backpressure, errgroup cancellation, graceful shutdown, and race-detector validation.
```

## Limitations

- It provides guidance and examples but does not execute, compile, benchmark, or test Go programs.
- Its examples require adaptation for application-specific workloads, latency targets, and failure policies.
- It does not replace race-detector runs, load tests, profiling, or production monitoring.
- Some examples depend on external Go modules that must be added to the project.

## Best Practices

- Give every goroutine a defined owner, exit condition, and cancellation path.
- Close channels from the sending side and document which component owns closure.
- Validate concurrent behavior with race detection, stress tests, timeouts, and representative load.

## Anti Patterns

- Do not use sleeps to coordinate goroutines or assume scheduler ordering.
- Do not launch unbounded goroutines for input that can grow without limit.
- Do not ignore context cancellation during blocking sends, receives, or external operations.

## Security Audit

- Audited at: 2026-07-24T00:24:39.975\+00:00
- Summary: All 13 static findings are false positives caused by Go syntax, example output text, function names, or Markdown backticks. The reviewed files contain educational Go concurrency guidance and no malicious commands, path traversal, dynamic code loading, reconnaissance, or prompt injection.

## Stats

- Views: 102
- Downloads: 12
- Favorites: 0
- Popularity score: 0
