What problem does it solve? TypeScript codebases often allow invalid states to be represented through loose boolean flags, optional fields, and unchecked any types, leading to runtime bugs that the compiler could have caught. This Skill guides you to design types so invalid states cannot be written down, and to validate untrusted data only at trust boundaries. ## Core Features & Use Cases - Impossible-state elimination: Model state as discriminated unions with exhaustive never-default switches so adding a variant surfaces every affected call site as a compile error. - Branded types and smart constructors: Constrain primitives like UserId or PaymentMinorUnits behind validating constructors, keeping type assertions confined to one justified location. - Schema-first trust boundaries: Validate HTTP, queue, file, and third-party data with Standard Schema libraries such as Zod, Valibot, or ArkType, then translate wire shapes into owned domain types. - Strict compiler configuration: Apply strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes, and related flags with guidance on when each is justified. - Use Case: When reviewing a booking model with four status booleans and three optional payloads, refactor it into a four-variant discriminated union so reference cannot be absent on a confirmed booking and no defensive guards are needed. ## Quick Start Ask the AI to review your TypeScript types and refactor boolean-and-optional state bags into discriminated unions with branded primitives and boundary validation.