What problem does it solve? Rust developers often encode domain rules as runtime checks, optional fields, and boolean flags, which lets invalid states compile and fail only in production. This Skill guides the design of structs, enums, newtypes, and typestate machines so the compiler itself rejects illegal states before any behavior is written. ## Core Features & Use Cases - Type-driven domain modeling: Replace state-dependent Option<T> fields and boolean flags with enum variants that each carry exactly the data their state needs. - Typestate and constrained types: Encode state machines as consuming transitions between distinct types, and choose between newtype wrappers and validating constructors per value. - Parse-don't-validate error design: Build fallible constructors returning Result<Self, Error> with railway-style error composition using ?, .map_err(), and #[from]. - Use Case: When adding a Connection type to a network service, model it as an enum with Idle, Connected { socket }, and Failed { error } variants instead of a struct with two optional fields, so callers can never observe a half-initialized connection. ## Quick Start Ask the AI to design the Rust types for your domain model or state machine so that illegal states are unrepresentable, before writing any implementation logic.