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.md

Skill 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-code

Then reference at docs/zh-CN/skills/kotlin-coroutines-flows/SKILL.md

Related Skills