effect-patterns-services-agents

Implements Effect-TS services and agents using Effect.Service, Layer composition, and tagged error handling.

796|26|Updated Jun 22, 2025
One-click install
npx skills add https://github.com/PaulJPhilp/EffectPatterns --skill effect-patterns-services-agents
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-patterns-services-agents
Source: https://github.com/PaulJPhilp/EffectPatterns/tree/main/.cursor/skills/effect-patterns-services-agents
Command: npx skills add https://github.com/PaulJPhilp/EffectPatterns --skill effect-patterns-services-agents

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Building services and agents in Effect-TS requires consistent patterns for dependency injection, error handling, and layer composition. This Skill provides the conventions and code templates used in the EffectPatterns repository so new services follow the established architecture instead of ad-hoc implementations.

Core Features & Use Cases

  • Effect.Service Pattern: Templates for defining services with Context.Tag and the modern Effect.Service constructor for type-safe dependency injection.
  • Layered Composition: Guidance on merging service layers with Layer.mergeAll and providing them to applications via Effect.provide.
  • Tagged Error Handling: Conventions for defining Data.TaggedError types and recovering with Effect.catchTag.
  • Use Case: When adding a new agent to packages/mcp-server, follow the prescribed module layout (api.ts, schema.ts, service.ts, types.ts, tests/) and wire it into the application layer.

Quick Start

Ask the AI to scaffold a new Effect.Service-based agent following the repo conventions with tagged errors and layer composition.

Frequently Asked Questions about effect-patterns-services-agents

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

FAQPage Schema
How do I create a service in Effect-TS with dependency injection?

Define a class extending Context.Tag or use the modern Effect.Service constructor with an effect that returns the service implementation. Consumers access it with yield* MyService inside Effect.gen, and layers provide the implementation at runtime.

How to compose multiple Effect services with Layer?

Combine service layers using Layer.mergeAll to build a single application layer, then supply it to your program with Effect.provide. This wires all dependencies, such as config, cache, and rate limiter services, into the effect's context.

How does error handling work in Effect-TS?

Errors are modeled as typed values using Data.TaggedError classes rather than thrown exceptions. Recover from specific failures with Effect.catchTag, which matches on the error's tag and lets you handle each failure type explicitly.

What is the difference between Context.Tag and Effect.Service?

Context.Tag is the classic way to declare a service identifier and its interface. Effect.Service is the newer form that generates the tag and layer together from a single definition, reducing boilerplate for common service setups.

Can I use path aliases in an Effect-TS monorepo?

This repository's convention avoids path aliases entirely. Use workspace:* dependencies between packages and run scripts from the project root so module resolution works correctly during debugging and execution.