What problem does it solve? Codebases accumulate runtime failures that the compiler could have prevented: contradictory optional fields, interchangeable primitive IDs, unchecked casts, and non-exhaustive matches. This Skill provides a set of type design principles that push these errors from runtime to compile time. ## Core Features & Use Cases - Illegal State Elimination: Model variants as sum types (discriminated unions, enums with payloads, sealed classes) instead of bags of optional fields. - Boundary Validation: Parse external data (JSON, RPC payloads, env vars, database rows) into typed models at every boundary, and brand semantic primitives like UserId versus OrderId. - Exhaustiveness and Totality: Enforce compiler-checked exhaustive matching and prefer total functions over partial ones with runtime assertions. - Use Case: When reviewing a TypeScript function signature like { completed: boolean; completedAt?: Date }, apply the Skill to remodel it as { kind: 'open' } | { kind: 'done'; at: Date } so contradictory states cannot compile. ## Quick Start Ask the AI to review this function signature and apply type system discipline to make illegal states unrepresentable.