Agent skill · software engineering · aiskillstore

fp-ts-errors

Handle errors as values using fp-ts Either and TaskEither for cleaner, more predictable TypeScript code. Use when implementing error handling patterns with fp-ts.

Why this skill is useful

Provides specific patterns and implementations for error handling in TypeScript using fp-ts, which the AI may not generate on its own.

What it needs

About 11k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.

What this skill does

Practical Error Handling with fp-ts This skill teaches you how to handle errors without try/catch spaghetti. No academic jargon - just practical patterns for real problems. When to Use This Skill When you want type-safe error handling in TypeScript When replacing try/catch with Either and TaskEither patterns When building APIs or services that need explicit error types When accumulating multiple validation errors The core idea: Errors are just data. Instead of throwing them into the void and hoping someone catches them, return them as values that TypeScript can track. --- 1. Stop Throwing Everywhere The Problem with Exceptions Exceptions are invisible in your types. They break the contract between functions. You end up with code like this: The Solution: Return Errors as Values --- 2. The Result Pattern (Either) Either<E, A> is simple: it holds either an error (E) or a value (A). Left = error case Right = success case (think "right" as in "correct") Converting Throwing Code to Either Common Either Operations --- 3. Chaining Operations That Might Fail The real power comes from chaining. Each step can fail, but you write it as a clean pipeline. Before: Nested Try/Catch Hell After: Clean Chain with Either Different Error Types? Use chainW --- 4. Collecting Multiple Errors Sometimes you want ALL errors, not just the first one. Form validation is the classic example. Before: Collecting Errors Manually After: Validation with Error Accumulation Field-Level Errors for Forms --- 5. Async Operations (TaskEither) For async operations that can fail, use TaskEither. It's like Either but for promises. TaskEither<E, A> = a function that returns Promise<Either<E, A>> Lazy: nothing runs until you execute it Before: Promise Chain with Error Handling After: Clean TaskEither Pipeline Retry Failed Operations Fallback to Alternative --- 6. Converting Between Patterns Real codebases have throwing functions, nullable values, and promises. Here's how to work with them. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills aiskillstore/fp-ts-errors

View the source on GitHub

Browse the @skills marketplace