From vanguard-frontier-agentic
Statically reviews Kotlin coroutine and Flow reliability: structured concurrency, cancellation cooperation, dispatcher selection, hot/cold Flow semantics, and context propagation across suspension.
How this skill is triggered — by the user, by Claude, or both
Slash command
/vanguard-frontier-agentic:kotlin-coroutines-flow-reliabilityThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill decides whether Kotlin coroutine and Flow code is safe to ship. A design is safe only when every launch has a cancellation-owning scope, cancellation is cooperative and `CancellationException` is always rethrown, blocking work is confined to an I/O dispatcher, Flow hot/cold and sharing semantics match the delivery guarantee, and context that must survive suspension is explicitly brid...
This skill decides whether Kotlin coroutine and Flow code is safe to ship. A design is safe only when every launch has a cancellation-owning scope, cancellation is cooperative and CancellationException is always rethrown, blocking work is confined to an I/O dispatcher, Flow hot/cold and sharing semantics match the delivery guarantee, and context that must survive suspension is explicitly bridged across dispatcher switches.
java-concurrency-and-virtual-thread-agent.java-transaction-and-consistency-agent.kotlin-test-architecture-agent.CancellationException that is not rethrown breaks structured cancellation and orphans child coroutines; treat any catch (e: Exception) / catch (e: Throwable) around suspending code that does not rethrow CancellationException as a defect.Thread.sleep, blocking file/network I/O, .get()/.join()) on Dispatchers.Default, Dispatchers.Main, or an unspecified dispatcher is a reliability defect; require Dispatchers.IO (or a bounded custom dispatcher) via withContext, and flag Main-thread blocking as an ANR/deadlock risk.@Transactional is bound to a ThreadLocal; when the annotated work spans a suspend function or a withContext dispatcher switch the transaction context can be lost, silently splitting the unit of work. Require the transaction to be opened and committed within a single confined context, or a reactive/coroutine-aware transaction operator, and mark any unverifiable claim as needing runtime confirmation.runBlocking in production code (a request handler, a suspend function, a library API) blocks the calling thread and defeats concurrency; accept it only as a main-function or test bridge and flag every other use.GlobalScope.launch (or a hand-rolled scope with no lifecycle owner) leaks work that outlives its caller and cannot be cancelled; require a lifecycle-bound scope (e.g. viewModelScope, the Ktor application scope, an explicitly cancelled CoroutineScope).SharedFlow/StateFlow or launching a coroutine without a cancellation owner leaks the collector; require the collection to be bound to a scope that is cancelled when the consumer goes away.StateFlow conflates and replays only the latest value, so intermediate emissions are dropped; if every event must be delivered, require a SharedFlow with an explicit replay/buffer or a Channel, and flag a StateFlow used as an event bus.SharedFlow/buffer with an unbounded or DROP_OLDEST/DROP_LATEST strategy silently loses events under load; require the overflow strategy to match the delivery guarantee the caller claims.asContextElement, MDCContext, OpenTelemetry context element); flag suspending code that reads such context after a withContext without the bridge.Load these only when needed:
npx claudepluginhub raishin/vanguard-frontier-agentic --plugin vanguard-frontier-agenticDetects Kotlin coroutine concurrency bugs — GlobalScope leaks, runBlocking in suspend, missing Flow catch, wrong dispatchers, cancellation mistakes — and guides on making async code testable.
Reviews Kotlin coroutine code for structured concurrency violations: stored CoroutineScope, init-block launches, runBlocking misuse, and silent-cancellation bugs.
Reviews and fixes Kotlin Coroutines issues in Android codebases: ANR, memory leaks, lifecycle safety, scope management, and structured concurrency.