dsh-error-handling
БесплатноБез исполняемых скриптовНе проверенApply error-handling principles when designing or reviewing failures, error classes and codes, tool failures, recovery, retries, background tasks, and…
от fufankeji★ 46 звёзд на GitHubОб этом скилле
DeepSeek Harness Error Handling
Define failures, their owners, and what remains safe after failure.
Typed, structured failures
Expected failures need declared types, stable discriminants, and handling-relevant details. Reuse package error conventions, preserve causes, and separate machine identity from display text. Never route handling by parsing messages. Unexpected defects such as assertNever may remain plain Error; containment must never turn them into success.
An error class that carries a machine code extends HarnessError from dsh-error (also re-exported by dsh-llm), directly or through its package's error class, never bare Error. Prefer one error class per owning package or domain over a class per failure; a separate class is justified when callers catch it by type or it carries its own structured fields, such as ToolArgsError.violations. name is the class name, except for cancellation (below), and code values are stable UPPER_SNAKE_CASE strings, usually prefixed by the domain and declared as a union or constants beside the class. A code names the failure class its consumers act on, not the call site; add a code rather than reuse one whose meaning differs. The error class and code guide defines class choice, naming, the standard conditions, declaration, foreign-error conversion, and compatibility.
Convert foreign failures where the dependency is owned. Node errno, SDK, protocol, native, worker, and cross-realm errors become the owning package's error with the original as cause; a foreign numeric or vendor code belongs in the message, not in code. Preserve structure across layers: never re-wrap a HarnessError in a plain Error, store only its message for a later rethrow, or drop its name and code while redacting text. A process or worker boundary transports name and code and reconstructs the error.
Tool failures
The tool registry keeps error.name and error.code on tool/result when the producer supplies them: a HarnessError thrown by the tool body, a pre-execute deny, guard denial, or post-execute block with info (including the registry's approval denials, ApprovalError with APPROVAL_REJECTED, APPROVAL_CANCELLED, or APPROVAL_UNAVAILABLE), the registry's own cancellation result (AbortError with ABORTED or ABORTED_BEFORE_DISPATCH, also applied to a signal reason or an Error named AbortError that the body throws after cancellation), or a tools/execute wrapper result such as the timeout policy's TOOL_TIMEOUT. Any other thrown value, and a guard denial or block without info, persist only text that retry policy, UI, and analytics cannot route on. Every expected failure reachable from a tool body therefore throws a HarnessError, normally the owning domain's subclass:
- Hand-checked argument constraints throw
ToolArgsError(INVALID_ARGS) fromdsh-tools. - Missing composition or caller context, such as an absent Agent, service, or open turn, throws
ToolContextUnavailableError(TOOL_CONTEXT_UNAVAILABLE) fromdsh-tools. - Caller cancellation either propagates the signal's reason or an
ErrornamedAbortError, which the registry classifies asAbortErrorwith thedsh-toolsTOOL_ABORTEDconstant (ABORTED), or throws aHarnessErrorwith thatnameand code. Never replace it with a different plainError; a failure distinct from the cancellation, such as a cleanup failure, keeps its own class and code. - Dependency failures follow the conversion rule above; filesystem errno maps to
FsErrorcodes such asFS_NOT_FOUND,FS_PERMISSION_DENIED, andFS_IO_ERROR.
A policy that denies a call in tools/pre-execute, through tools.guard(), or by a post-execute block supplies info with its own name and code. A failure the model must not treat as success is an isError result; a successful domain outcome in a non-ideal state, such as a non-zero exit or no matches, stays a success value, and a success-shaped failure value is allowed only when the output schema documents it. Tests assert error.info.name and error.info.code for each expected failure path, not only the message.
Existing name and code values persist in Session logs and feed analytics. Renaming or reclassifying one is an externally perceptible change that needs an upgrade guide.
Catch, recover, or stop
For each failure, define handling and reporting owners, containment, and guarantees in the owning API documentation: valid invariants, absent/partial/committed/unknown effects, and cleanup responsibility. Background work retains these obligations.
Catching limits exception propagation, not mutations. Only the affected state's owner can establish safe continuation. Otherwise stop dependent work, discard invalid state or instances, or escalate. Logging alone is not recovery. Retries require safe repetition, cancellation, and an explicit owner; finite operation
Установить dsh-error-handling в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл dsh-error-handling?
Apply error-handling principles when designing or reviewing failures, error classes and codes, tool failures, recovery, retries, background tasks, and user-visible error reports.
Как установить скилл dsh-error-handling?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл dsh-error-handling запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic