effect-ts

Guides writing and refactoring TypeScript code using Effect services, layers, and typed error handling.

Updated Jun 22, 2026
One-click install
npx skills add https://github.com/aashahin/ai-skills --skill effect-ts-aashahin
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: effect-ts
Source: https://github.com/aashahin/ai-skills/tree/main/effect-ts
Command: npx skills add https://github.com/aashahin/ai-skills --skill effect-ts-aashahin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing idiomatic Effect-TS code is hard because the library offers many ways to accomplish the same task, and common mistakes like try-catch inside Effect.gen or unsafe SubscriptionRef usage cause subtle bugs. This Skill provides expert guidance, canonical patterns, and critical rules for working with the Effect ecosystem. ## Core Features & Use Cases - Effect Pattern Guidance: Covers services, layers, dependency injection, typed error handling, Schema/JSONSchema, streams, concurrency, and testing with @effect/vitest. - Ecosystem Integration: Includes references for @effect/ai tools, @effect/platform, @effect/rpc, Effect-Atom reactive state, and Next.js 15+ integration via @prb/effect-next. - Critical Rules & Failure Modes: Documents forbidden patterns (try-catch in generators, type assertions) and quick fixes for common issues like SubscriptionRef version mismatches and infinite stream hangs. - Use Case: When refactoring imperative try-catch/promise code into Effect, the Skill directs you to use Effect.tryPromise, Data.TaggedError for typed errors, and Effect.gen with the return yield* pattern for explicit error termination. ## Quick Start Ask the assistant to refactor a promise-based function into an Effect service with a Layer and typed errors.

Frequently Asked Questions about effect-ts

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

FAQPage Schema
How do I handle errors in Effect-TS instead of try-catch?▼

Effect failures are returned as exits, not thrown, so try-catch inside Effect.gen does not catch them. Use Effect.catchTag or Effect.catchAll for recovery, Effect.result to inspect outcomes, and define typed errors with Data.TaggedError.

How do I define services and layers in Effect-TS?▼

Define services with Context.Tag and provide implementations via Layer.succeed, or use Effect.Service to bundle a default implementation with dependencies and auto-generated accessors. Compose layers with Layer.merge and Layer.provide, then inject with Effect.provide.

Does Effect-TS work with Next.js App Router?▼

Yes, the @prb/effect-next package provides typed helpers for Next.js 15+ route handlers, server actions, middleware, and React hooks. It also offers request-scoped caching via reactCache and a testing kit for asserting Effect results.

Why does my Effect test hang when using Effect.sleep?▼

The @effect/vitest it.effect runner uses a TestClock where time does not pass automatically, so Effect.sleep stalls forever. Replace sleeps with TestClock.adjust, or switch the test to it.live when real wall-clock time is required.

Why is SubscriptionRef.unsafeMake not a function?▼

The unsafeMake API may not exist in your installed Effect version, causing that runtime error. Use the safe SubscriptionRef.make constructor instead, which creates the reactive reference within an Effect and supports get, set, and changes.

When should I use Option versus null in Effect code?▼

Use Option<T> for internal Effect domain logic and T | null only at external boundaries like React props, JSON serialization, and API responses. Normalize at boundaries with Option.fromNullable on input and Option.getOrNull on output.