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

  1. Find single-property wrappers, primitive-heavy APIs, and @Immutable wrappers in UI state.
  2. Decide whether the single value is a real domain distinction. If not, keep the primitive or use a typealias.
  3. Check whether replacing the type changes equality, serialization, Java interop, or hot-path boxing.
  4. Convert only when the domain meaning is clear and the contract changes are acceptable.
  5. Re-run the affected compiler/tests; for Compose performance work, re-check compiler reports or recomposition evidence.

Decision flow

Installs
684
GitHub Stars
848
First Seen
May 13, 2026
kotlin-types-value-class — chrisbanes/skills