# kotlin-coroutines-expert

This skill guides Claude Code through Kotlin Coroutines and Flow, from coordinating concurrent work to handling failures and testing asynchronous functions. Use it when debugging cancellation or building reactive data streams.

- skill · `type=skill` · Claude Code · 53 installs
- Author: davila7
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/skills/development/kotlin-coroutines-expert
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/skills/kotlin-coroutines-expert

## What it does

The skill provides coding guidance for coordinating concurrent operations with `coroutineScope` and `supervisorScope`, handling exceptions, and managing coroutine lifetimes. It also explains when `StateFlow` fits persistent UI state and when `SharedFlow` suits event delivery. Examples cover transformations that connect search queries to repository calls.

For tests, the guidance focuses on `runTest`, `TestScope`, and injecting `TestDispatcher` so virtual time can be controlled. Blocking I/O operations are directed to `Dispatchers.IO`. Cancellation needs care: swallowing `CancellationException` instead of rethrowing it can interfere with the expected cancellation behavior.

Designed for Claude Code projects using Kotlin Coroutines and Flow, the skill supplies patterns and code examples for reviewing asynchronous logic. It does not replace executing tests against the actual project. Avoiding `GlobalScope` is one of its recommendations, since detached coroutine work can cause resource leaks.

## Install

### Claude Code (native platform)

1. **claude-code-templates**
```bash
npx claude-code-templates@latest --skill development/kotlin-coroutines-expert
```

2. **Skills CLI (Vercel)**
```bash
npx skills add davila7/claude-code-templates --skill kotlin-coroutines-expert -a claude-code
```

3. **Manually: put the files in place**
- File: `~/.claude/skills/kotlin-coroutines-expert/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/kotlin-coroutines-expert/

### Codex

**Manually: put the files in place**
- File: `.agents/skills/kotlin-coroutines-expert/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

**Manually: put the files in place**
- File: `.cursor/skills/kotlin-coroutines-expert/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install davila7/claude-code-templates kotlin-coroutines-expert
```

2. **Manually: put the files in place**
- File: `.github/skills/kotlin-coroutines-expert/SKILL.md`

### Gemini CLI

**Platform CLI**
```bash
gemini skills install https://github.com/davila7/claude-code-templates --path cli-tool/components/skills/development/kotlin-coroutines-expert
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/kotlin-coroutines-expert/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/davila7/claude-code-templates/tree/HEAD/cli-tool/components/skills/development/kotlin-coroutines-expert

## When to use it
- Coordinate concurrent repository calls in a suspend function
- Trace unexpected coroutine cancellation
- Choose `StateFlow` or `SharedFlow` for a data stream
- Write tests for suspending functions and `Flow`
- Handle exceptions in concurrent operations

## Example prompts
- Review my Kotlin async data loading and suggest a structure using `coroutineScope`.
- Investigate the cancellation bug in my coroutine code, including how `CancellationException` is handled.
- Help me test this `Flow` with `runTest` and an injected `TestDispatcher`.

## Similar
- [migrate-to-shoehorn](https://affpapa.org/en/nevibecode/skills/migrate-to-shoehorn.md) — skill · 475388 installs
- [write-swift](https://affpapa.org/en/nevibecode/skills/write-swift.md) — skill · 119300 installs
- [megacave](https://affpapa.org/en/nevibecode/skills/megacave.md) — skill · 25400 installs
- [find-docs](https://affpapa.org/en/nevibecode/skills/find-docs.md) — skill · 9400 installs
- [typescript-advanced-types](https://affpapa.org/en/nevibecode/skills/typescript-advanced-types.md) — skill · 92169 installs
- [smart-explore](https://affpapa.org/en/nevibecode/skills/smart-explore.md) — skill · 7300 installs

From the same set: [davila7/claude-code-templates](https://affpapa.org/en/nevibecode/by/davila7/claude-code-templates.md) — 804 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
