What problem does it solve? Codebases accumulate runtime failures that the compiler could have prevented: contradictory optional fields, interchangeable primitive IDs, unhandled enum variants, and unchecked external data. This Skill provides a set of type-system design principles that shift those 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. - Semantic primitive branding: Distinguish types like UserId and OrderId with newtypes, opaque types, or branded intersections so they cannot be mixed up. - Boundary parsing and exhaustiveness: Parse untyped external data (JSON, RPC payloads, env vars) at boundaries and enforce exhaustive matching so new variants break compilation. - Use Case: When reviewing a function signature like { completed: boolean; completedAt?: Date }, apply the Skill to remodel it as { kind: 'open' } | { kind: 'done'; at: Date } so meaningless states no longer compile. ## Quick Start Ask the AI to review your type definitions and function signatures using the type system discipline principles to eliminate illegal states and non-exhaustive matches.