Help us improve
Share bugs, ideas, or general feedback.
From odin
Applies type-driven development: encode invariants in types, parse instead of validate, make illegal states unrepresentable. Activates for refined types, state machines in types, proof-carrying types.
npx claudepluginhub outlinedriven/odin-claude-plugin --plugin odinHow this skill is triggered — by the user, by Claude, or both
Slash command
/odin:type-drivenThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Types encode the specification -- design from requirements before implementation. Make illegal states unrepresentable (Yaron Minsky). Parse, don't validate (Alexis King). For parsed opaque domain types within trusted boundaries, if the type compiles, the value is valid.
Guides type-driven design in Rust: newtypes, type state, PhantomData, marker traits, builder pattern, and making invalid states unrepresentable.
Models state machines, discriminated unions, Result/Option types, and branded types in TypeScript for type-safe domain modeling.
Use when a backpressured code-review subagent is judging whether a diff uses the type system to make illegal states unrepresentable — i.e. the diff touches data models, function signatures, or domain types. TypeScript-centric, with mappings to Rust, Swift, Kotlin, and Haskell/OCaml.
Share bugs, ideas, or general feedback.
Types encode the specification -- design from requirements before implementation. Make illegal states unrepresentable (Yaron Minsky). Parse, don't validate (Alexis King). For parsed opaque domain types within trusted boundaries, if the type compiles, the value is valid.
Modern insight (2025): "Encode invariants in types, not runtime checks" is the evolved formulation. Type richness should match risk -- start simple, add complexity where bugs actually occur. Types serve AI-assisted development: they communicate intent better than comments and reduce LLM hallucinations.
See patterns for language-specific refined types, state machine techniques, and language-specific validation gates. See examples for brief "parse, don't validate" patterns per language. See formal-tools for dependent type systems and verification tools.
Payment = Pending | Processing { id } | Success { id, amount } | Failed { reason }. Compiler ensures every case handled.Client<Disconnected> has no read() method. Compile error if called wrong.EmailAddress(String) with private constructor + validation in new().Before designing types, reason through the domain — SHORT-form KEYWORDS for internal scratchwork, break down valid and invalid states, critically review which operations are total vs partial, validate that the type design forbids invalid states. Decompose the domain model into atomic types, then compose them. Verify that illegal states are truly unrepresentable by attempting to construct them. For cardinality math (state-space size, bit-width sufficiency), invoke fend per the baseline rule; never self-calculate. Type-shape reasoning and exhaustiveness checking are in-head — they are not arithmetic.
as-castfn process(action: string) instead of fn process(action: Action)as casts bypassing type checker: Escape hatches that negate type safetyType-Driven Design (static proofs) -> reduces test scope needed
-> Test-Driven Development (examples + edges) -> validates type assumptions
-> Design by Contract (runtime boundaries) -> documents type guarantees
-> Types + TDD + DbC = highest confidence software
| Gate | Pass Criteria | Blocking |
|---|---|---|
| Types Compile | Type checker reports no errors | Yes |
| Exhaustiveness | No missing match/switch cases | Yes |
| Holes | Zero incomplete implementation markers (language-specific -- see patterns) | Yes |
| Target Build | Full build succeeds | Yes |
| Code | Meaning |
|---|---|
| 0 | Types verified, implementation complete |
| 11 | Type checker not available |
| 12 | Type check failed |
| 13 | Exhaustiveness/totality check failed |
| 14 | Type holes remaining |
| 15 | Target implementation failed |