Skip to content
Mobile
Skill

/kotlin-concurrency-and-flow

Use when writing or reviewing Kotlin coroutine scope ownership, raw Thread or Executor work, init launches, non-suspending launch APIs, runBlocking, cancellation, StateFlow, SharedFlow, Channel, stateIn, SharingStarted, state updates, or one-shot events.

From plugin
skills
1.1k21 skills

Claude Code

$ npx -y skills add chrisbanes/skills --skill kotlin-concurrency-and-flow --agent claude-code

SKILL.md

kotlin-concurrency-and-flow.SKILL.md
name: kotlin-concurrency-and-flow
description: Use when writing or reviewing Kotlin coroutine scope ownership, raw Thread or Executor work, 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. Before changing an API, compare its existing caller-visible contract with the required owner and lifetime. If a suspend API already gives its caller cancellation, result, and failure ownership, finish with no change; do not add a scope, `launch`, callback, or deferred wrapper merely for convenience. 3. Select a scope whose lifecycle owns the work; do not retain arbitrary scopes or hide unstructured launches behind non-suspending APIs. 4. Model renderable, current data as state and imperative one-shot work as an event only when its loss and replay behavior are explicitly acceptable. Ask whether one consumer handles each event or every active consumer must receive it. A `Channel` hands each event to one consumer; a configured `SharedFlow` broadcasts to active consumers. If that consumer contract is unknown, state both options and the decision needed before choosing one. For a one-consumer navigation handoff that must survive a collector gap, choose a bounded `Channel(Channel.BUFFERED)` (not `UNLIMITED`) exposed as `receiveAsFlow()`; do not preserve a replay-zero `SharedFlow` after identifying event loss as the defect. 5. Choose Flow sharing and buffering semantics from the producer and consumer lifetimes rather than from a default. 6. Read the focused reference for the material concern below. 7. 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`, raw `Thread` or `Executor` work, `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) | | Running Gradle to validate a change | [Gradle run](../gradle-run/SKILL.md); never raw `./gradlew` | | Compose collection or UI effect handling | [Compose state and effects](../compose-state-and-effects/SKILL.md) |

Read more
@chrisbanes
Ships withskills

A set of skills for Kotlin, Jetpack Compose, Android development, and grounded writing. The repository is also a portable Agent Plugins and the immediate skill directories under skills/.

Stars on GitHub

Momentum

stars in total
1.1k
Star history of chrisbanes/skills on GitHub, a chart by star-history.com

Other skills on skills.

changelog

changelog

Use when updating or reviewing Unreleased changelog entries, reconciling a changelog against Git history and issue or PR…

@chrisbanes@chrisbanesInstall Skill
compose-animations

compose-animations

Use when writing or reviewing Jetpack Compose motion: visibility enter/exit, animating one property toward a target, color or…

@chrisbanes@chrisbanesInstall Skill
compose-performance

compose-performance

Use when investigating Jetpack Compose recomposition cost, compiler stability reports, skippability, unstable parameters,…

@chrisbanes@chrisbanesInstall Skill

More skills from other plugins.

deep-code-review

deep-code-review

In-depth design-focused code review - understands codebase context before evaluating PR changes, posts structured feedback to…

expo5d53k
@expo@expoInstall Skill
modlens

modlens

Plug-in vision for text-only models. Hard rule: when a file path or URL with an image extension (.png, .jpg, .jpeg, .webp, .gif,…

modlens3w4.6k
@liustack@liustackInstall Skill
appllama-app-design-skill

appllama-app-design-sk…

Build native-feeling, benchmark-quality mobile app screens (Expo / React Native). Use when designing or implementing any mobile…

appllama2mo3.9k
@appllama@appllamaInstall Skill

Questions about kotlin-concurrency-and-flow.

Which coding agents can use kotlin-concurrency-and-flow?
kotlin-concurrency-and-flow installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.