mcpField
E
effect

effect

github.com/dobroslavradosavljevicDevelopment361 installsUpdated 4d ago
Repository

About effect

Effect is a TypeScript framework and library for structuring application logic around typed failures, dependencies, resource lifetimes, and concurrency. This skill provides adoption guidance and API routing for teams implementing or migrating Effect-based code.

Key features

  1. 01Typed failures and recovery
  2. 02Dependency and resource-lifetime management
  3. 03Concurrency, scheduling, and streaming
  4. 04Schema-based validation and codecs
  5. 05Logging, tracing, metrics, and testing

Use cases

  1. 01Implement an application use case with Effect
  2. 02Manage dependencies and cleanup through layers and scopes
  3. 03Build concurrent or streaming workflows
  4. 04Migrate code to Effect 4 while matching installed APIs

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/dobroslavradosavljevic/skills --skill effect

After installing, type/effectin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

agents/
openai.yaml
references/
adoption-boundaries.md
concurrency.md
ecosystem.md
migration.md
modules-stable.md
modules-unstable.md
schema-v4.md
services-layers-runtime.md
setup-core.md
source-map.md
vitest-testing.md

Details

From the project README

Effect

Use Effect throughout the application code covered by the task. A Promise application wrapped in one Effect is incomplete adoption.

The verified reference snapshot is [email protected] (first stable v4 release, npm latest, LTS). Check installed versions before changing dependencies. Do not mix v3 and v4 APIs. Projects still on 4.0.0-rc.* / beta.* must apply the RC → 4.0 upgrade in migration.md (import paths and several renames changed).

Required adoption policy

  • Keep use cases, service methods, I/O, expected failures, resource ownership, and concurrent work inside Effect.
  • Choose the matching Effect capability before writing a custom helper or adding an overlapping library. Consult the index below.
  • Use Effect Schema for application-owned validation and codecs; Context and Layer for dependencies; Scope for cleanup.
  • Use Effect scheduling, concurrency, state, configuration, and observability instead of parallel custom systems for the same responsibility.
  • Keep Promise, callback, framework, and vendor APIs at named adapters. Convert once on entry and once on exit.
  • Existing Elysia routes may return Promises. Their handlers delegate to Effect use cases; business logic stays outside handlers.
  • Never call a runtime runner inside a domain service to make Effect look like a Promise API.
  • Keep pure calculations and ordinary TypeScript data simple. They need no Effect wrapper unless they fail or perform effects.
  • Prefer Effect's standard library over new duplicate utilities. Do not mechanically replace clear language operators or native data structures.
  • Respect the requested scope. Convert each touched use case end to end; do not start an unrelated repository-wide migration.
  • Record remaining non-Effect boundaries and their concrete constraints. Convenience alone does not justify a second application architecture.

Read adoption-boundaries.md when implementing, reviewing, or migrating a mixed codebase.

Dense capability index

Use this map before choosing an implementation. The linked catalogs cover every public module namespace and public monorepo package in the snapshot. This is a capability/module index, not a list of every function. Confirm signatures in installed declarations. Areas marked unstable are @stability unstable (may break in minor releases) even though their import paths have no unstable segment.

