concurrency-management
Installation
SKILL.md
Concurrency Management
Use this skill when
- Writing safe concurrent code (threads/async)
- Managing shared state and race conditions
- Choosing async/parallel strategies
Do not use this skill when
- Single-request simple flows
- Distributed coordination (use distributed-locking)
Instructions
- Prefer immutable data and message passing over shared mutable state.
- Use structured concurrency: bounded pools, context/cancellation propagation.
- Guard shared state with the narrowest lock; prefer atomic ops.
- Avoid blocking calls inside async code (thread pool starvation).
- Define concurrency limits for fan-out and batch jobs.
- Detect and fix race conditions with stress tests and race detectors.
- Prefer task queues over unbounded spawn.