define-errors

Official

Define, manage, and use typed errors.

Authorwellcrafted-dev
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill simplifies error handling in TypeScript by providing a structured and type-safe way to define, manage, and use custom error variants, preventing common pitfalls and improving code clarity.

Core Features & Use Cases

  • Type-Safe Error Definitions: Define domain-specific errors with typed fields using defineErrors.
  • Automatic Discriminated Unions: Generates a union type for all error variants, enabling precise error handling.
  • Simplified Error Construction: Variant factories directly return Err(...) results.
  • Use Case: When building a user authentication service, you can define specific errors like UserNotFoundError, InvalidPasswordError, and EmailAlreadyExistsError with relevant context, making your error handling robust and readable.

Quick Start

Use the define-errors skill to create a new error type named 'ApiError' with variants 'BadRequest' and 'Unauthorized'.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: define-errors
Download link: https://github.com/wellcrafted-dev/wellcrafted/archive/main.zip#define-errors

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.