ResponsibilityEffect capability
Use cases, typed failure, recoveryEffect.fn, Effect.gen, Cause, Exit, Result, Option, Match
Dependencies, application lifetimeContext, Layer, ManagedRuntime, Scope, LayerMap, LayerRef
Validation, codecs, domain types, derived formatsSchema, Brand, Data, StandardSchema, JsonSchema, Optic; unstable schema JIT/AOT compilers
Configuration, secrets, time, sizes, randomnessConfig (PascalCase constructors), ConfigProvider, Redacted, Clock, DateTime, Duration, ByteSize, Random
Retry, repeat, timeout, fallbackSchedule, Cron, Effect timeout/retry, ExecutionPlan
Concurrency, cancellation, synchronizationFiber, fiber collections, Deferred, Latch, Semaphore, PartitionedSemaphore
Shared and transactional stateRef, SynchronizedRef, SubscriptionRef, ScopedRef, Effect.tx, all Tx* modules
Streaming and backpressureStream, Sink, Queue, PubSub; low-level Channel, Pull, Take, ChannelSchema
Cache, batching, reusable resourcesCache, ScopedCache, Request, RequestResolver, Pool, Resource, RcRef, RcMap
Collections, text, numbers, equality, algorithmsArray/Chunk/Record/Hash collections, Graph, Trie, HashRing, BigDecimal, primitive and protocol modules
Files, paths, terminal, cryptoFileSystem, Path, Stdio, Terminal, Crypto, platform implementations
Logs, traces, metrics, diagnosticsLogger, LogLevel, Tracer, Metric, ErrorReporter; unstable effect/observability, effect/devtools
HTTP, typed APIs, sockets, addresses, RPCunstable effect/http, effect/http-api, effect/socket, effect/net, effect/rpc
Database, models, migrationsunstable effect/sql, effect/schema; SQL driver packages
Persistence, rate limits, event sourcingunstable effect/persistence, effect/eventlog
AI, tools, MCP, embeddings, structured decisionsunstable effect/ai (incl. Decision / DecisionModel); provider packages
UI state, invalidation, hydrationunstable effect/reactivity; React/Solid/Vue bindings
Commands, subprocesses, worker poolsunstable effect/cli, effect/process, effect/workers
Distributed entities, durable workunstable effect/cluster, effect/workflow
Byte and wire formatseffect/encoding: Base64, Base64Url, Hex (stable); NDJSON, SSE, YAML, TOML, INI, SchemaBinary (unstable). MessagePack was removed
Tests, property checks, generated docs/clientseffect/testing, unstable Arbitrary, @effect/vitest, docgen/doctest/OpenAPI tools

Exact inventories: core and testing, all subpath areas, all public packages.

