errore

errore is a skill for Claude Code from saffron-health/libretto. It costs 192 tokens per session (6,760 once invoked), scanned A, original, MIT.

A TypeScript error-handling approach in which functions return either a value or an Error object instead of throwing for expected failures.

In plain words
What is it for?
Writing TypeScript functions that return Error-or-value unions, checking errors with instanceof, and defining tagged domain errors.
Why use it?
It makes expected failures visible in the function's return type and allows TypeScript to narrow the successful value safely.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: installed under .agents/ (shared by several agents).

Part of the libretto plugin — 24 skills shipped together

Good fit Writing TypeScript functions that return Error-or-value unions, checking errors with instanceof, and defining tagged domain errors.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/saffron-health/libretto/errore
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 saffron-health/libretto --skill errore
Clone the repo
git clone --depth 1 https://github.com/saffron-health/libretto

Made for: Claude Code.

Or install libretto, the plugin that ships this one along with the rest of its 24 skills.

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 errore

README.md
[![agentmods](https://agentmods.dev/badge/skills/saffron-health/libretto/errore/github.svg)](https://agentmods.dev/skills/saffron-health/libretto/errore)
Your own site
<a href="https://agentmods.dev/skills/saffron-health/libretto/errore"><img src="https://agentmods.dev/badge/skills/saffron-health/libretto/errore/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for errore

Your own site · 80×15
<a href="https://agentmods.dev/skills/saffron-health/libretto/errore"><img src="https://agentmods.dev/badge/skills/saffron-health/libretto/errore.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 192 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,760 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00192 $0.06760
Opus 5 $0.00096 $0.03380
Sonnet 5 $0.00038 $0.01352
Haiku 4.5 $0.00019 $0.00676

Measured 11d ago against content hash 9df87154cf34, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

errore 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 11d 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.

const result = await fetch(url).catch((e) => new FetchError({ cause: e }))
.agents/skills/errore/SKILL.md · 660 lines

How it starts

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

errore

Go-style error handling for TypeScript. Functions return errors instead of throwing them — but instead of Go's two-value tuple (val, err), you return a single Error | T union. Instead of checking err != nil, you check instanceof Error. TypeScript narrows the type automatically. No wrapper types, no Result monads, just unions and instanceof.

const user = await getUser(id)
if (user instanceof Error) return user // early return, like Go
console.log(user.name) // TypeScript knows: User

Rules

  1. Always import * as errore from 'errore' — namespace import, never destructure
  2. Never throw for expected failures — return errors as values
  3. Never return unknown | Error — the union collapses to unknown, breaks narrowing. Common trap: res.json() returns unknown, so return await res.json() makes the return type MyError | unknownunknown. Fix: cast with asreturn (await res.json()) as User
  4. Avoid try-catch for control flow — use .catch() for async boundaries, errore.try for sync boundaries
  5. Use createTaggedError for domain errors — gives you _tag, typed properties, $variable interpolation, cause, findCause, toJSON, and fingerprinting
  6. Let TypeScript infer return types — only add explicit annotations when they improve readability (complex unions, public APIs) or when inference produces a wider type than intended
  7. Use cause to wrap errors — new MyError({ ..., cause: originalError })
  8. Use | null for optional values, not | undefined — three-way narrowing: instanceof Error, === null, then value
  9. Use const + expressions, never let + try-catch — ternaries, IIFEs, instanceof Error
  10. Always handle errors inside if branches with early exits, keep the happy path at root — like Go's if err != nil { return err }, check the error, exit (return/continue/break), and continue the success path at the top indentation level. This makes the happy path readable top-to-bottom with minimal nesting
  11. Always include Error handler in matchError — required fallback for plain Error instances
  12. Use .catch() for async boundaries, errore.try for sync boundaries — only at the lowest call stack level where you interact with uncontrolled dependencies (third-party libs, JSON.parse, fetch, file I/O). Your own code should return errors as values, not throw.
  13. Always wrap .catch() in a tagged domain error — .catch((e) => new MyError({ cause: e })). The .catch() callback receives any, but wrapping in a typed error gives the union a concrete type. Never use .catch((e) => e as Error) — always wrap.
  14. Always pass cause in .catch() callbacks — .catch((e) => new MyError({ cause: e })), never .catch(() => new MyError()). Without cause, the original error is lost and isAbortError can't walk the chain to detect aborts. The cause preserves the full error chain for debugging and abort detection.
  15. Always prefer errore.try over errore.tryFn — they are the same function, but errore.try is the canonical name
  16. Use errore.isAbortError to detect abort errors — never check error.name === 'AbortError' manually, because tagged abort errors have their tag as .name
  17. Custom abort errors MUST extend errore.AbortError — so isAbortError detects them in the cause chain even when wrapped by .catch()
  18. Keep abort checks flat — check isAbortError(result) first as its own early return, then result instanceof Error as a separate early return. Never nest isAbortError inside instanceof Error:

Read the full file on GitHub · 660 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. 11d ago First seen · 660 lines · 192 tokens per session scan A 9df87154cf34

Subscribe to this mod's changes

errore is a skill published in the GitHub repository saffron-health/libretto (889 stars, last pushed 21d ago), licensed MIT. It adds 192 tokens to every session and 6,760 once invoked, about $0.0010 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-08-30.

Related

Other skills, from other repositories

widen-return-type

When delegating a task affected by this skill, include.

ZaxbyHub/opencode-swarm · 9 tokens

coding-standards

A set of general coding standards and practical patterns for TypeScript, JavaScript, React, and Node.js. It covers readable naming, simple designs, avoiding repetition, and delaying unnecessary features.

loulanyue/awesome-claude-notes · 41 tokens

plankton-code-quality

Write-time code quality enforcement using Plankton — auto-formatting, linting, and Claude-powered fixes on every file edit via hooks.

loulanyue/awesome-claude-notes · 34 tokens

tanstack-form-composition

Migrate a React @tanstack/react-form codebase from the prop-drilled useForm + erased-form-type pattern to the official createFormHook composition API (useAppForm / withForm / field.X). Use when a project threads a form object (often cast to an any-erased type like ReactFormExtendedApi ) through field-wrapper…

suxrobGM/jobpilot · 158 tokens

robotgo-flow

Use when building YAML-driven Windows RPA workflows in Go — step-by-step desktop automation with image template matching, interactive recording mode, hotkey triggers. RobotGo-Flow: YAML-based Windows RPA framework built on RobotGo.

znlgis/opengis-skills · 50 tokens

knip-cleanup

Add knip to a TypeScript project and use it to remove dead exports, collapse pass-through barrels, and narrow every export to what another file actually imports. Trigger on "add knip", "set up knip", "find dead code", "remove unused exports", "clean up barrel files", "get rid of export ", "why is this exported".

suxrobGM/jobpilot · 79 tokens