← ClaudeAtlas

parallelize-independent-opslisted

Convert a sequential I/O-bound code path into bounded parallel execution using the project's concurrency primitive. Used when an endpoint, batch job, or aggregation does N independent awaits in a loop — the most common backend perf failure. Refuses to parallelize when data dependencies, transactions, or shared keys make it unsafe.
adnanmokhtar/refract · ★ 1 · AI & Automation · score 77
Install: claude install-skill adnanmokhtar/refract
# parallelize-independent-ops ## Premise Existing project primitives are the truth. Use what `ai/patterns/parallel-io.md` already declared — never introduce a new dependency without an ADR. Independence is proven, not assumed: the Step 2 checklist is mandatory. Wall-clock measurement before AND after is non-negotiable; without numbers, the change is just unverified refactoring. Refuse to ship if the "after" run doesn't beat the "before" run — revert and investigate elsewhere. Refuse to parallelize without naming the sibling code that uses the same primitive (or an ADR that establishes it). Take a sequential `await`-in-a-loop hot path and turn it into bounded parallel I/O that uses **this project's** primitive (extracted from `.claude/_extracted-codebase.md` + `.claude/_extracted-idioms.md`). Refuses unsafe transformations. This skill is the operational arm of `.claude/rules/concurrency-discipline.md` + `ai/patterns/parallel-io.md` — the rule says *what's required*, the pattern says *what it looks like in this codebase*, this skill says *how to do the conversion safely*. ## When to use - Endpoint p99 is unexplainably slow and a sequential loop is on the call stack. - New code review surfaces `for (const x of xs) await f(x)` where `f` is independent. - Refactoring a batch job / cron / queue consumer that processes items one at a time. - The user says "make this faster" and the bottleneck is wall-clock not CPU. ## When NOT to use (refuse + explain) `ai/patterns/parallel