luma-intro-effect-schema

Migrate TypeScript projects from Zod to Effect Schema with bidirectional schemas.

17|1|Updated Dec 29, 2019
One-click install
npx skills add https://github.com/LumaKernel/dotfiles --skill luma-intro-effect-schema-lumakernel
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: luma-intro-effect-schema
Source: https://github.com/LumaKernel/dotfiles/tree/main/common/claude/skills/luma-intro-effect-schema
Command: npx skills add https://github.com/LumaKernel/dotfiles --skill luma-intro-effect-schema-lumakernel

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires effect, @effect/schema.

What problem does it solve? Introducing Effect Schema into a TypeScript project—or fully replacing Zod—requires more than mechanical API substitution. This Skill guides the migration so you actually benefit from Effect Schema's bidirectional schemas, three type parameters (Type, Encoded, Requirements), and typed dependency injection, while removing Zod completely. ## Core Features & Use Cases - Zod-to-Effect Schema Migration: Analyzes existing Zod usage (objects, transforms, refinements, unions, form/tRPC/ORM integrations), classifies migration difficulty, and converts each pattern using a built-in cheat sheet. - Bidirectional Schema Adoption: Finds hand-written serializers (e.g., .toISOString(), JSON.stringify) that Zod's one-way .transform() forced you to write, and consolidates them into a single decode/encode schema. - Typed Dependencies in Validation: Converts side-effecting .refine() calls into Schema.filterEffect so dependencies like database services appear in the schema's Requirements type parameter. - Use Case: You have a project with 30 files importing Zod, including Date transforms and async email-uniqueness refinements. The Skill inventories them, migrates shared schemas first, eliminates duplicated serialization code, uninstalls Zod, and verifies tsc --noEmit passes. ## Quick Start Migrate this project's Zod schemas to Effect Schema and remove the zod dependency.

Frequently Asked Questions about luma-intro-effect-schema

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

FAQPage Schema
How do I migrate from Zod to Effect Schema?▼

Inventory Zod usage by pattern (objects, transforms, refinements, unions), then convert each using the mapping cheat sheet: z.object becomes Schema.Struct, z.infer becomes typeof X.Type, and .parse becomes Schema.decodeUnknownSync. Migrate shared schemas first, then uninstall zod once no imports remain.

What is the difference between Zod and Effect Schema?▼

Effect Schema is bidirectional: one schema defines both decode and encode, while Zod's .transform() is one-way. Effect Schema also has three type parameters (Type, Encoded, Requirements), separating wire format from app types and exposing validation dependencies at the type level.

Does Effect Schema work with react-hook-form?▼

zodResolver cannot be used directly, so an Effect Schema resolver adapter is needed. Check @hookform/resolvers for an official version, or write a thin adapter converting Schema.decodeUnknownEither results into react-hook-form's resolver format.

How do I handle async validation with side effects in Effect Schema?▼

Use Schema.filterEffect instead of Zod's async .refine(). The dependency (e.g., a database service) appears in the schema's Requirements type parameter, so callers must provide it and tests can inject a test implementation.

What packages are required to install Effect Schema?▼

Install both effect and @effect/schema, since @effect/schema depends on the effect package. Use whichever package manager the project already uses, detected via its lockfile.

When should I keep Zod instead of fully migrating?▼

Keeping Zod may be reasonable when form-library adapters become too complex or ORM/tRPC integrations lack Effect Schema support. In that case, confine the Effect Schema to Zod conversion layer to one location to avoid dual schema maintenance.