/kotlin-concurrency-and-flow
Use when writing or reviewing Kotlin coroutine scope ownership, init launches, non-suspending launch APIs, runBlocking, cancellation, StateFlow, SharedFlow, Channel, stateIn, SharingStarted, state updates, or one-shot events.
$ npx -y skills add chrisbanes/skills --skill kotlin-concurrency-and-flow --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/kotlin-concurrency-and-flow
Context preview
The summary Claude sees to decide when to auto-load this skill.
Use when writing or reviewing Kotlin coroutine scope ownership, init launches, non-suspending launch APIs, runBlocking, cancellation, StateFlow, SharedFlow, Channel, stateIn, SharingStarted, state updates, or one-shot events.
SKILL.md
kotlin-concurrency-and-flow.SKILL.mdname: kotlin-concurrency-and-flow
description: Use when writing or reviewing Kotlin coroutine scope ownership, init launches, non-suspending launch APIs, runBlocking, cancellation, StateFlow, SharedFlow, Channel, stateIn, SharingStarted, state updates, or one-shot events.
Kotlin concurrency and Flow
Core principle
Give asynchronous work an explicit owner and lifetime, then model durable state and transient events with primitives whose delivery and replay semantics match the product contract.
Procedure
1. Identify each coroutine owner, cancellation boundary, producer, consumer, durable state, and transient event. 2. Select a scope whose lifecycle owns the work; do not retain arbitrary scopes or hide unstructured launches behind non-suspending APIs. 3. Model renderable, current data as state and imperative one-shot work as an event only when its loss and replay behavior are explicitly acceptable. 4. Choose Flow sharing and buffering semantics from the producer and consumer lifetimes rather than from a default. 5. Read the focused reference for the material concern below. 6. Finish when cancellation, restart, replay, and failure behavior are all observable from the public API and no caller must guess who owns the work.
Topic router
| Signal | Read | |---|---| | Stored `CoroutineScope`, `init { launch }`, fire-and-forget API, `runBlocking`, broad catch, or cancellation boundary | [Structured concurrency](references/structured-concurrency.md) | | `StateFlow`, `SharedFlow`, `Channel`, `stateIn`, `SharingStarted`, `.value`, state updates, sentinel values, or one-shot events | [Flow state and events](references/flow-state-events.md) | | Compose collection or UI effect handling | [Compose state and effects](../compose-state-and-effects/SKILL.md) |
RED/GREEN agent scenarios
1. RED stores a long-lived `CoroutineScope` in a service and launches from arbitrary callers. GREEN makes ownership and cancellation follow a defined lifecycle boundary. 2. Novel case: a screen needs replayable loading state and non-replayable navigation. GREEN uses distinct state and event contracts with documented delivery semantics. 3. Counterexample: a suspend function already has a caller-owned scope. GREEN does not add an internal scope merely to make the API look asynchronous.
Read more
name: kotlin-concurrency-and-flow description: Use when writing or reviewing Kotlin coroutine scope ownership, init launches, non-suspending launch APIs, runBlocking, cancellation, StateFlow, SharedFlow, Channel, stateIn, SharingStarted, state updates, or one-shot events.
Kotlin concurrency and Flow
Core principle
Give asynchronous work an explicit owner and lifetime, then model durable state and transient events with primitives whose delivery and replay semantics match the product contract.
Procedure
1. Identify each coroutine owner, cancellation boundary, producer, consumer, durable state, and transient event. 2. Select a scope whose lifecycle owns the work; do not retain arbitrary scopes or hide unstructured launches behind non-suspending APIs. 3. Model renderable, current data as state and imperative one-shot work as an event only when its loss and replay behavior are explicitly acceptable. 4. Choose Flow sharing and buffering semantics from the producer and consumer lifetimes rather than from a default. 5. Read the focused reference for the material concern below. 6. Finish when cancellation, restart, replay, and failure behavior are all observable from the public API and no caller must guess who owns the work.
Topic router
| Signal | Read | |---|---| | Stored `CoroutineScope`, `init { launch }`, fire-and-forget API, `runBlocking`, broad catch, or cancellation boundary | [Structured concurrency](references/structured-concurrency.md) | | `StateFlow`, `SharedFlow`, `Channel`, `stateIn`, `SharingStarted`, `.value`, state updates, sentinel values, or one-shot events | [Flow state and events](references/flow-state-events.md) | | Compose collection or UI effect handling | [Compose state and effects](../compose-state-and-effects/SKILL.md) |
RED/GREEN agent scenarios
1. RED stores a long-lived `CoroutineScope` in a service and launches from arbitrary callers. GREEN makes ownership and cancellation follow a defined lifecycle boundary. 2. Novel case: a screen needs replayable loading state and non-replayable navigation. GREEN uses distinct state and event contracts with documented delivery semantics. 3. Counterexample: a suspend function already has a caller-owned scope. GREEN does not add an internal scope merely to make the API look asynchronous.
A set of skills for Kotlin, Jetpack Compose, and Android development.
Repo: chrisbanes/skills
Other skills on chrisbanes-skills.
- /compose-animations
Use when writing or reviewing Jetpack Compose motion: visibility enter/exit, animating one property toward a target, color or size transitions, multiple properties from one state, switching composable content, or choosing between AnimatedVisibility, animate*AsState,
Open skill - /compose-component-design
Use when designing or reviewing reusable Jetpack Compose component APIs with modifier parameters, root layout placement, caller-provided variable content, primitive content parameters, optional content, or boolean shape flags.
Open skill - /compose-focus-navigation
Use when writing or reviewing Jetpack Compose UI for TV, keyboard, desktop, accessibility focus, D-pad navigation, FocusRequester, focusProperties, key events, or initial focus behavior.
Open skill - /compose-performance
Use when investigating Jetpack Compose recomposition cost, compiler stability reports, skippability, unstable parameters, frame-rate State reads, cross-phase snapshot back-writing, or @ReadOnlyComposable contracts.
Open skill - /compose-state-and-effects
Use when writing or reviewing Jetpack Compose state ownership, remember state, state hoisting, screen state holders, LaunchedEffect, DisposableEffect, SideEffect, Flow collection, navigation, snackbar, analytics, or focus requests.
Open skill - /compose-ui-testing-patterns
Use when writing or reviewing Jetpack Compose UI tests, screenshot tests, previews, semantics assertions, fake image loading, keyboard input, focus assertions, interaction state (hover/pressed/focused), or tests for plain state-driven UI composables.
Open skill

