Use this skill when the code should express the business domain more precisely.
Core principles
- Replace domain-significant primitives with semantic types.
- Parse at the boundary, then trust the type inside the system.
- Make invalid states unrepresentable where the type system can do the work.
- Treat stateful booleans as a smell when an enum is the real model.
What to look for
String, int, number, or bool carrying domain meaning
- identifiers without newtype wrappers
- contradictory field combinations that should be encoded as variants
- validation logic buried inside business logic instead of constructors or parsers
- swappable parameters that should be distinct semantic types
Review workflow
- Identify the domain concepts hidden inside primitives.
- Propose the smallest semantic type that captures the business meaning.