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.
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.
When to Use
- You need to replace exception-heavy code with
Either or TaskEither.
- The task involves validation, domain errors, or clearer error contracts in TypeScript.
- You want pragmatic fp-ts error-handling guidance for real application code.
Core Workflow
- Confirm the request matches this skill's trigger, scope, and risk profile.
- Use the topic map to identify the relevant pattern, checklist, or example before writing detailed guidance or code.
- Load
references/full-guidance.md when implementation details, examples, anti-patterns, validation checks, or edge cases are needed.
- Apply only the relevant guidance instead of loading or repeating the entire reference by default.
- Verify the result against any validation checks, limitations, security notes, or platform constraints in the reference.
Topic Map
- Stop Throwing Everywhere
- The Problem with Exceptions
- The Solution: Return Errors as Values
- The Result Pattern (Either)
- Converting Throwing Code to Either
- Common Either Operations
- Chaining Operations That Might Fail
- Before: Nested Try/Catch Hell
- After: Clean Chain with Either
- Different Error Types? Use chainW
- Collecting Multiple Errors
- Before: Collecting Errors Manually
- After: Validation with Error Accumulation
- Field-Level Errors for Forms
- Async Operations (TaskEither)
- Before: Promise Chain with Error Handling
- After: Clean TaskEither Pipeline
- Retry Failed Operations
Reference Map
references/full-guidance.md preserves the complete original guidance, including examples and detailed edge cases.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Progressive Loading
Keep this SKILL.md as the compact routing and workflow entrypoint. Load the reference file only when the user task requires the deeper implementation material.
1---2name: fp-errors3description: Stop throwing everywhere - handle errors as values using Either and TaskEither for cleaner, more predictable code4license: MIT5---67# Practical Error Handling with fp-ts89This skill teaches you how to handle errors without try/catch spaghetti. No academic jargon - just practical patterns for real problems.1011The 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.1213## When to Use14- You need to replace exception-heavy code with `Either` or `TaskEither`.15- The task involves validation, domain errors, or clearer error contracts in TypeScript.16- You want pragmatic fp-ts error-handling guidance for real application code.17- --1819## Core Workflow201. Confirm the request matches this skill's trigger, scope, and risk profile.212. Use the topic map to identify the relevant pattern, checklist, or example before writing detailed guidance or code.223. Load `references/full-guidance.md` when implementation details, examples, anti-patterns, validation checks, or edge cases are needed.234. Apply only the relevant guidance instead of loading or repeating the entire reference by default.245. Verify the result against any validation checks, limitations, security notes, or platform constraints in the reference.2526## Topic Map27- Stop Throwing Everywhere28- The Problem with Exceptions29- The Solution: Return Errors as Values30- The Result Pattern (Either)31- Converting Throwing Code to Either32- Common Either Operations33- Chaining Operations That Might Fail34- Before: Nested Try/Catch Hell35- After: Clean Chain with Either36- Different Error Types? Use chainW37- Collecting Multiple Errors38- Before: Collecting Errors Manually39- After: Validation with Error Accumulation40- Field-Level Errors for Forms41- Async Operations (TaskEither)42- Before: Promise Chain with Error Handling43- After: Clean TaskEither Pipeline44- Retry Failed Operations4546## Reference Map47- `references/full-guidance.md` preserves the complete original guidance, including examples and detailed edge cases.4849## Limitations50- Use this skill only when the task clearly matches the scope described above.51- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.52- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.5354## Progressive Loading55Keep this `SKILL.md` as the compact routing and workflow entrypoint. Load the reference file only when the user task requires the deeper implementation material.