effect-v4-services-layers

Standardize Effect v4 service definitions and layer composition in TypeScript.

2|Updated Jul 2, 2026
One-click install
npx skills add https://github.com/spencerbeggs/effected --skill effect-v4-services-layers
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-v4-services-layers
Source: https://github.com/spencerbeggs/effected/tree/main/plugin/skills/effect-v4-services-layers
Command: npx skills add https://github.com/spencerbeggs/effected --skill effect-v4-services-layers

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the complexity of migrating to or implementing Effect v4, specifically resolving common pitfalls in service definition, layer composition, and memoization that often lead to silent runtime failures or inefficient resource usage.

Core Features & Use Cases

  • Service Architecture: Provides the definitive guide for the Context.Service class form, ensuring correct dependency injection and type safety.
  • Layer Composition: Offers best practices for building, merging, and providing layers to prevent common issues like cycle-avoidance and improper memoization.
  • Use Case: Use this guide when refactoring a legacy Effect v3 codebase to v4 to ensure that database pools, HTTP clients, and configuration services are wired correctly and performantly.

Quick Start

Consult the effect-v4-services-layers skill to verify the correct implementation pattern for a new service layer using the Context.Service class form.

Frequently Asked Questions about effect-v4-services-layers

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

FAQPage Schema
How do I define an Effect v4 service using the Context.Service class form?

To define an Effect v4 service, use the Context.Service class form to ensure correct dependency injection and type safety. This standardizes service architecture and prevents silent runtime failures caused by improper service tagging.

What is the best way to compose layers in Effect v4 without memoization issues?

The best way to compose layers in Effect v4 is by following established best practices for building, merging, and providing layers. This ensures proper memoization and cycle-avoidance, preventing inefficient resource usage during dependency injection.

Why does my Effect v4 scoped resource runtime fail silently after migrating from v3?

Silent runtime failures in Effect v4 scoped resources often stem from incorrect service definition and layer composition. Properly wiring database pools and HTTP clients using Context.Service resolves these lifecycle management and memoization pitfalls.

When do I need to use layer composition for dependency injection in TypeScript Effect?

You need layer composition for dependency injection in TypeScript Effect when building modular, type-safe applications. It is essential for managing the lifecycle of scoped resources and ensuring robust resource memoization across your architecture.

Can I use Effect v4 layers to manage database pools and HTTP clients?

Yes, you can use Effect v4 layers to manage database pools and HTTP clients. Proper layer construction and lifecycle management ensure these scoped resources are wired correctly, performantly, and efficiently memoized.

What are the limitations of improper layer merging in Effect v4?

Improper layer merging in Effect v4 leads to inefficient resource usage and silent runtime failures. Without correct layer construction and memoization practices, your dependency injection cycles may break and resource lifecycle management fails.