Workflow

  1. Inspect the local Effect surface: effect / @effect/* versions, import style (from "effect" vs effect/Effect), runtime (CLI, HTTP, worker, browser, test), and whether layers/config/platform are already in play.
  2. Prefer a local checkout of Effect-TS/effect at the installed release tag (e.g. [email protected]) under .temp/effect. Effect-TS/effect-smol is archived; v4 lives in Effect-TS/effect (main), v3 on branch v3. Browse sources, LLMS.md, MIGRATION.md, migration/*, packages/effect/SCHEMA.md, and ai-docs/. Details: source-map.md.
  3. Refresh docs when the installed version differs from the snapshot or the task asks for latest APIs. Resolve library docs, then check installed .d.ts.
  4. Route by concern:
  5. Implement the required adoption policy, preserving compatible project conventions: match the installed version, keep framework edges thin, compose layers explicitly, treat @stability unstable areas (effect/http, effect/sql, effect/ai, …) as subject to breaking changes in minor releases and @stability experimental APIs as subject to change in patches.

Coding style (canonical)

From Effect’s own LLMS.md / ai-docs:

  • Inline Effect code uses Effect.gen. Reusable effectful functions use Effect.fn("name") when a tracing span is useful, Effect.fnUntraced for library code and hot paths that are not useful tracing boundaries. Do not write plain functions that only wrap and return Effect.gen; do not .pipe the result of Effect.fn.
  • Domain errors: Schema.TaggedError. Always return yield* when failing so TypeScript narrows.
  • Services: Context.Service, identifier like "myapp/db/Database", implement with Database.of({ ... }), attach static readonly layer. Prefer yield* Service over Service.use except one-liners.
  • Untrusted data: Schema, not ad-hoc predicates. Use Predicate for isString / isObject / composition — do not invent those helpers.
  • Dates/time in Effect programs: DateTime + Clock, not raw Date.now().
  • Observability: logs/traces/metrics in core; new projects prefer effect/observability OTLP. Use @effect/opentelemetry when an existing OTel SDK is required.
  • Process entry: NodeRuntime.runMain / BunRuntime.runMain (BunRuntime is the shared Node runner) or DenoRuntime / BrowserRuntime, or Layer.launch. Prefer those over Runtime.makeRunMain. Cloudflare: no platform package — Fetch + SQL D1/DO drivers.
  • Prefer Stream/Sink over Channel; Schema over SchemaAST; Cache vs ScopedCache vs Pool vs RcMap per concurrency.md.

Judgment

  • Align v4 monorepo integration packages to the same release as effect. Check independent tooling packages against their own peers.
  • TypeScript 5.9+ (7 recommended for Effect’s TS tooling). strict: true. Node 18+ generally; some SQL drivers need Node 22.16+.
  • Config constructors are PascalCase in 4.0 (Config.String, Config.Int, Config.Redacted, Config.URL, …); Config.mapOrFail is Config.mapEffect.
  • No v3 APIs in v4 code: Context.Tag / GenericTag, Effect.Tag / Effect.Service, Either, FiberRef, Effect.catchAll, Effect.fork (use forkChild), Effect.async (use callback).
  • Layers memoize across Effect.provide unless { local: true } or Layer.fresh.
  • Runtime<R> is gone. Run with Effect.run* / run*With(context) or ManagedRuntime.
  • Ref / Deferred / Fiber are not yieldable Effects — use Ref.get, Deferred.await, Fiber.join.
  • Prefer typed failures over throw/die. Defects are programmer errors.
  • Keep Schema Encoded vs Type visible at boundaries.
  • Tests: @effect/vitest@4 + vitest@^5 (peer >=5 <6). Prefer it.effect (already scoped + TestClock; do not wrap in Effect.scoped). Import TestClock from effect/testing. it.effect suppresses logs; it.live does not.
  • Do not: effect/unstable/* imports (removed in 4.0)/effect/Encoding/effect/testing/FastCheck/lowercase Config.string/catchAll/fork/forkDaemon/Context.Tag/Effect.Service/.Default/Either/FiberRef/Date.now/try/catch in gen/Schema.Date for ISO strings/Union(A,B)/it.effect + extra Effect.scoped.

Module routing (quick)

NeedUse
Workflows, errors, concurrencyEffect, Cause, Exit, Result, Fiber
DIContext, Layer, ManagedRuntime
ConfigConfig, ConfigProvider
Validation / domain typesSchema (+ Schema.Class / TaggedError)
TimeClock, Duration, DateTime, Cron, Schedule
CollectionsArray, Chunk, HashMap, HashSet, Record, Option
One producer, many consumersPubSub
Work queueQueue
Pull streamsStream / Sink / Channel (low-level)
Atomic multi-ref updatesEffect.tx + TxRef / TxQueue / …
HTTP client/servereffect/http + @effect/platform-*
Schema-first HTTP APIeffect/http-api
SQLeffect/sql + @effect/sql-*
LLM / toolseffect/ai + @effect/ai-*
Tests / property checks@effect/vitest, effect/testing, Arbitrary

Every root module: modules-stable.md. Every subpath area: modules-unstable.md.

Verification

  • Typecheck Effect<A, E, R>, layers, Schema encoded/type sides, and installed API names.
  • Review the whole touched use case for hidden Promises, runtime calls, unmanaged resources, and duplicate infrastructure.
  • Test adapter error mapping, cancellation, request cleanup, and application shutdown where those behaviors change.
  • Report justified non-Effect boundaries and any remaining migration work; do not claim complete adoption while gaps remain.
  • @effect/vitest: it.effect, TestClock, Exit/Result, per-test Effect.provide when isolation matters.
  • Schema: valid/invalid input, defaults, excess keys, classes, tagged errors, JSON Schema.
  • Migration scan: v3 imports, Either, FiberRef, old catch/fork/runtime/Schema APIs; RC leftovers (effect/unstable/, effect/Encoding, FastCheck, lowercase Config.*, old Schema.is* check names).

Comments

Markdown supported