kotlin
Installation
SKILL.md
Kotlin
Use this skill for Kotlin code that needs strong type modeling, explicit async boundaries, and idiomatic Android integration. When the code is part of a Nitro Module, pair this with build-nitro-modules for generated specs, Promise mapping, annotations, and HybridObject constraints.
Workflow
- Read the local Kotlin code, generated abstract classes, and public API shape before editing.
- Model valid states with Kotlin types before implementing behavior.
- Choose whether work is synchronous, coroutine-based, or explicitly dispatched.
- Keep properties cheap and nonblocking.
- Make thread hops, Android service access, I/O, and fallible work visible in the API.
Type-Safe API Design
- Represent state variants with sealed interfaces/classes, normal interfaces, or concrete classes. Do not encode variants as one data class with many nullable fields.
- Keep related values non-null on the variant where they are valid. If
barcodeandbarcodeTypemust exist together, put them onScannedBarcode. - Use nullable types for real absence inside one state, not for "maybe this object is a different kind of thing".
- Prefer compile-time narrowing over caller-side null probing. Repeated null checks for related fields usually mean the model is too loose.