What problem does it solve? Codebases accumulate runtime failures that the compiler could have prevented: contradictory optional fields, interchangeable primitive identifiers, unchecked external data, and non-exhaustive matches. This Skill provides a set of type system design principles that shift those failures 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. - Semantic Primitive Branding: Distinguish types like UserId and OrderId using newtypes, opaque types, value classes, or branded intersections. - Boundary Parsing and Exhaustiveness: Parse untyped external data at boundaries and enforce exhaustive matching so new variants trigger compile errors. - Use Case: When reviewing a TypeScript function signature with { completed: boolean; completedAt?: Date }, apply this Skill to refactor it into { kind: 'open' } | { kind: 'done'; at: Date } so contradictory states cannot compile. ## Quick Start Review this function signature and data model using the type system discipline principles and suggest types that make illegal states unrepresentable.