sota-async-concurrencylisted
Install: claude install-skill martinholovsky/SOTA-skills
# SOTA Async & Concurrency
## Purpose
Concurrency bugs are the most expensive class of defect: they pass tests, ship,
and then corrupt data or hang production under load. This skill encodes the
2026 state of the art for concurrent design and the bug catalog auditors need
to spot defects **by reading code**, without reproducing them. Concepts are
cross-language; per-runtime notes are inlined where semantics genuinely differ
(GIL, goroutine scheduling, tokio executors, Node's single loop).
Two operating modes. Pick one explicitly before starting.
## BUILD mode
When writing new concurrent code:
1. **Classify the workload first.** I/O-bound → async/event loop. CPU-bound →
threads (if runtime has real parallelism) or processes. Mixed → async
front-end + bounded worker pool. Read `rules/01` before choosing.
2. **Structured concurrency is the default.** Every task lives inside a scope
(TaskGroup / nursery / errgroup / JoinSet) that joins or cancels it.
Spawning a task with no owner is a design smell requiring written
justification.
3. **Bound everything.** Every queue, channel, connection pool, in-flight
request set, and spawn loop gets an explicit capacity. Unbounded = OOM with
a delay timer.
4. **Every await gets a timeout policy** — a number, or a documented reason
why it inherits one from an enclosing scope.
5. **Cancellation is a feature you build, not an exception you ignore.**
Propagate context/AbortSignal/CancelledError; clean up in finally b