kotlin-types-value-class
Installation
SKILL.md
Kotlin value class vs data class
Core principle
Prefer @JvmInline value class for single-field types that carry domain meaning. Data classes are for aggregating multiple fields.
Review procedure
- Find single-property wrappers, primitive-heavy APIs, and
@Immutablewrappers in UI state. - Decide whether the single value is a real domain distinction. If not, keep the primitive or use a typealias.
- Check whether replacing the type changes equality, serialization, Java interop, or hot-path boxing.
- Convert only when the domain meaning is clear and the contract changes are acceptable.
- Re-run the affected compiler/tests; for Compose performance work, re-check compiler reports or recomposition evidence.