skills/effect-ts/SKILL.md
Use for Effect-TS code and patterns including services, layers, errors, Schema/JSONSchema, @effect/ai tools, code importing from `effect`, or @prb/effect-next.
npx skillsauth add paulrberg/agent-skills effect-tsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Expert guidance for functional programming with the Effect library, covering error handling, dependency injection, composability, and testing patterns.
Before starting any Effect-related work, verify the Effect-TS source code exists at ~/.effect.
If missing, stop immediately and inform the user. Clone it before proceeding:
git clone https://github.com/Effect-TS/effect.git ~/.effect
Last checked against ~/.effect HEAD 05d72eab7 from 2026-06-05:
[email protected]@effect/[email protected]@effect/[email protected]@effect/[email protected]@effect/[email protected]@effect/[email protected]If git -C ~/.effect log -1 --oneline is newer, inspect the touched package changelogs and commits before relying on
this skill. Capture public API or guidance changes in a reference file.
Effect-TS has many ways to accomplish the same task. Proactively research best practices using the Task tool to spawn research agents when working with Effect patterns, especially for moderate to high complexity tasks.
Codebase Patterns First — Examine similar patterns in the current project before implementing. If Effect patterns exist in the codebase, follow them for consistency. If no patterns exist, skip this step.
Effect Source Code — For complex type errors, unclear behavior, or implementation details, examine the Effect
source at ~/.effect/packages/effect/src/. This contains the core Effect logic and modules.
Package Changelogs — When behavior changed recently, read the relevant changelog under ~/.effect/packages/*/
before inferring from old examples.
HIGH Priority (Always Research):
MEDIUM Priority (Research if Complex):
When working in a project that uses Effect, check for existing patterns before implementing new code:
'effect' to understand existing usageIf no Effect patterns exist in the codebase, proceed using canonical patterns from the Effect source and examples. Do not block on missing codebase patterns.
Apply these core principles when writing Effect code:
Effect.fail, Effect.catchTag, Effect.catchAll for error control flow./references/critical-rules.md for forbidden patternsContext.TagLayer.merge, Layer.provideEffect.provide to inject dependenciesEffect.succeed, Effect.fail, Effect.tryPromise, Effect.tryEffect.flatMap, Effect.map, Effect.tapEffect.gen for readable sequential codeEffect.fn() for automatic telemetry and better stack tracesRead and internalize ./references/critical-rules.md before writing any Effect code. Key guidelines:
return yield* pattern for errors (makes termination explicit)Quick links to patterns that frequently cause issues:
unsafeMake is not a function → runtime.mdSchema.Record(String, Never) emits no extra properties →
schema-jsonschema.mdTool.EmptyParams or omit parameters → ai.mdWhen providing solutions, explain the Effect-TS concepts being used and why they're appropriate for the specific use case. If encountering patterns not covered in the documentation, suggest improvements while maintaining consistency with existing codebase patterns (when they exist).
Effect.succeed(value) // Wrap success value
Effect.fail(error) // Create failed effect
Effect.tryPromise(fn) // Wrap promise-returning function
Effect.try(fn) // Wrap synchronous throwing function
Effect.sync(fn) // Wrap synchronous non-throwing function
Effect.flatMap(effect, fn) // Chain effects
Effect.map(effect, fn) // Transform success value
Effect.tap(effect, fn) // Side effect without changing value
Effect.all([...effects]) // Run effects (concurrency configurable)
Effect.forEach(items, fn) // Map over items with effects
// Collect ALL errors (not just first)
Effect.all([e1, e2, e3], { mode: "validate" }) // Returns all failures
// Partial success handling
Effect.partition([e1, e2, e3]) // Returns [failures, successes]
// Define typed errors with Data.TaggedError (preferred)
class UserNotFoundError extends Data.TaggedError("UserNotFoundError")<{
userId: string
}> {}
// Direct yield of errors (no Effect.fail wrapper needed)
Effect.gen(function* () {
if (!user) {
return yield* new UserNotFoundError({ userId })
}
})
Effect.catchTag(effect, tag, fn) // Handle specific error tag
Effect.catchAll(effect, fn) // Handle all errors
Effect.result(effect) // Convert to Exit value
Effect.orElse(effect, alt) // Fallback effect
Categorize errors for appropriate handling:
| Category | Examples | Handling | | ----------------------- | -------------------------- | ------------------------- | | Expected Rejections | User cancel, deny | Graceful exit, no retry | | Domain Errors | Validation, business rules | Show to user, don't retry | | Defects | Bugs, assertions | Log + alert, investigate | | Interruptions | Fiber cancel, timeout | Cleanup, may retry | | Unknown/Foreign | Thrown exceptions | Normalize at boundary |
// Pattern: Normalize unknown errors at boundary
const safeBoundary = Effect.catchAllDefect(effect, (defect) =>
Effect.fail(new UnknownError({ cause: defect }))
)
// Pattern: Catch user-initiated cancellations separately
Effect.catchTag(effect, "UserCancelledError", () => Effect.succeed(null))
// Pattern: Handle interruptions differently from failures
Effect.onInterrupt(effect, () => Effect.log("Operation cancelled"))
When you need to use Effect's Match module for pattern matching, see references/pattern-matching.md.
For schema decoding, JSON Schema generation, closed object shapes, and Schema.Record({ key: Schema.String, value: Schema.Never }), see references/schema-jsonschema.md.
For @effect/ai tool definitions, empty tool parameters, OpenAI strict schema behavior, and prompt cache enum gotchas,
see references/ai.md.
For service definition patterns (Context.Tag, Effect.Service, Context.Reference, Context.ReadonlyTag) and the generator pattern (Effect.gen, Effect.fn), see references/services-layers.md.
For resource lifecycles, durations, scheduling, state management, reactive refs, and concurrency primitives, see references/runtime.md.
When you need to read configuration with Config, handle secrets via Redacted, or wire custom config providers, see references/config.md.
For Effect's Array/Order sorting helpers, small utility functions like constVoid, and the running list of deprecations, see references/quick-utils.md.
For HttpLayerRouter, RpcSerialization.makeMsgPack, and deployment gotchas such as Cloudflare Workers msgpack support,
see references/platform-rpc.md.
~/.effect/packages/effect/src/ — Core Effect modules and implementation./references/ai.md — @effect/ai tools, Tool.EmptyParams, OpenAI provider notes./references/config.md — Config, Redacted, and custom config providers./references/critical-rules.md — Forbidden patterns and mandatory conventions./references/effect-atom.md — Effect-Atom reactive state management for React./references/next-js.md — Effect + Next.js 15+ App Router integration patterns./references/option-null.md — Option vs null boundary patterns./references/pattern-matching.md — Match module for tagged unions and conditionals./references/platform-rpc.md — @effect/platform and @effect/rpc integration notes./references/quick-utils.md — Array/Order, utility helpers, deprecations./references/recent-upstream.md — Recent upstream public changes reflected by this skill./references/runtime.md — Resource management, Duration, Scheduling, State, SubscriptionRef, Concurrency./references/schema-jsonschema.md — Schema decoding and JSON Schema generation patterns./references/services-layers.md — Services, Layers, generator (Effect.gen / Effect.fn)./references/streams.md — Stream patterns and backpressure gotchas./references/testing.md — Vitest deterministic testing patternstesting
Use ONLY to check or update the project-scoped agent skills installed under .agents/skills so they match the current state of the repo. Do not trigger for creating, finding, or installing skills, or for README/AGENTS.md updates.
testing
Use when CSV, TSV, or Excel (.xlsx) is the primary input/output: inspect, clean, transform, dedupe, merge, validate, convert, recalc formulas, or create/fix spreadsheets. Do not trigger when tabular data is incidental.
development
This skill should be used when the user asks to consult Codex/GPT for planning or code review, or wants a second opinion on code. Trigger phrases include "ask Codex", "consult Codex", "second opinion on code", "consult the oracle". NOT for implementation tasks.
databases
This skill should be used when the user asks to create a monochrome technical diagram, schematic, or systems/architecture diagram in black-and-white line-art style. Trigger phrases include "create a diagram", "monochrome diagram", "systems diagram", "draw a schematic".