Skills effect-ts
Effect-TS (Effect) comprehensive development guide for TypeScript. Use when building, debugging, reviewing, or generating Effect code. Covers typed error modeling (expected errors vs defects), structured concurrency (fibers), dependency injection (ServiceMap/Context + Layers), resource management (Scope), retry/scheduling (Schedule), streams, Schema validation, observability (OpenTelemetry), HTTP client/server, Effect AI (LLM integration), and MCP servers. Critical for AI code generation: includes exhaustive wrong-vs-correct API tables preventing hallucinated Effect code. Supports both Effect v3 (stable) and v4 (beta). Use this skill whenever code imports from 'effect', '@effect/platform', '@effect/ai', or the user mentions Effect-TS, typed errors with Effect, functional TypeScript with Effect, ServiceMap, Layer, or Schema from Effect. Also trigger when generating new TypeScript projects that could benefit from Effect patterns, even if the user doesn't explicitly name the library.
git clone https://github.com/tenequm/skills
T=$(mktemp -d) && git clone --depth=1 https://github.com/tenequm/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/effect-ts" ~/.claude/skills/tenequm-skills-effect-ts && rm -rf "$T"
skills/effect-ts/SKILL.mdEffect-TS
Effect is a TypeScript library for building production-grade software with typed errors, structured concurrency, dependency injection, and built-in observability.
Version Detection
Before writing Effect code, detect which version the user is on:
# Check installed version cat package.json | grep '"effect"'
- v3.x (stable, most production codebases):
,Context.Tag
,Effect.catchAll
,Effect.forkData.TaggedError - v4.x (beta, Feb 2026+):
,ServiceMap.Service
,Effect.catch
,Effect.forkChildSchema.TaggedErrorClass
If the version is unclear, ask the user. Default to v3 patterns for existing codebases, v4 for new projects.
Primary Documentation Sources
- https://effect.website/docs (v3 stable docs)
- https://effect.website/llms.txt (LLM topic index)
- https://effect.website/llms-full.txt (full docs for large context)
- https://tim-smart.github.io/effect-io-ai/ (concise API list)
- https://github.com/Effect-TS/effect-smol (v4 source + migration guides)
- https://github.com/Effect-TS/effect-smol/blob/main/LLMS.md (v4 LLM guide)
AI Guardrails: Critical Corrections
LLM outputs frequently contain incorrect Effect APIs. Verify every API against the reference docs before using it.
Common hallucinations (both versions):
| Wrong (AI often generates) | Correct |
|---|---|
| |
| / |
| in pipe, or use |
| (v3.10+ and all v4) |
| (v3.10+) |
| JSON Schema Draft 2020-12 | Effect Schema generates Draft-07 |
| "thread-local storage" | "fiber-local storage" via (v3) / (v4) |
| fibers are "cancelled" | fibers are "interrupted" |
| all queues have back-pressure | only bounded queues; sliding/dropping do not |
| (Schema errors take objects) |
v3-specific hallucinations:
| Wrong | Correct (v3) |
|---|---|
(function call) | |
| |
| |
v4-specific hallucinations (AI may mix v3/v4):
| Wrong (v3 API used in v4 code) | Correct (v4) |
|---|---|
| or class syntax |
| |
| |
| |
| |
| (ServiceMap.Reference) |
(Ref as Effect) | (Ref is no longer an Effect) |
(Fiber as Effect) | (Fiber is no longer Effect) |
/ | (v4 naming convention) |
| |
Read
for the exhaustive corrections table.references/llm-corrections.md
Progressive Disclosure
Read only the reference files relevant to your task:
- Error modeling or typed failures →
references/error-modeling.md - Services, DI, or Layer wiring →
references/dependency-injection.md - Retries, timeouts, or backoff →
references/retry-scheduling.md - Fibers, forking, or parallel work →
references/concurrency.md - Streams, queues, or SSE →
references/streams.md - Resource lifecycle or cleanup →
references/resource-management.md - Schema validation or decoding →
references/schema.md - Logging, metrics, or tracing →
references/observability.md - HTTP clients or API calls →
references/http.md - HTTP API servers →
(covers both client and server)references/http.md - LLM/AI integration →
references/effect-ai.md - Testing Effect code →
references/testing.md - Migrating from async/await →
references/migration-async.md - Migrating from v3 to v4 →
references/migration-v4.md - Core types, gen, pipe, running →
references/core-patterns.md - Full wrong-vs-correct API table →
references/llm-corrections.md
Core Workflow
- Detect version from
before writing any codepackage.json - Clarify boundaries: identify where IO happens, keep core logic as
valuesEffect - Choose style: use
for sequential logic, pipelines for simple transforms. In v4, preferEffect.gen
for named functionsEffect.fn("name") - Model errors explicitly: type expected errors in the
channel; treat bugs as defectsE - Model dependencies with services and layers; keep interfaces free of construction logic
- Manage resources with
when opening/closing things (files, connections, etc.)Scope - Provide layers and run effects only at program edges (
orNodeRuntime.runMain
)ManagedRuntime - Verify APIs exist before using them - consult https://tim-smart.github.io/effect-io-ai/ or source docs
Starter Function Set
Start with these ~20 functions (the official recommended set):
Creating effects:
Effect.succeed, Effect.fail, Effect.sync, Effect.tryPromise
Composition:
Effect.gen (+ Effect.fn in v4), Effect.andThen, Effect.map, Effect.tap, Effect.all
Running:
Effect.runPromise, NodeRuntime.runMain (preferred for entry points)
Error handling:
Effect.catchTag, Effect.catchAll (v3) / Effect.catch (v4), Effect.orDie
Resources:
Effect.acquireRelease, Effect.acquireUseRelease, Effect.scoped
Dependencies:
Effect.provide, Effect.provideService
Key modules:
Effect, Schema, Layer, Option, Either (v3) / Result (v4), Array, Match
Import Patterns
Always use barrel imports from
"effect":
import { Effect, Schema, Layer, Option, Stream } from "effect"
For companion packages, import from the package name:
import { NodeRuntime } from "@effect/platform-node" import { NodeSdk } from "@effect/opentelemetry"
Avoid deep module imports (
effect/Effect) unless your bundler requires it for tree-shaking.
Output Standards
- Show imports in every code example
- Prefer
(imperative) for multi-step logic; pipelines for transformsEffect.gen - In v4, use
instead of bareEffect.fn("name")
for named functionsEffect.gen - Never call
/Effect.runPromise
inside library code - only at program edgesEffect.runSync - Use
for CLI/server entry points (handles SIGINT gracefully)NodeRuntime.runMain - Use
when integrating Effect into non-Effect frameworks (Hono, Express, etc.)ManagedRuntime - Always
when raising an error in a generator (ensures TS understands control flow)return yield* - Avoid point-free/tacit usage: write
notEffect.map((x) => fn(x))
(generics get erased)Effect.map(fn) - Keep dependency graphs explicit (services, layers, tags)
- State the
shape when it helps design decisionsEffect<A, E, R>
Agent Quality Checklist
Before outputting Effect code, verify:
- Every API exists (check against tim-smart API list or source docs)
- Imports are from
(not"effect"
,@effect/schema
, etc.)@effect/io - Version matches the user's codebase (v3 vs v4 syntax)
- Expected errors are typed in
; unexpected failures are defectsE -
is called only at program edges, not inside library coderun* - Resources opened with
are wrapped inacquireReleaseEffect.scoped - Layers are provided before running (no missing
requirements)R - Generator bodies use
(notyield*
withoutyield
)* - Error raises in generators use
patternreturn yield*