Effect Schema Type Parity

VerifiedSafe

Defines Effect schemas that are verified against domain types using `satisfies` and `tsafe` assertions for type parity. Helps when authoring or updating schema definitions, or when the user mentions schema/type parity, `satisfies`, or `Equals` checks.

Sby Skills Guide Bot
DevelopmentIntermediate
1206/2/2026
Claude CodeCursor
#effect-schema#type-safety#typescript#schema-validation#parity

Recommended for

Our review

Defines Effect schemas with domain types and ensures type parity using satisfies and tsafe's Equals check.

Strengths

  • Ensures compile-time type safety between schema and domain type
  • Catches type mismatches early
  • Leverages Effect's Schema library
  • Uses tsafe for exact equality checks

Limitations

  • Requires the tsafe library
  • Can be verbose
  • Assert overkill for simple schemas
When to use it

When defining Effect schemas for complex domain models that require precise type alignment.

When not to use it

For simple or one-off schemas where type parity is not critical.

Security analysis

Safe
Quality score88/100

The skill provides guidance on writing TypeScript type definitions and schema assertions, with no executable code or risky operations.

No concerns found

Examples

Define schema with type parity
Create an Effect schema for the domain type interface IProduct { id: string; name: string; price: number; } and ensure type parity using satisfies and tsafe's Equals.
Update existing schema
Update the ZUser schema to match the IUser interface after adding a new 'age' field. Use satisfies and assert Equals.
Validate unknown input
Given an unknown value, validate it against the ZOrder schema using validateUnknown from zerospin if available.

name: effect-schema description: Define Effect schemas that are verified against domain types. Use when authoring or updating Effect Schema definitions, or when the user mentions schema/type parity, satisfies, or tsafe Equals checks.

Effect Schema Type Parity

Instructions

  • Define the domain type first (prefer interface), then define the schema and assert parity.
  • Always use satisfies Schema.Schema<YourType, any> on the schema.
  • Add assert<Equals<typeof YourSchema.Type, Readonly<YourType>>>() using tsafe.
  • If the assert<Equals<...>> isn't typed correctly but the satisfies is, you can optionally add the _check1/_check2 assignments with void (see ZerospinCommandSchema).
  • When validating unknown input against an Effect schema, prefer validateUnknown from zerospin if available.

Example

import type { Equals } from 'tsafe';

import { Schema } from 'effect';
import { assert } from 'tsafe';

export interface IFoo {
  bar: string;
}

export const ZFoo = Schema.Struct({
  bar: Schema.String,
}) satisfies Schema.Schema<IFoo, any>;

const _check1: typeof ZFoo.Type = {} as IFoo;
const _check2: IFoo = {} as typeof ZFoo.Type;
void _check1;
void _check2;
assert<Equals<typeof ZFoo.Type, Readonly<IFoo>>>();
Related skills