kotlin-coroutines-flows
Kotlin协程与Flow在Android和KMP中的模式——结构化并发、Flow操作符、StateFlow、错误处理和测试。
Content Preview
---
name: kotlin-coroutines-flows
description: Kotlin协程与Flow在Android和KMP中的模式——结构化并发、Flow操作符、StateFlow、错误处理和测试。
origin: ECC
---
# Kotlin 协程与 Flow
适用于 Android 和 Kotlin 多平台项目的结构化并发模式、基于 Flow 的响应式流以及协程测试。
## 何时启用
* 使用 Kotlin 协程编写异步代码
* 使用 Flow、StateFlow 或 SharedFlow 实现响应式数据
* 处理并发操作(并行加载、防抖、重试)
* 测试协程和 Flow
* 管理协程作用域与取消
## 结构化并发
### 作用域层级
```
Application
└── viewModelScope (ViewModel)
└── coroutineScope { } (structured child)
├── async { } (concurrent task)
How to Use
Recommended: Install to project (local)
mkdir -p .claude/skills
curl -o .claude/skills/kotlin-coroutines-flows.md \
https://raw.githubusercontent.com/affaan-m/everything-claude-code/main/docs/zh-CN/skills/kotlin-coroutines-flows/SKILL.mdSkill is scoped to this project only. Add .claude/skills/ to your .gitignoreif you don't want to commit it.
Alternative: Clone full repo
git clone https://github.com/affaan-m/everything-claude-codeThen reference at docs/zh-CN/skills/kotlin-coroutines-flows/SKILL.md
Related Skills
kotlin-patterns
惯用的Kotlin模式、最佳实践和约定,用于构建健壮、高效且可维护的Kotlin应用程序,包括协程、空安全和DSL构建器。
kotlin-patternskotlinpatterns
by affaan-m · everything-claude-code
kotlin-testing
使用Kotest、MockK、协程测试、基于属性的测试和Kover覆盖率的Kotlin测试模式。遵循TDD方法论和地道的Kotlin实践。
kotlin-testingkotlintestingtdd
by affaan-m · everything-claude-code
kotlin-coroutines-expert
Expert patterns for Kotlin Coroutines and Flow, covering structured concurrency, error handling, and testing.
architecturekotlincoroutines
by sickn33 (Antigravity) · antigravity-awesome-skills
kotlin-specialist
Provides idiomatic Kotlin implementation patterns including coroutine concurrency, Flow stream handling, multiplatform architecture, Compose UI construction, Ktor server setup, and type-safe DSL design. Use when building Kotlin applications requiring coroutines, multiplatform development, or Android with Compose. Invoke for Flow API, KMP projects, Ktor servers, DSL design, sealed classes, suspend function, Android Kotlin, Kotlin Multiplatform.
kotlin-specialistkotlinspecialistapi
by Jeffallan · jeffallan-claude-skills