effect-domain-predicates

Generate predicates, equivalences, and Order instances for Effect v4 domain types using typeclass patterns.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires effect.

What problem does it solve? Domain types in Effect v4 applications need consistent equality checks, filtering predicates, and sorting logic, but hand-writing Equivalence and Order instances for every field is repetitive and error-prone. This Skill provides complete patterns for deriving these typeclass instances systematically. ## Core Features & Use Cases - Equivalence Generation: Derive structural equality via Schema.toEquivalence and field-based comparisons with Equivalence.mapInput and Equivalence.combine. - Order Instances: Build single-field and multi-criteria sorting with Order.mapInput, Order.combine, and Order.combineAll for use with Array.sort. - Typeclass-Derived Predicates: Re-export predicates from Schedulable and Durable typeclass instances (isScheduledBefore, hasMinimumDuration, and more). - Use Case: Given a Task schema with id, status, and createdAt fields, generate EquivalenceById for deduplication, OrderByPriorityThenDate for sorting, and filtering predicates, all with JSDoc documentation. ## Quick Start Ask the AI to generate a complete set of predicates, equivalences, and Order instances for your Effect v4 domain schema following the typeclass patterns in this Skill.

Frequently Asked Questions about effect-domain-predicates

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

FAQPage Schema
How do I create an Order instance for a domain type in Effect v4?

Use Order.mapInput to compose a base order like Order.String or DateTime.Order with a field extractor function. For multi-criteria sorting, combine instances with Order.combine for two fields or Order.combineAll for three or more, where the first order takes precedence.

How to derive Equivalence from an Effect Schema?

Call Schema.toEquivalence on your schema to get an Equivalence instance based on structural equality. This works with combinators like Array.dedupeWith and Array.containsWith for deduplication and membership checks.

Does Effect v4 Equal.equals do deep structural comparison?

Yes, in Effect v4 Equal.equals performs deep structural comparison by default with no special wrapping needed. Two values built from the same Schema.TaggedStruct with identical fields compare as equal automatically.

What is the difference between Equivalence.combine and Order.combine?

Equivalence.combine requires all combined equivalences to match (AND logic) and order does not matter. Order.combine sorts by the first order, then breaks ties with subsequent orders, so sequence matters for sorting precedence.

When should I use Equivalence.mapInput instead of Schema.toEquivalence?

Use Equivalence.mapInput when you need to compare domain objects by specific fields only, such as deduplicating tasks by ID while ignoring timestamps. Schema.toEquivalence compares the entire structure, which is too strict for partial-field equality.