kotlin-coroutines-flows

Design Kotlin coroutine and Flow code with cancellation-safe behavior.

Updated Apr 9, 2026
One-click install
npx skills add https://github.com/ririnto/sinon --skill kotlin-coroutines-flows-ririnto
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: kotlin-coroutines-flows
Source: https://github.com/ririnto/sinon/tree/main/plugins/kotlin/skills/kotlin-coroutines-flows
Command: npx skills add https://github.com/ririnto/sinon --skill kotlin-coroutines-flows-ririnto

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Design Kotlin coroutine and Flow code with honest async semantics, explicit ownership, and cancellation-safe behavior.

Core Features & Use Cases

  • Guidance on when to use suspend vs Flow, ownership, and dispatchers
  • Best practices for StateFlow and SharedFlow, error handling, and common patterns
  • Real-world scenarios: one-shot operations, streaming updates, and coroutine-based backends

Quick Start

Begin with a simple suspend function that returns a single result, and introduce Flow patterns only when the contract delivers updates over time.

Frequently Asked Questions about kotlin-coroutines-flows

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
When should I use Kotlin suspend functions instead of Flow for async operations?▼

Use Kotlin suspend functions for one-shot operations returning a single result, and introduce Flow patterns only when the contract delivers updates over time. This distinction enforces honest async semantics and explicit ownership.

How do I handle structured concurrency and cancellation safely in Kotlin coroutines?▼

Apply structured concurrency rules around proper dispatchers, explicit ownership, and robust error propagation to ensure cancellation-safe behavior in Kotlin coroutines. This prevents leaked coroutines and unhandled exceptions during cancellation.

What is the best way to manage shared state with StateFlow and SharedFlow in Kotlin?▼

Follow specific best practices for StateFlow and SharedFlow, including proper error handling and avoiding common pitfalls. This ensures robust state sharing and streaming updates in coroutine-based backends.

Why does my Kotlin coroutine code fail to propagate errors correctly during cancellation?▼

Error propagation fails in Kotlin coroutines when cancellation and error handling rules are not explicitly enforced. Designing code with explicit ownership and cancellation-safe behavior ensures errors propagate correctly through suspend and Flow chains.

Does this Kotlin coroutines approach work for streaming updates in backend architectures?▼

Yes, the Kotlin coroutines and Flow approach explicitly applies to real-world scenarios including streaming updates and coroutine-based backends. It structures async semantics and shared state management for robust backend architecture.