effect-ts

Guides Effect TypeScript development with typed errors, services, layers, and testing patterns.

4|Updated Jul 13, 2024
One-click install
npx skills add https://github.com/PunGrumpy/og-tester --skill effect-ts-pungrumpy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-ts
Source: https://github.com/PunGrumpy/og-tester/tree/main/.agents/skills/effect-ts
Command: npx skills add https://github.com/PunGrumpy/og-tester --skill effect-ts-pungrumpy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing idiomatic Effect code is hard because the library offers many ways to accomplish the same task, and teams struggle to apply consistent patterns for error handling, dependency injection, and testing across a codebase. ## Core Features & Use Cases - Effect Pattern Guidance: Provides curated guides for core Effect usage, error handling, layers, observability, retries, schedules, schemas, SQL, and testing. - Vendored Source Research: Directs research into a local vendored Effect repository for exact API signatures and implementation details when guides are insufficient. - Installation & Versioning Rules: Enforces aligned effect@beta and @effect/* package versions matched to the target runtime (Node, Browser, Bun, Vitest). - Use Case: When adding a new service to an Effect-based project, the Skill ensures you define it with Context.Service, build it with Layer.effect, handle failures with Schema.TaggedErrorClass, and provide layers only at the application boundary. ## Quick Start Ask the assistant to implement a new Effect service with typed error handling and layer-based dependency injection following this repository's Effect conventions.

Frequently Asked Questions about effect-ts

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I define services and layers in Effect TypeScript?

Define services with Context.Service using class syntax, then build implementations with Layer.succeed for pure values or Layer.effect for effectful construction with dependencies. Compose layers with Layer.mergeAll, Layer.provide, or Layer.provideMerge, and provide them only at the application boundary.

How do I handle typed errors in Effect?

Prefer Schema.TaggedErrorClass for schema-backed errors and Data.TaggedError for non-serializable domain errors. Recover with Effect.catchTag or Effect.catchTags, and keep failures, defects, and interrupts distinct using Cause inspection only when needed.

Should I use Effect.fn or Effect.gen for business logic?

Use Effect.fn for reusable effectful operations, including functions with no arguments, and Effect.gen for inline workflow orchestration with multiple yield steps. Avoid Effect.fnUntraced except for measured low-level hot paths.

Which Effect packages should I install for Node.js or Bun?

Install effect@beta as the core library, then add the matching @effect/platform-node, @effect/platform-browser, or @effect/platform-bun for your runtime. Keep all @effect/* packages on aligned versions and add @effect/vitest or @effect/opentelemetry only when needed.

When should I avoid providing layers inside business logic?

Avoid Effect.provide deep inside business functions because it hides wiring, complicates testing, and fragments the application graph. Compose layers once and provide them at the entrypoint, or use ManagedRuntime when a framework has multiple entry points.