typescript-error-handling

Enforce structured TypeScript error handling patterns with subclassing and Result types.

1|1|Updated Apr 6, 2026
One-click install
npx skills add https://github.com/Jylhis/skills --skill typescript-error-handling
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-error-handling
Source: https://github.com/Jylhis/skills/tree/main/skills/typescript-error-handling
Command: npx skills add https://github.com/Jylhis/skills --skill typescript-error-handling

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TypeScript does not reliably type exceptions, leading to untracked failures and inconsistent error propagation. This Skill provides structured patterns for error handling, including subclassing, hierarchies, and Result types, to improve reliability and debuggability.

Core Features & Use Cases

  • Error subclassing with consistent names and contextual data.
  • Hierarchical error types for API boundaries and user-facing messages.
  • Result-based error handling for library code and composable flows.
  • Safe catch clauses, error.cause chaining, and robust async error flow.
  • Zod validation error handling and integration with validation schemas.
  • Practical guidance for real-world apps, CLI tools, and API clients.

Quick Start

Ask the AI to apply TypeScript error handling patterns to a sample module.

Frequently Asked Questions about typescript-error-handling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle untyped errors in TypeScript catch blocks?

TypeScript catch blocks can be made safe by applying structured error handling patterns like typed catch clauses, error subclassing, and error.cause chaining to consistently map and propagate untyped exceptions.

What is the best way to structure TypeScript error hierarchies for API boundaries?

The best way to structure TypeScript error hierarchies is by using error subclassing with consistent names and contextual data, ensuring errors are consistently mapped across API boundaries and user-facing messages.

Should I use Result types instead of throwing exceptions in TypeScript?

Using Result types instead of throwing exceptions is ideal for library code and composable flows, providing structured, predictable error propagation that improves reliability and debuggability without relying on exception tracking.

How does Zod validation integrate with TypeScript error handling?

Zod validation integrates with TypeScript error handling by applying robust validation schemas that capture and structure invalid data states, ensuring errors are consistently mapped and validated across application boundaries.

Can I use structured error handling patterns for async flows in TypeScript?

Structured error handling patterns apply directly to async flows in TypeScript by enforcing consistent error mapping and safe catch clauses, ensuring reliable propagation of failures across API boundaries and application code.

Why does TypeScript not reliably type exceptions and how do I fix it?

TypeScript does not reliably type exceptions because it lacks built-in structured error typing, which you fix by implementing error subclassing, hierarchies, and Result types to track failures and ensure consistent propagation.