Provides rules for writing and auditing async/concurrent code across Python, JS/Node, Go, Rust, and JVM. Covers structured concurrency, cancellation, backpressure, and race condition detection.
How this skill is triggered — by the user, by Claude, or both
Slash command
/sota-skills:sota-async-concurrencyThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Concurrency bugs are the most expensive class of defect: they pass tests, ship,
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.
When writing new concurrent code:
rules/01 before choosing.When auditing existing code, you find races, deadlocks, and leaks by reading — grep is your debugger. Workflow:
create_task( / ensure_future( without a stored
handle; bare go func(; .then( with no .catch(; floating promises;
tokio::spawn whose JoinHandle is dropped.time.sleep, requests., open( , sync DB drivers,
fs.readFileSync, bcrypt.hashSync, std::thread::sleep inside async fns.async with lock: / mutex.lock() bodies containing
await / .await.Queue() with no maxsize, make(chan T) fed by fast
producers, unbounded_channel, spawn-in-loop with no semaphore.if x in d: … d[x], exists-then-create, read-modify-write
on shared counters without atomics/locks.rules/07 for the full bug catalog with signatures.| Severity | Criteria | Examples |
|---|---|---|
| CRITICAL | Data corruption, deadlock, or unbounded resource growth reachable under normal load | Lost-update race on money/state; lock-ordering deadlock on hot path; unbounded queue fed by network input |
| HIGH | Hang, leak, or wrong result under plausible (load/error/timeout) conditions | Fire-and-forget swallowing exceptions; no timeout on external call; lock held across await; blocking call on event loop |
| MEDIUM | Degraded behavior, starvation, or fragility under contention | Writer starvation on RwLock; missing jitter on retries; thundering herd on cache expiry; spurious-wakeup-unsafe condvar wait |
| LOW | Latent hazard or convention violation with no current trigger | Orphanable task that today happens to finish first; missing cancellation propagation in a path that is never cancelled yet |
Escalate one level when the affected state is money, auth, or durability.
[SEVERITY] file:line — short title
Race window / failure mode: the exact interleaving or condition (T1 does X,
T2 does Y between X and Z → consequence).
Trigger likelihood: what load/error pattern makes it fire.
Fix: concrete minimal change (primitive, bound, timeout value, scope).
| File | Read this when... |
|---|---|
rules/01-models-and-structure.md | Choosing event loop vs threads vs processes vs actors; CPU/I-O decision tree; structured concurrency, task groups, no orphaned tasks |
rules/02-correctness.md | Reasoning about data races vs race conditions, atomicity, memory ordering/visibility, TOCTOU, deadlock prevention, livelock, starvation, idempotency under retries |
rules/03-primitives.md | Picking or reviewing mutexes, RwLocks, semaphores, condition variables, channels (bounded vs unbounded), select/race, once/lazy init |
rules/04-event-loop-hygiene.md | Anything runs on an event loop: blocking calls, CPU work, offloading to pools, long-task chunking, microtask vs macrotask |
rules/05-cancellation-timeouts-shutdown.md | Timeout policy, propagating cancellation (context/AbortSignal/CancelledError), cleanup on cancel, graceful shutdown sequencing |
rules/06-backpressure-flow-control.md | Queues between components, producer/consumer rate mismatch, load shedding, token buckets, pull-based streaming |
rules/07-audit-bug-catalog.md | AUDIT mode: the signature, severity, and fix for every common async bug — fire-and-forget, missing await, lock-across-await, retry storms, thundering herd, unbounded spawns |
while not pred: wait()), and shutdown follows the sequence: stop accepting → drain with
deadline → cancel stragglers → release resources.npx claudepluginhub martinholovsky/sota-skills --plugin sota-skillsPrevents silent decimal mismatch bugs across EVM chains with runtime lookup, chain-aware caching, and safe normalization for bots, dashboards, and DeFi tools.