# Build Type-Safe Errors with fp-ts

Unchecked exceptions make TypeScript failures difficult to track. This skill teaches practical Either and TaskEither patterns for explicit, composable error handling.

## Install

```bash
npx skillstore add sickn33/fp-ts-errors
```

## Metadata

- Status: approved
- Slug: sickn33-fp-ts-errors
- Skillstore revision: r2
- Version status: missing
- Tree hash: 06754445e91eeee0067dfd619b4cc4d0a4627098f3dda0a5600f2563b3c1d6ff
- Author: sickn33
- GitHub username: sickn33
- License: MIT
- Repository: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/fp-ts-errors
- Ref: 88a8e9a07f4c54ab105c1c41b6267c287146b07b
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands, network
- Quality score: 76
- Public page: https://skillstore.pages.dev/skills/sickn33-fp-ts-errors
- Manifest: https://skillstore.pages.dev/api/skills/sickn33-fp-ts-errors/manifest

## Capabilities

- Explains Either, Left, and Right through practical TypeScript examples.
- Converts throwing functions and nullable values into typed error results.
- Chains synchronous and asynchronous operations with Either and TaskEither.
- Accumulates multiple validation failures with applicative validation.
- Wraps Promise, fetch, database, and schema boundaries with TaskEither.
- Models partial success for list and bulk operations.

## Use Cases

- Refactor Exception-Based Code: Replace hidden exceptions with typed Either results and explicit handling paths.
- Design Reliable Service Pipelines: Compose database and API operations with TaskEither, typed failures, retries, and fallbacks.
- Collect Form Validation Errors: Build validators that report every field failure instead of stopping after the first error.

## Prompt Templates

### Understand Either

```
Explain Either, Left, and Right using a simple TypeScript parsing example.
```

### Refactor Throwing Code

```
Refactor my throwing TypeScript function into Either and explain each error type.
```

### Accumulate Validation Failures

```
Design fp-ts validation for these fields and return all failures with field-specific messages.
```

### Compose Async Failure Paths

```
Design a TaskEither workflow for these API and database steps, including typed errors, retries, fallbacks, and final handling.
```

## Limitations

- Provides guidance and examples but does not install fp-ts or edit projects automatically.
- Uses illustrative placeholders that require adaptation to project types and dependencies.
- Focuses on fp-ts patterns rather than comparing every TypeScript result library.
- Does not replace project-specific testing, observability, or security review.

## Best Practices

- Define precise error types before composing business operations.
- Convert exceptions, nullable values, and promises at system boundaries.
- Handle both error and success branches once at the edge of the workflow.

## Anti Patterns

- Do not hide failures with broad defaults when callers need error details.
- Do not mix unchecked exceptions into an otherwise typed Either pipeline.
- Do not retry every failure without limits or error classification.

## Security Audit

- Audited at: 2026-07-23T22:27:26.301\+00:00
- Summary: The audit reviewed all 100 static findings in SKILL.md. Every match is a false positive caused by Markdown formatting, TypeScript examples, repository metadata, or ordinary application logic; no executable shell behavior, host reconnaissance, prompt injection, or skill-initiated network access was found.

## Stats

- Views: 96
- Downloads: 8
- Favorites: 0
- Popularity score: 0
