completablefuture-compositionlisted
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