fp-ts-errors

fp-ts-errors is a skill for Claude Code, Codex from beel-collab/presets.dev. It costs 30 tokens per session (6,004 once invoked), scanned A, original, MIT.

A guide to representing errors as ordinary values in TypeScript with fp-ts, using Either and TaskEither instead of relying on thrown exceptions. This lets function results show success and failure explicitly.

In plain words
What is it for?
Use it when building APIs or services, replacing exception-heavy code, defining explicit error types, or collecting several validation errors.
Why use it?
It makes failure cases visible to TypeScript and avoids spreading try/catch blocks through application code.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when building APIs or services, replacing exception-heavy code, defining explicit error types, or collecting several validation errors.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/beel-collab/presets.dev/fp-ts-errors
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add beel-collab/presets.dev --skill fp-ts-errors
Clone the repo
git clone --depth 1 https://github.com/beel-collab/presets.dev

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for fp-ts-errors

README.md
[![agentmods](https://agentmods.dev/badge/skills/beel-collab/presets.dev/fp-ts-errors.svg)](https://agentmods.dev/skills/beel-collab/presets.dev/fp-ts-errors)
Your own site
<a href="https://agentmods.dev/skills/beel-collab/presets.dev/fp-ts-errors"><img src="https://agentmods.dev/badge/skills/beel-collab/presets.dev/fp-ts-errors.svg" alt="Measured on agentmods" height="20"></a>
Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,004 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00030 $0.06004
Opus 5 $0.00015 $0.03002
Sonnet 5 $0.00006 $0.01201
Haiku 4.5 $0.00003 $0.00600

Measured 4d ago against content hash 56c32c59325c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

fp-ts-errors scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

() => fetch(url).then(r => r.json()),
claude/skills/development/fp-ts-errors/SKILL.md · 864 lines

How it starts

The opening of the file, as written. The whole thing — 864 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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.

// What this function signature promises:
function getUser(id: string): User

// What it actually does:
function getUser(id: string): User {
  if (!id) throw new Error('ID required')
  const user = db.find(id)
  if (!user) throw new Error('User not found')
  return user
}

// The caller has no idea this can fail
const user = getUser(id) // Might explode!

You end up with code like this:

// MESSY: try/catch everywhere
function processOrder(orderId: string) {
  let order
  try {
    order = getOrder(orderId)
  } catch (e) {
    console.error('Failed to get order')
    return null
  }

  let user
  try {
    user = getUser(order.userId)
  } catch (e) {
    console.error('Failed to get user')
    return null
  }

  let payment
  try {
    payment = chargeCard(user.cardId, order.total)
  } catch (e) {
    console.error('Payment failed')
    return null
  }

  return { order, user, payment }
}

The Solution: Return Errors as Values

import * as E from 'fp-ts/Either'
import { pipe } from 'fp-ts/function'

// Now TypeScript KNOWS this can fail
function getUser(id: string): E.Either<string, User> {
  if (!id) return E.left('ID required')
  const user = db.find(id)
  if (!user) return E.left('User not found')
  return E.right(user)
}

// The caller is forced to handle both cases
const result = getUser(id)
// result is Either<string, User> - error OR success, never both

Read the full file on GitHub · 864 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 864 lines · 30 tokens per session scan A 56c32c59325c

Subscribe to this mod's changes

fp-ts-errors is a skill published in the GitHub repository beel-collab/presets.dev (2 stars, last pushed 4mo ago), licensed MIT. It adds 30 tokens to every session and 6,004 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

typescript-development

You MUST activate this skill when working on TypeScript or JavaScript projects.

sammcj/agentic-coding · 17 tokens

chat-sdk

Build multi-platform chat bots with Chat SDK (chat npm package). Use when developers want to (1) Build a Slack, Teams, Google Chat, Discord, Telegram, GitHub, Linear, or WhatsApp bot, (2) Use Chat SDK to handle mentions, direct messages, subscribed threads, reactions, slash commands, cards, modals, files, or AI…

vercel-labs/open-agents · 191 tokens

azure-identity-ts

Authenticate to Azure services using Azure Identity library for JavaScript (@azure/identity). Use when configuring authentication with DefaultAzureCredential, managed identity, service principals, or interactive browser login.

microsoft/skills · 41 tokens

agents-sdk-typescript

Use when any code imports @microsoft/agents-hosting, @microsoft/agents-hosting-express, or related Agents SDK packages, or when the user is building, configuring, or asking questions about a Microsoft 365 Agents SDK agent in TypeScript. Trigger on questions about environment variables, connection configuration…

microsoft/Agents · 111 tokens

agents-sdk-typescript-debugging

Use when troubleshooting an agent built with the Microsoft Agents SDK (@microsoft/agents-hosting and related packages). Trigger on any of these symptoms: build or TypeScript errors, crashes on startup, 401 or auth errors on incoming requests, the bot not responding to messages, .env configuration problems, Azure AD…

microsoft/Agents · 125 tokens

swift-development

You MUST activate this skill when working on Swift projects.

sammcj/agentic-coding · 13 tokens