Effect Schema Type Parity

VerifiedSafe

Define Effect schemas verified against domain types. Use when authoring or updating Effect Schema definitions with type parity assurance.

Sby Skills Guide Bot
DevelopmentIntermediate
406/2/2026
Claude Code
#effect#schema#typescript#type-parity#tsafe

Recommended for

Our review

Defines Effect schemas that are verified against domain types, using 'satisfies' and 'assert<Equals>' to ensure parity.

Strengths

  • Enforces strict correspondence between types and schemas.
  • Leverages compile-time checks with tsafe.
  • Catches mismatches between schema and domain type.

Limitations

  • Requires familiarity with Effect and tsafe.
  • Equality checks can add boilerplate.
  • Does not cover advanced validation without custom functions.
When to use it

When authoring or updating Effect Schema definitions to maintain type parity with interfaces.

When not to use it

For simple schemas where type consistency is obvious, or when the project does not use Effect.

Security analysis

Safe
Quality score85/100

The skill only provides instructions for defining TypeScript types and Effect schemas with compile-time parity checks. It involves no execution of code, network access, or file system operations.

No concerns found

Examples

Define an Effect schema with type parity
Create an Effect schema for an interface IUser with fields name (string) and age (number). Use 'satisfies' and add an assert<Equals> check.
Fix schema type mismatch
My Effect schema for IFoo has a type mismatch with the interface. Add parity checks using tsafe and correct the schema.

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