From odin
Develop with refined types: model domains, encode state machines, and harden API boundaries against malformed input using techniques like 'make illegal states unrepresentable' and 'parse don't validate'.
How 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
1. **Make illegal states unrepresentable** (Yaron Minsky). If the compiler can construct a value, that value must be valid. A state the domain forbids should have no type that names it.
Type richness matches risk — start simple, add complexity where bugs actually occur.
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)Type-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 |
npx claudepluginhub outlinedriven/odin-claude-plugin --plugin odinGuides type-driven design in Rust using newtypes, type states, PhantomData, marker traits, and builder patterns to make invalid states unrepresentable at compile time.
Guides server-side TypeScript domain modeling with discriminated unions, pure state transitions, Result types, schema-validated boundaries, and PII protection. Triggers on business logic types, use cases, repositories, and error handling.
Enforces type-level safety patterns: making illegal states unrepresentable, branding primitives, parsing external data at boundaries, and exhaustive matching.