← ClaudeAtlas

completablefuture-compositionlisted

Design and diagnose CompletionStage graphs with explicit execution, ownership, failure, timeout, cancellation, context and admission semantics. Use when a continuation runs on an I/O thread, a branch failure disappears, allOf or anyOf has the wrong policy, a timeout leaves work running, or asynchronous fan-out overloads a dependency. Distinguishes Java 17/21 APIs from Java 25 preview structured-concurrency alternatives.
robsonkades/agent-skills · ★ 2 · Code & Development · score 75
Install: claude install-skill robsonkades/agent-skills
# CompletableFuture Composition ## Purpose Treat a `CompletableFuture` as a graph of completion dependencies, not as a lighter thread. The graph is correct only when every edge has an execution policy, every branch has an outcome owner, and the caller's deadline is connected to the underlying operation. This skill owns stage composition. Cancellation mechanics belong to `cancellation-and-interruption`; worker scheduling to `forkjoinpool-and-work-stealing`; lexical fork/join lifetimes to `structured-concurrency`. ## Investigation workflow The composition snippets use Java 17 final APIs unless labelled otherwise; ordinary virtual threads require Java 21+, and the Java 25 structured-concurrency alternative is preview. Inspect compiler release/toolchains, deployed JDK, resolved client/context libraries and actual executor configuration before applying a recipe. Do not upgrade Java, enable preview or add dependencies just to match a snippet. If graph ownership or client completion semantics are missing, request that evidence and keep the proposed fix conditional. 1. Draw nodes and edges: creation, completion, dependent stages, fan-out and terminal observation. 2. For each action, identify the executor allowed to run it. Do not infer a thread from a method name or a test run. 3. State outcome policy: propagate, recover, observe, aggregate, race, or tolerate partial failure. 4. Separate caller timeout, operation timeout and cancellation. They are different mechanisms. 5. Bo