Help us improve
Share bugs, ideas, or general feedback.
From claude-resources
Concurrency patterns and pitfalls. Use when implementing parallel work, choosing sync primitives, auditing concurrent code, or reviewing for races and leaks. Pair with language-specific skill.
npx claudepluginhub deandum/claude-resources --plugin go-skillsHow this skill is triggered — by the user, by Claude, or both
Slash command
/claude-resources:concurrencyThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Don't communicate by sharing memory; share memory by communicating.
Assesses concurrency context, analyzes thread safety, detects race conditions and deadlocks in multi-threaded/async systems using Go goroutines, Rust tokio, Node.js, Python, Java, Elixir actors.
Guides writing, reviewing, and auditing concurrent Go code using goroutines, channels, select, locks, sync primitives, errgroup, singleflight, and worker pools. Detects leaks, races, and ownership issues.
Implements Go concurrency patterns using goroutines, channels, sync primitives, and context for building concurrent apps, worker pools, pipelines, and debugging race conditions.
Share bugs, ideas, or general feedback.
Don't communicate by sharing memory; share memory by communicating. Concurrency is not parallelism.
<lang>/concurrency skill)| Message Passing (channels/queues) | Shared State (locks/atomics) |
|---|---|
| Transferring ownership of data | Protecting internal state |
| Coordinating workers | Simple counter or flag |
| Distributing work | Short critical sections |
| Signaling events | Cache access |
Rule: transferring data → message passing. Protecting data → shared state.
| Pattern | Use When | Key Rule |
|---|---|---|
| Worker Pool | Fixed concurrency over a stream | Bound the worker count |
| Fan-Out/Fan-In | Independent tasks, collect results | Each task writes to unique slot |
| Pipeline | Sequential stages connected by queues | Close/signal completion through the primitive |
| Rate Limiter | Throttle operations (API, DB) | Token bucket or leaky bucket |
| Once Init | Lazy init exactly once | Safe for concurrent callers |
| Deduplication | Suppress duplicate concurrent calls | Cache stampede prevention |
| Object Pool | Reuse temp objects under pressure | Reset before return; profile first |
When reviewing concurrent code, check:
| Shortcut | Reality |
|---|---|
| "It probably won't race" | Races are non-deterministic. "Probably" means "sometimes in production." |
| "One concurrent task won't hurt" | Every unbounded task is a potential leak. Always provide a shutdown path. |
| "Message passing is always better" | Message primitives transfer ownership. Locks protect state. Pick the right tool. |
| "We'll add cancellation later" | Cancellation is architectural. Retrofitting is 10x harder than designing it in. |