name: "effect-ts"
description: "Strongly opinionated Effect-TS coding, refactoring, debugging, and testing guidance for TypeScript projects using the effect ecosystem. Use when the user is working with Effect, Effect.Schema, Context.Tag, Layer, fibers/concurrency, Stream/Sink, @effect/vitest, @effect/platform, retries/schedules, or migrating from Promise/fp-ts/ZIO-style code to idiomatic Effect. Do not use for generic English uses of the word effect unrelated to the Effect-TS library."
Effect-TS
Use this skill for TypeScript work in the Effect ecosystem. Be strongly opinionated toward idiomatic, testable Effect code and use the bundled scripts to verify exact API/docs details from official sources.
Stance (important)
Default to these patterns unless the user explicitly asks otherwise:
- Prefer
Effect.genfor sequential workflows. - Push I/O behind services (
Context.Tag) and provide implementations viaLayer. - Use
Schemaat boundaries (decode/encode/validation) instead of ad hoc parsing. - Prefer typed failures (
Data.TaggedErroror domain error types) over thrown exceptions. - Treat raw
Promiseas a boundary concern only. - Prefer
@effect/vitest(it.effect,it.scoped,it.live,it.layer,it.prop) for tests. - Keep domain logic pure and dependency-injected.
Prerequisite check (Bun-first)
The bundled helper scripts are Bun-first.
command -v bun >/dev/null 2>&1 && bun --version
If Bun is missing:
- Read the relevant
references/*.mdfiles directly. - Use links from
references/source-links.md. - Provide commands/examples in Bun-first style, but also note Node alternatives if the repo is not using Bun.
Quick start (scripts)
Set the wrapper path once:
export EFFECT_SKILL="/Users/timbo/workspace/personal/effect-codex/skills/effect-ts/scripts/effect.sh"
Common commands:
"$EFFECT_SKILL" cache status
"$EFFECT_SKILL" cache refresh
"$EFFECT_SKILL" docs search "TestClock"
"$EFFECT_SKILL" docs search "Effect vs Promise" --full --limit 5
"$EFFECT_SKILL" docs section --heading "Fibers" --max-lines 80
"$EFFECT_SKILL" docs section --link "https://effect.website/docs/testing/testclock/"
"$EFFECT_SKILL" api search "Stream.mapEffect" --limit 10
Routing workflow (intent x domain)
- Classify the user intent:
build,refactor,debug,test,migrate,explain,performance. - Classify the domain: core runtime, schema, services/layers, concurrency, streams, platform, testing, advanced.
- Open the matching reference file(s) from the list below.
- Use scripts for exact/latest API and docs confirmation before making claims about signatures or behavior.
- Implement/refactor with the guardrails in this file + the domain reference.
Fast routing matrix
build+ core/services: openreferences/core-effect-runtime.mdandreferences/services-context-layer.mdrefactorfrom async/await: openreferences/migration-and-comparisons.md,references/code-style-and-anti-patterns.mddebugfailures/interruption: openreferences/errors-cause-exit.md,references/concurrency-fibers.mdtest: openreferences/testing.mdand anexamples-testingsnippetschemaboundary/data parsing: openreferences/schema.mdandreferences/examples-schema-services.mdstreams: openreferences/streams-and-sinks.mdandreferences/examples-streams.mdplatformfilesystem/http/runtime: openreferences/platform-runtime-filesystem-http.mdandreferences/examples-platform.mdperformance/parallelism/backpressure: openreferences/concurrency-fibers.md,references/streams-and-sinks.md,references/state-caching-queues-pubsub.md- advanced/niche package work: open
references/advanced-ai-workflow.mdorreferences/advanced-ecosystem.md, then verify live docs with scripts
Core guardrails (hard rules)
Architecture
- Do not embed external I/O directly into business logic when a service boundary is appropriate.
- Prefer
Context.Tagservice interfaces +Layerwiring for dependencies. - Separate live layers from test layers.
- Keep
Effect.run*at app boundaries, CLI entrypoints, or tests (not scattered through domain code).
Error handling
- Prefer
Effect.fail/ typed error values overthrow. - Convert exceptions at boundaries with
Effect.try/Effect.tryPromise. - Inspect rich failure information with
Cause/Exitwhen debugging.
Data boundaries
- Prefer
Schema.decodeUnknown,Schema.parseJson, and schema transformations for inputs/outputs. - Avoid raw
JSON.parsein domain logic unless immediately wrapped and validated.
Concurrency
- Be explicit about parallel vs sequential execution.
- Use Effect concurrency operators/fibers rather than ad hoc shared mutable state.
- Respect interruption and scope lifecycles when introducing background work.
Testing
- Prefer
@effect/vitesthelpers over manually callingEffect.runPromiseinside plain Vitest tests. - Test services with
Layer-provided test doubles/in-memory implementations. - Use
TestClockfor time-dependent logic; do not wait on real time in unit tests.
Open only what you need (progressive disclosure)
Core references
references/workflow-routing.md— task classification, repo inspection, first-command choicesreferences/code-style-and-anti-patterns.md— idioms and anti-patterns (strongly opinionated)references/core-effect-runtime.md—Effect<A, E, R>fundamentals and runtime entrypointsreferences/errors-cause-exit.md— failure semantics and debuggingreferences/services-context-layer.md— services, layers, dependency graphsreferences/concurrency-fibers.md— fibers, interruption, racing, coordinationreferences/resource-management-scope.md— scope/finalization and resource lifecyclesreferences/schema.md— Schema workflows, decoding, transformations, Arbitrary tie-insreferences/testing.md—@effect/vitest,TestClock, property tests, service test layersreferences/streams-and-sinks.md— stream/sink workflows and debuggingreferences/state-caching-queues-pubsub.md— state primitives, queues, pubsub, cachereferences/scheduling-and-retries.md— schedules, retries, backoff, jitterreferences/platform-runtime-filesystem-http.md—@effect/platformruntime and I/O boundariesreferences/observability.md— logs/traces/metrics guidancereferences/data-types-and-pattern-matching.md— Option/Either/Cause/etc. and Matchreferences/migration-and-comparisons.md— Promise/fp-ts/ZIO migrations and comparisons
Advanced opt-in references
references/advanced-ai-workflow.md— Effect AI/workflow docs and usage notes (volatile; verify live docs)references/advanced-ecosystem.md— niche/advanced packages (volatile; verify live docs/API)
Snippet packs (examples only)
references/examples-core.mdreferences/examples-testing.mdreferences/examples-streams.mdreferences/examples-schema-services.mdreferences/examples-platform.md
Link index
references/index.md— master navigationreferences/source-links.md— canonical upstream links by category
Script usage details
scripts/effect.sh
Wrapper for all helper scripts. Use it instead of calling .ts files directly.
cache status— report cache freshness and file sizescache refresh [--force]— refresh upstream docs/index artifacts into local cachedocs search— searchllms.txtorllms-full.txtdocs section— extract a doc section by heading regex or docs URLapi search— search the official API docs index for symbols/pages
scripts/effect-docs-search.ts
Use when you need official docs discovery or keyword lookup (topics, guides, testing concepts, migration docs).
scripts/effect-docs-section.ts
Use when you need to pull the exact section text context (e.g. Fibers, TestClock, schedules, schema features).
scripts/effect-api-search.ts
Use when the task depends on exact API doc pages or symbol names (e.g. Fiber, Deferred, Stream.mapEffect, Layer.provide).
Source-of-truth policy
- Local references are for workflow guidance, idioms, anti-patterns, and curated snippets.
- Official docs + API docs are the source of truth for exact signatures and behavior.
- For advanced/volatile packages (AI/workflow/niche ecosystem), always verify current docs with the bundled scripts before answering.
Output expectations when using this skill
- Explain the chosen Effect architecture (services/layers/errors/schema boundaries) briefly.
- Show idiomatic code, not just API trivia.
- Name failure modes (typed errors, interruption, resource cleanup, backpressure, retries) when relevant.
- For tests, prefer deterministic test layers and
TestClockover real side effects/time.