effect-ts

Guide writing and reviewing idiomatic Effect-TS code with typed errors and Layers.

9|12|Updated Sep 18, 2025
One-click install
npx skills add https://github.com/midnightntwrk/midnight-sdk --skill effect-ts-midnightntwrk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: effect-ts
Source: https://github.com/midnightntwrk/midnight-sdk/tree/main/.claude/skills/effect-ts
Command: npx skills add https://github.com/midnightntwrk/midnight-sdk --skill effect-ts-midnightntwrk

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the complexity of functional TypeScript by providing expert guidance on managing side effects, dependency injection, and error handling, preventing common anti-patterns in Effect-based codebases.

Core Features & Use Cases

  • Typed Error Handling: Learn to use tagged errors and unions to ensure type-safe failure recovery.
  • Dependency Injection: Master the use of Layers and Context to build modular, testable services.
  • Concurrency & Streams: Implement high-performance parallel tasks and data streams using Fibers and Stream primitives.
  • Use Case: When refactoring a legacy service to use Effect, use this Skill to design a proper Layer composition and replace untyped errors with a robust, domain-specific error hierarchy.

Quick Start

Use the effect-ts skill to refactor the provided service to use dependency injection with Layers and tagged errors.

Frequently Asked Questions about effect-ts

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

FAQPage Schema
How do I handle errors in TypeScript using tagged errors and unions?

Dependency injection in TypeScript uses Layers and Context to build modular, testable services. Layers allow you to compose services and manage their lifecycles, making it easier to isolate dependencies and mock them during testing without altering core business logic.

What is the best way to implement concurrency in functional TypeScript?

Fiber-based concurrency patterns implement high-performance parallel tasks in functional TypeScript. Fibers provide lightweight, cooperative multitasking primitives that enable you to run concurrent operations safely and manage their cancellation or interruption robustly.

How do I refactor a legacy service to use Effect for dependency injection?

Refactoring a legacy service to use Effect involves designing a proper Layer composition and replacing untyped errors with a robust, domain-specific error hierarchy. This transition ensures production-ready service composition and eliminates common side-effect anti-patterns.

Does functional TypeScript with Effect support data streams and resource management?

Functional TypeScript with Effect supports data streams and resource management through Stream primitives. Streams enable high-performance processing of asynchronous data pipelines, while built-in resource management ensures safe acquisition and release of external resources.

Why should I use typed errors instead of untyped exceptions in TypeScript?

Typed errors prevent common anti-patterns by ensuring type-safe failure recovery, unlike untyped exceptions. By using tagged errors and unions, you explicitly define potential failure states in the function signature, forcing the compiler to verify that all error cases are handled.