skills/effect-ts/SKILL.md
This skill should be used when the user asks about Effect-TS patterns, services, layers, error handling, service composition, or writing/refactoring code that imports from 'effect'. Also covers Effect + Next.js integration with @prb/effect-next.
npx skillsauth add paulrberg/dot-agents 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
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.
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.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 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.
~/.effect/packages/effect/src/ — Core Effect modules and implementation./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/quick-utils.md — Array/Order, utility helpers, deprecations./references/runtime.md — Resource management, Duration, Scheduling, State, SubscriptionRef, Concurrency./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 patternscontent-media
Summarize or transcribe URLs, YouTube/videos, podcasts, articles, transcripts, PDFs, and local files.
tools
Use Obscura — a Rust headless browser with a Chrome DevTools Protocol server — for fast page fetches, JS execution, scraping, and CDP automation. Drop-in CDP replacement for Chrome with Puppeteer or Playwright. Trigger on requests to "open a page", "fetch a URL with JS", "scrape a site", "render this page", "automate browser via CDP", or any task where Chrome would be too heavy. Also use when the user mentions stealth fingerprinting, tracker blocking, `navigator.webdriver` masking, or evading basic bot detection.
tools
Use the Notion CLI (`ntn`) to interact with the Notion API, manage workers, and upload files. Use when the user asks to "call the Notion API", "deploy a worker", "upload a file to Notion", "create a page", "query a database", or any task involving the `ntn` command.
data-ai
This skill should be used when the user asks to "open CoinGecko historical data", "show historical price on date X", "open coingecko historical page", or wants to view the CoinGecko historical-data page for a coin around a given date in their default browser.