effect-ts-patterns
CommunityType-safe effects, explicit errors, clear dependencies.
Software Engineering#type safety#typescript#error handling#functional programming#effect-ts#dependency injection#services#layers
Authoraitchwhy
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill provides comprehensive patterns for Effect-TS, enabling developers to write highly robust, type-safe, and composable code by making effects, errors, and dependencies explicit in the type system. It eliminates untyped exceptions and simplifies complex asynchronous logic.
Core Features & Use Cases
Effect<A, E, R>Type System: Guides on understanding and utilizing the coreEffecttype, which explicitly declares success (A), error (E), and required services (R) in its signature.- Service Pattern (DI): Defines services with
Context.Tagand implements them withLayerfor powerful, type-safe dependency injection, ensuring clear separation of concerns. - Typed Errors: Uses
Data.TaggedErrorfor defining and recovering from specific, type-safe errors, making error handling explicit and exhaustive. - Advanced Operations: Patterns for retries with schedules, timeouts, parallel execution, and resource management (
acquireRelease), building resilient applications. - Use Case: A developer is building a complex data processing pipeline that involves multiple external API calls and database interactions, each with potential failures. They can use this skill to define each step as an
Effect, manage dependencies withLayers, handle errors withcatchTag, and implement retries, ensuring a resilient and type-safe pipeline.
Quick Start
Refactor the 'fetchUserData' function in 'src/services/user.ts' to return an 'Effect<User, NetworkError, HttpClient>', explicitly defining its success, error, and dependency types.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: effect-ts-patterns Download link: https://github.com/aitchwhy/dotfiles/archive/main.zip#effect-ts-patterns Please download this .zip file, extract it, and install it in the .claude/skills/ directory.