effect-domain-modeling

Create Effect v4 domain models using Schema.TaggedStruct with constructors, guards, orders, and pattern matching.

1|Updated Aug 24, 2026
One-click install
npx skills add https://github.com/lambdasolver2/opencode-effect-harness --skill effect-domain-modeling-lambdasolver2
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-domain-modeling
Source: https://github.com/lambdasolver2/opencode-effect-harness/tree/main/packages/module-typescript/assets/skills/effect-domain-modeling
Command: npx skills add https://github.com/lambdasolver2/opencode-effect-harness --skill effect-domain-modeling-lambdasolver2

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires effect.

What problem does it solve? Building type-safe domain models in Effect v4 requires coordinating many pieces—tagged union schemas, validated constructors, type guards, equivalence, ordering, and exhaustive pattern matching—and getting any of them wrong leads to inconsistent, error-prone code. This Skill provides a complete, opinionated blueprint for modeling domain entities and value objects correctly the first time. ## Core Features & Use Cases - Tagged Union Modeling: Define ADTs with Schema.TaggedStruct, automatic _tag discriminators, and Schema.decodeSync constructors with validation. - Full Utility Suite: Generate guards via Schema.is, exhaustive matching via Match.typeTags, Order.mapInput sorting, Equivalence instances, destructors, and immutable setters. - Advanced Patterns: Handle recursive schemas with Schema.suspend, branded types with Brand.make, and DateTime/Duration temporal fields following v4 conventions. - Use Case: When asked to model a Task entity with pending/active/completed states, produce a complete module with schemas, constructors, guards, a match function, ordering by tag and date, and full JSDoc documentation. ## Quick Start Use the effect-domain-modeling skill to create a domain model for a User entity with Admin and Customer variants including constructors, guards, and pattern matching.

Frequently Asked Questions about effect-domain-modeling

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

FAQPage Schema
How do I create a discriminated union type in Effect v4?

Define each variant with Schema.TaggedStruct, which automatically adds the _tag discriminator, then combine them with Schema.Union. Use Schema.decodeSync to create validated constructors that apply the tag automatically.

How do I pattern match on Effect Schema tagged unions?

Use Match.typeTags from effect/Match to create an exhaustive, type-safe match function over the _tag discriminator. Each variant gets a handler, and TypeScript enforces that all cases are covered.

Does Effect v4 still need Schema.Data for structural equality?

No. In Effect v4, Equal.equals performs deep structural comparison by default, and Schema.Data and Data.struct were removed. Plain object spreads work for immutable updates without special wrapping.

How do I define recursive schemas in Effect v4?

Use Schema.suspend for self-referencing types like trees or nested categories. Define an interface for the recursive type first, then reference the schema lazily inside Schema.suspend to break the circularity.

When should I use branded types in Effect Schema?

Use Brand.make for values needing extra runtime validation, such as emails or IDs, where the filter returns true or an error message. Attach the brand to a schema with Schema.fromBrand using an identifier string and the brand constructor.