What problem does it solve? TypeScript codebases often accumulate unsafe patterns like any types, unchecked as casts, and loose object shapes that let invalid states compile and crash at runtime. This Skill gives the agent a concrete rule set for writing and reviewing TypeScript so type errors are caught by the compiler instead of in production. ## Core Features & Use Cases - Type modeling rules: Enforces discriminated unions, branded types, and constructive modeling so impossible states cannot be represented. - Safe narrowing guidance: Defines a narrowing hierarchy from discriminant switches down to validated as casts, plus exhaustiveness checks with never. - Boundary discipline: Requires unknown over any for external data and validation at system boundaries, with schema-derived types via Pick/Omit/Parameters. - Use Case: While refactoring a .tsx file, the agent replaces a { loading: boolean; data?: T; error?: string } bag with a discriminated union and adds an exhaustive switch so new variants trigger compile errors. ## Quick Start Review this TypeScript file and apply the typescript-best-practices rules to remove any as casts and model the state with a discriminated union.