# kotlin

A skill for Kotlin and Android API work: it pushes typed state modeling, explicit async boundaries, and keeps blocking calls out of properties. Useful when you touch .kt files or a Nitro Module wrapper.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 469 installs · ★ 178
- Author: margelo
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/margelo/react-native-skills/tree/HEAD/skills/kotlin/SKILL.md
- Updated: 2026-08-21
- HTML: https://affpapa.org/en/nevibecode/skills/kotlin

## What it does

The workflow starts with reading the existing Kotlin code, the generated abstract classes, and the shape of the public API before any edit. Valid states get modeled with types first, behavior second. State variants belong in sealed interfaces or separate classes, not in one data class padded with nullable fields, and related values stay non-null on the variant where they apply.

Async gets its own section. Coroutines fit naturally suspending APIs and Android I/O; quick local work stays synchronous. `runBlocking` is off limits in library code, getters, and JS-facing entry points. When a value arrives from a specific Android callback, the skill points to a listener, a Flow, or an event API. Repeated dispatcher hops read as an architecture smell, so the fix is owning the lifecycle or scope rather than patching races with `delay` or `Thread.sleep`.

Style rules cover final classes by default, `data class` for plain values, `require` and `check` instead of silent failures, careful Java interop, and sparing use of `!!`. For Nitro Modules the skill suggests pairing with `build-nitro-modules`, which handles generated specs, Promise mapping, annotations, and HybridObject constraints.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add margelo/react-native-skills --skill kotlin -a claude-code
```

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

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add margelo/react-native-skills --skill kotlin -a codex
```

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

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add margelo/react-native-skills --skill kotlin -a cursor
```

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

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install margelo/react-native-skills kotlin
```

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

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add margelo/react-native-skills --skill kotlin -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/margelo/react-native-skills --path skills/kotlin
```

### Windsurf (Devin Desktop)

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

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add margelo/react-native-skills --skill kotlin -a opencode
```

### 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/margelo/react-native-skills/tree/HEAD/skills/kotlin/SKILL.md

## When to use it
- split state variants into sealed interfaces instead of nullable fields
- move a blocking call out of a getter into an async method
- decide where a coroutine earns its keep and where plain sync code wins
- cut dispatcher hops that bounce work through the main thread
- convert Java platform types before they reach the public API

## Example prompts
- Read `Scanner.kt` and rework `ScannedData` into a sealed interface so each variant carries only its own fields
- The session status getter uses `runBlocking` — turn it into an async method
- Check `HybridScanner.kt` for properties that hide Android service calls or I/O

## 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: [margelo/react-native-skills](https://affpapa.org/en/nevibecode/by/margelo/react-native-skills.md) — 6 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
