effect-best-practices

Enforces Effect-TS patterns for services, errors, layers, and React atoms.

Updated Jun 22, 2026
One-click install
npx skills add https://github.com/aashahin/ai-skills --skill effect-best-practices-aashahin
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: effect-best-practices
Source: https://github.com/aashahin/ai-skills/tree/main/effect-best-practices
Command: npx skills add https://github.com/aashahin/ai-skills --skill effect-best-practices-aashahin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Effect-TS codebases often drift into inconsistent patterns: generic errors that lose context, deeply nested Layer compositions that slow the TypeScript compiler, and untraced service methods. This Skill enforces a single opinionated style guide so every service, error, layer, and atom follows the same type-safe, testable, observable conventions. ## Core Features & Use Cases - Service & Layer Standards: Mandates Effect.Service with accessors and declared dependencies, Layer.mergeAll for flat composition, and Layer.provideMerge for incremental chaining to keep types fast and wiring explicit. - Typed Error Discipline: Requires Schema.TaggedError with rich context fields, catchTag/catchTags handling, and explicit domain errors (e.g., UserNotFoundError) instead of generic HTTP errors. - Frontend & Observability Patterns: Covers effect-atom React integration (Result.builder, reactivityKeys, finalizers), Effect.fn tracing, structured logging, metrics, and validated Config usage. - Use Case: When writing a new UserService with Effect.Service, Schema.TaggedError, and Layer composition, the Skill ensures dependencies are declared in the service, errors carry entity IDs, and the Effect Language Server is configured for edit-time diagnostics. ## Quick Start Review my Effect-TS service code and refactor it to follow the Effect.Service, Schema.TaggedError, and Layer composition best practices.

Frequently Asked Questions about effect-best-practices

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

FAQPage Schema
How do I define services in Effect-TS?▼

Use Effect.Service with accessors set to true and declare dependencies in the dependencies array. This gives you automatic accessors, a built-in Default layer, and proper dependency wiring without manual Layer.provide at usage sites.

How should I handle errors in Effect-TS applications?▼

Define errors with Schema.TaggedError including a message field and relevant context like entity IDs. Handle them with Effect.catchTag or catchTags to preserve type information, and prefer explicit errors like UserNotFoundError over generic NotFoundError.

What is the Effect Language Server and do I need it?▼

The Effect Language Server is a TypeScript plugin (@effect/language-service) that detects Effect-specific issues like floating Effects and missing requirements at edit time. Install it as a devDependency and register it in tsconfig.json compilerOptions plugins.

Layer.mergeAll vs Layer.provide in Effect-TS?▼

Use Layer.mergeAll for flat composition of same-level layers and Layer.provideMerge for incremental chaining. Deeply nested Layer.provide chains create complex recursive types that slow the TypeScript language server.

How do I manage React state with effect-atom?▼

Define atoms outside components with Atom.make, add Atom.keepAlive for persistent global state, and render async results with Result.builder using onErrorTag for typed error handling. Use result.waiting for mutation loading state instead of useState.

Why is Effect.runSync forbidden inside services?▼

Running effects synchronously inside services breaks Effect's composition model, loses error handling and tracing, and makes code untestable. Instead, return Effect values from methods using Effect.fn and let the caller compose and run them.