What problem does it solve?
Domain modeling in TypeScript often devolves into loosely typed objects, fragile discriminated unions, and ad-hoc validation and pattern matching. This skill solves that by guiding you to define runtime-validated, discriminated domain types with first-class constructors, guards, and exhaustive matchers using Effect v4 Schema utilities.
Core Features & Use Cases
- Schema-tagged ADTs with
_tag: Use Schema.TaggedStruct to define discriminated unions cleanly and exhaustively.
- Validated constructors: Generate type-safe constructors with Schema.decodeSync so invalid input is rejected at runtime.
- Guards, matching, and utilities: Provide Schema.is-based predicates and Match.typeTags pattern matching for safe branching on variants.
- Equality, ordering, and equivalence: Prefer deep structural equality via Equal.equals, and add field-based Equivalence when semantics require it.
- Advanced modeling patterns: Support recursive schemas (Schema.suspend), branded validation constraints (Brand.make), and typeclass instances when appropriate.
- Documentation and consistency standards: Enforce JSDoc with @category, @since, and runnable @example imports using namespace import style.
Quick Start
Use this skill to create a domain module for a discriminated union entity by defining variants with Schema.TaggedStruct, adding Schema.decodeSync constructors, and generating Schema.is guards plus a Match.typeTags matcher for exhaustive handling of each _tag.