Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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от 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_CASE IDs (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 400 with specific details for validation instead of 500.

References

Failure-handling checklist

  • Never swallow errors: do not use an empty catch or 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

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

LICENSEreferences/api-error-contract.mdreferences/implementation.md

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), без исполняемых скриптов.

Похожие скиллы

Сравнить common-error-handling с