# Kotlin

> Use when: write or review idiomatic Kotlin with null safety, immutability, and concise expressions.

- Skill: `kimtth/kotlin` (Agent Skill)
- Install (CLI): `npx skillmds@latest add kimtth/kotlin`
- Raw SKILL.md: https://api.skillmd.com/api/skills/kimtth/kotlin/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: kimtth (https://skillmd.com/u/kimtth)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/kimtth/kotlin

---


Goal: concise, null-safe Kotlin that leans on the type system.

Use for:
- new Kotlin code, JVM or multiplatform
- reviewing nullability, immutability, and coroutine usage
- modernizing Java-style Kotlin

Workflow:
1. Prefer val over var; make data immutable by default.
2. Use nullable types deliberately; avoid !! force unwraps.
3. Model data with data classes and sealed hierarchies.
4. Use coroutines with structured concurrency and scopes.
5. Express logic with scope functions and expressions, not statements.
6. Verify with the test runner, ktlint/detekt.

Idioms:
- sealed classes for closed type hierarchies
- when expressions with exhaustive branches
- extension functions over utility classes
- let/run/apply/also used purposefully

Rules:
- avoid !!; handle null with ?., ?:, or checks
- favor immutability; copy data classes to change them
- keep coroutine scopes structured, not global
- do not overuse scope functions to the point of obscurity

