kotlin-sum-types

Community

Make invalid input unrepresentable.

Authoranderssv
Version1.0.0
Installs0

System Documentation

What problem does it solve?

It solves the problem of scattered validation and unsafe domain logic by forcing external input to be parsed into explicit valid/invalid types at system boundaries.

Core Features & Use Cases

  • Sealed valid/invalid modeling: Represents data as Valid* and Invalid* states so domain functions can safely assume correctness.
  • Parse, don’t validate: Uses factory create() methods (often with @JsonCreator) to transform untyped data into typed domain objects in one place.
  • Error collection with paths: Collects multiple validation errors while preserving original invalid values and composing nested error paths (e.g., email, address.city).
  • Controller-style boundary handling: Uses exhaustive when statements to translate validated domain results into OK/error responses.

Quick Start

Ask an AI to explain how to model a JSON payload as a sealed Kotlin type with a create() parser that returns both valid and invalid states while collecting field-specific error messages.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: kotlin-sum-types
Download link: https://github.com/anderssv/the-example/archive/main.zip#kotlin-sum-types

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.