Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Teaches domain modeling via algebraic data types, smart constructors, and type-level error handling, making illegal states unrepresentable.
64% 95%+32 ptsof test cases passed
Passed 21 of 22 test cases with the skill, and 14 of 22 without it.
This test ran on v1. v2 is the current version and hasn’t been tested on gemini-3.6-flash yet.
3 of 3 safety checks passed
Not used yet
Domain modeling with types. Make illegal states unrepresentable, workflows as pipelines, error handling at the type level.
Cross-references: fp-principles | code-craftsmanship: FP Hexagonal Architecture | fp-algebra-driven-design
[STARTER]
All domain types compose from two operations:
Combined recursively, these express virtually any domain structure.
[STARTER]
Wrap a primitive when a demonstrated invalid state or a mixing risk exists that no native type and no existing invariant owner already excludes. Keep the native type when it suffices (nw-code-craftsmanship owns this sufficiency rule).
What: A wrapper lets the compiler distinguish CustomerId from OrderId. When: Two same-typed domain values can be confused at a real call site, or the value carries a validation rule with no existing owner. Never for template conformance alone. Why: Prevents accidental mixing (compiler rejects comparing CustomerId with OrderId). Each such wrapper carries its own validation rules. The type name IS the documentation.
[STARTER]
Raw constructor is private. A create function validates input and returns a Result type, making validation failure explicit.
Pattern: UnitQuantity must be between 1 and 1000. Its create function rejects values outside that range. A companion value function provides read access to the inner primitive.
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.