# Patterns

- Model domain values with branded types to prevent mixups.
- Use discriminated unions for async/request state machines.
- Prefer factory helpers with inferred return types over unsafe assertions.
- Keep API contracts type-first and validate runtime boundaries with Zod.
