kotlin-sum-types

Installation
SKILL.md

STARTER_CHARACTER = 🔀

Parse, Don't Validate with Kotlin Sealed Classes

Represent validation states explicitly using sealed classes. This makes invalid states unrepresentable in your domain logic and pushes validation to system boundaries.

Core Principle

Parse, don't validate means transforming untyped input into strongly-typed domain objects at the boundary, carrying proof of validity through the type system.

Instead of:

fun processEmail(email: String) {
    if (!isValid(email)) throw ValidationException()
    // Every function must revalidate or assume validity
}
Installs
6
Repository
anderssv/ai
First Seen
Jun 5, 2026
kotlin-sum-types — anderssv/ai