← ClaudeAtlas

type-driven-developmentlisted

Use when starting any Solidity feature, contract, or type — before writing implementation code — to define specs, invariants, types, and formal proofs that drive the implementation
wvs-finance/ThetaSwap-core · ★ 4 · Web & Frontend · score 35
Install: claude install-skill wvs-finance/ThetaSwap-core
# Type-Driven Development ## Overview **Define types and invariants BEFORE writing any implementation.** Types encode domain rules at compile time; invariants verify them at runtime and formally. If the types are right, the code writes itself. If the invariants pass, the code is correct. This skill combines: Idris-style type-driven design (make invalid states unrepresentable), Trail of Bits invariant-driven development (Hoare triples before code), Angstrom-style Solidity UDVTs, Compose/SCOP philosophy (no inheritance, no `library` keyword), Kontrol formal verification, and Spec Kit spec-driven workflow. ## The Iron Law ``` NO IMPLEMENTATION CODE WITHOUT TYPES AND INVARIANTS FIRST ``` Wrote a function body before defining its types? Delete it. Start over. Wrote business logic before the invariant scaffold? Delete it. Start over. **No exceptions:** - Not for "simple types" - Not for "obvious implementations" - Not for "urgent deadlines" - Not for "I'll add invariants after" - Delete means delete **Violating the letter of the rules is violating the spirit of the rules.** ## Process ```dot digraph tdd_flow { "1. Specify (Spec Kit)" [shape=box]; "2. Define Invariants" [shape=box]; "3. Design Types" [shape=box]; "4. Scaffold Kontrol Proofs" [shape=box]; "5. Static Analysis Gate" [shape=box]; "6. Implement" [shape=box]; "7. Verify" [shape=box]; "User review?" [shape=diamond]; "1. Specify (Spec Kit)" -> "2. Define Invariants"; "2. De