common-error-handling
БесплатноБез исполняемых скриптовНе проверенCross-cutting standards for error design, response shapes, error codes, and boundary placement across API, domain, and infrastructure layers. Use when…
от HoangNguyen0403★ 598 звёзд на GitHubОб этом скилле
Error Handling Standards
Priority: P1 (HIGH)
Error Architecture
- API Layer: Map domain errors to HTTP responses globally using the canonical error envelope.
- Domain Layer: Throw pure business errors. NO HTTP status codes here.
- Infra Layer: Wrap 3rd-party exceptions. NOT leak raw DB errors to API.
- Standard Shape: APIs return
{ "error": { "code", "message", "traceId", "details" } }.
See implementation examples for the standard error response shape.
Error Mechanics
- Wrap: Add context that helps the caller; preserve the cause where callers must match it (
fmt.Errorf("process: %w", err),new Error('msg', { cause })). Direct propagation or boundary translation is valid when wrapping exposes internals or adds nothing. - Log Once: Choose one owner per failure—the layer that handles or translates the request/job/CLI. Log there; layers beneath propagate without logging. Log-and-rethrow is duplicate when the next boundary logs again.
- Replace: Only when original error leaks sensitive details.
- Error Codes: Use
SCREAMING_SNAKE_CASEIDs (ORDER_PAYMENT_FAILED).
Anti-Patterns
- Swallowing Errors: Never
catch(e) {}without logging or re-throwing. - Never silently ignore an error: an empty catch must become an explicit log, handling branch, returned error, or rethrow.
- Double Logging: Do not log a failure in a helper and again at the boundary, nor log-and-rethrow into a boundary that logs again.
- Stack Traces: Never expose stack traces in API responses.
- Generic 500s: Use
400with specific details for validation instead of 500.
References
Failure-handling checklist
- Never swallow errors: do not use an empty
catchor silently ignore a failure. Log once at the owner, wrap or propagate beneath it, or map it deliberately at the correct boundary.
Установить common-error-handling в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл common-error-handling?
Cross-cutting standards for error design, response shapes, error codes, and boundary placement across API, domain, and infrastructure layers. Use when defining error hierarchies, wrapping exceptions, building standardized error responses, or placing error boundaries in layered architectures.
Как установить скилл common-error-handling?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл common-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