domain-modeling

Generate TypeScript domain models with Effect Schema.TaggedStruct discriminated unions.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/front-depiction/claude-setup --skill domain-modeling-front-depiction
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: domain-modeling
Source: https://github.com/front-depiction/claude-setup/tree/main/skills/domain-modeling
Command: npx skills add https://github.com/front-depiction/claude-setup --skill domain-modeling-front-depiction

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps engineers design robust, type-safe domain models using Effect’s Schema utilities to encode invariants, enable exhaustively typed pattern matching, and ship production-grade discriminated unions for entities, value objects, and events.

Core Features & Use Cases

  • Schema.TaggedStruct for discriminated unions with automatic _tag fields and typed variants
  • Schema.Data for automatic structural equality and efficient comparisons
  • Schema.decodeSync constructors for runtime validation and safe creation
  • Pattern Matching with Match.typeTags for exhaustive variant handling
  • Real-world use cases include modeling Order states (Pending/Active/Completed), Customer and Product aggregates, and event-sourced entities

Quick Start

Start by defining variants with Schema.TaggedStruct, pipe Schema.Data, export the union, and expose a set of constructors via Schema.decodeSync for safe, validated creation.

Frequently Asked Questions about domain-modeling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create type-safe discriminated unions for domain modeling in TypeScript?

Define domain model discriminated unions using Schema.TaggedStruct to generate automatic _tag fields and typed variants. This approach enforces invariants at compile time while producing production-ready structures for entities, value objects, and events.

How does Schema.Data work for automatic structural equality in TypeScript?

Schema.Data wraps your schema to provide automatic structural equality and efficient comparisons for domain models. This enables reliable value object matching without manually implementing custom equality logic.

How do I build validated constructors for TypeScript domain entities?

Expose constructors via Schema.decodeSync to enforce runtime validation and safe creation of domain entities. This guarantees that invalid states are rejected immediately during object instantiation.

Can I use Effect schemas for exhaustive pattern matching on domain variants?

Yes, pattern matching with Match.typeTags enables exhaustive variant handling for discriminated unions. This ensures every domain state like Pending or Active is processed without missing edge cases.

What is the best way to model event-sourced entities with type safety?

Use Schema.TaggedStruct to define event variants and Schema.decodeSync constructors to validate state transitions. This delivers a production-grade structure for event-sourced entities with clear exports and documentation.

Do I need prior Effect schema knowledge to use type-safe domain modeling?

Yes, you need an understanding of Effect schemas to define variants, apply Schema.Data, and pipe schema transformations. Familiarity with TypeScript discriminated unions is also required to structure the models correctly.