wthek-error-handling
БесплатноБез исполняемых скриптовНе проверенUse this skill whenever adding, refactoring, configuring, or standardizing HTTP error handling, validation error pipelines (Zod, Valibot, TypeBox), HTTP…
от skillnter158 установок в других каталогахОб этом скилле
WTHek Error Handling Skill
This skill guides the implementation of standardized, production-safe HTTP error handling and validation error pipelines using the @wthek ("What The HEK") extension suite powered by http-error-kit and http-response-status-code.
1. Package Decision Matrix
Inspect the project's package.json to identify the framework and validation libraries in use, then select the appropriate packages:
| Framework / Need | Primary Package | Companion Validation Package |
|---|---|---|
| Express.js | @wthek/express-middleware |
@wthek/zod-express-interceptor (if Zod) · @wthek/zod-transformer · @wthek/valibot-transformer · @wthek/typebox-transformer |
| Fastify | @wthek/fastify-middleware |
@wthek/zod-transformer · @wthek/valibot-transformer · @wthek/typebox-transformer |
| Hono | @wthek/hono-middleware |
@wthek/zod-transformer · @wthek/valibot-transformer · @wthek/typebox-transformer |
| Koa | @wthek/koa-middleware |
@wthek/zod-transformer · @wthek/valibot-transformer · @wthek/typebox-transformer |
| NestJS | @wthek/nestjs-middleware |
@wthek/zod-transformer · @wthek/valibot-transformer · @wthek/typebox-transformer |
| Restify | @wthek/restify-middleware |
@wthek/zod-transformer · @wthek/valibot-transformer · @wthek/typebox-transformer |
| Framework-Agnostic / Utils | http-error-kit |
@wthek/zod-transformer · @wthek/valibot-transformer · @wthek/typebox-transformer |
Companion Packages (always install alongside)
| Package | Purpose |
|---|---|
http-error-kit |
Core error classes (KitHttpError, KitGeneralError, 42 named error classes) and formatter configuration (KitHttpErrorConfig) |
http-response-status-code |
Type-safe, tree-shakeable HTTP status code constants and utilities |
@wthek/mcp-error-formatter |
Formats errors and KitHttpError instances into MCP tool results (CallToolResult), JSON-RPC 2.0 errors, and KitHttpErrorConfig formatters |
@wthek/mcp |
Standalone local MCP server providing AI agents with HTTP standards lookup, framework recipes, and code anti-pattern audits |
2. Core API: http-error-kit
Three Import Paths
| Import Path | Base Class | Formatter Support | Use Case |
|---|---|---|---|
http-error-kit (default) |
Dynamic — delegates to KitHttpError or KitGeneralError |
Yes (when configured) | Standard usage |
http-error-kit/http |
Always KitHttpError |
Yes (global + instance) | When you always want formatter support |
http-error-kit/generic |
Always KitGeneralError |
No (static format) | Lightweight, no formatter needed |
KitHttpError Class
The primary error class. All @wthek middleware packages catch instances of this class (and KitGeneralError).
import { KitHttpError } from "http-error-kit";
import { NOT_FOUND, BAD_REQUEST } from "http-response-status-code";
// Basic usage
throw new KitHttpError(NOT_FOUND, "User not found");
// With details
throw new KitHttpError(BAD_REQUEST, "Invalid input", { field: "email" });
// With additional args (spread onto instance or passed to formatter)
throw new KitHttpError(BAD_REQUEST, "Validation failed", { issues: [...] }, { requestId: "abc" });
Constructor
new KitHttpError(statusCode: number, message: string, details?: unknown, ...args: unknown[])
Properties
| Property | Type | Description |
|---|---|---|
statusCode |
number |
HTTP status code |
message |
string |
Error message (inherited from Error) |
details |
unknown |
Additional contextual information |
headers |
Record<string, string> | undefined |
HTTP response headers (e.g. WWW-Authenticate, Retry-After) |
Methods
| Method | Returns | Description |
|---|---|---|
getInputs() |
IRawInput |
Returns { statusCode, message, details, args } — original constructor arguments |
toJSON() |
object |
Serializes using instanceFormatter ?? defaultFormatter, else { statusCode, message, details } |
setFormatter(fn) |
this |
Sets an instance-level formatter; returns this for chaining |
setHeader(name, value) |
this |
Sets an individual response header; returns this for chaining |
setHeaders(headers) |
this |
Sets multiple response headers; returns this for chaining |
toResponse(init?) |
Response |
Converts error to a standard WHATWG Fetch Response (Next.js, Hono, Workers, Bun) |
Type Guards
import { isKitError, isKitHttpError, isKitGeneralError } from "http-error-kit";
try {
// ...
} catch (err: unknown) {
Установить wthek-error-handling в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл wthek-error-handling?
Use this skill whenever adding, refactoring, configuring, or standardizing HTTP error handling, validation error pipelines (Zod, Valibot, TypeBox), HTTP status code usage, or MCP error formatting in Express, Fastify, Hono, Koa, NestJS, Restify, Node.js applications, or Model Context Protocol servers using @wthek packages, http-error-kit, and http-response-status-code.
Как установить скилл wthek-error-handling?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл wthek-error-handling запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic