# golang-concurrency

> Claude/Codex skill by [@samber](https://omgskills.com/library/samber/index.md) · 3.7k stars · Updated 2026-10-23

Golang concurrency design — goroutine lifecycle and leak prevention, channels and \`select\`, channel ownership and direction, \`sync.Mutex\`/\`RWMutex\`/\`sync.Map\`/\`sync.Once\`/atomics, \`errgroup\`, \`singleflight\`, worker pools, and fan-out/fan-in pipelines. Use when writing or reviewing concurrent Go code, when choosing between channels and mutexes, when protecting a shared map or counter, or when a goroutine has no clear exit. Not for defensive coding unrelated to concurrency such as nil panics, slice aliasing, or numeric overflow (→ See \`samber/cc-skills-golang@golang-safety\` skill), and not for debugging a specific hung, crashing, or racing program after the fact (→ See \`samber/cc-skills-golang@golang-troubleshooting\` skill).

Tags: agent, agent-skills, ai, antigravity, claude, claude-code, code, codex, coding, copilot, cursor, gemini, gemini-cli-extension, openclaw, opencode, plugin, skills, skillsmp, vibe-coding

## Install

```sh
git clone https://github.com/samber/cc-skills-golang /tmp/cc-skills-golang && ln -s /tmp/cc-skills-golang/skills/golang-concurrency ~/.claude/skills/golang-concurrency
```

## From README

Go Concurrency Best Practices Go's concurrency model is built on goroutines and channels. Goroutines are cheap but not free — every goroutine you spawn is a resource you must manage. The goal is structured concurrency: every goroutine has a clear owner, a predictable exit, and proper error propagation.

## Links

- HTML page: https://omgskills.com/library/samber/cc-skills-golang/golang-concurrency/
- GitHub: https://github.com/samber/cc-skills-golang
- Author: [@samber](https://omgskills.com/library/samber/index.md)

## More from this repo

- [golang-benchmark](https://omgskills.com/library/samber/cc-skills-golang/golang-benchmark/index.md) — Golang benchmarking, profiling, and performance measurement.
   - [@samber](https://omgskills.com/library/samber/index.md) · 3.7k stars
- [golang-cli](https://omgskills.com/library/samber/cc-skills-golang/golang-cli/index.md) — Golang CLI application development.
   - [@samber](https://omgskills.com/library/samber/index.md) · 3.7k stars
- [golang-code-style](https://omgskills.com/library/samber/cc-skills-golang/golang-code-style/index.md) — Golang code style conventions — line length and breaking, variable declarations, control flow clarity, when comments...
   - [@samber](https://omgskills.com/library/samber/index.md) · 3.7k stars
