dsh-error-handling
Skill4 starsChanged 13 days agoMITView on GitHub
Apply error-handling principles when designing or reviewing failures, error classes and codes, tool failures, recovery, retries, background tasks, and user-visible error reports.
6 other projects use a version of this, 4 of them edited.
Adopted by
Most recently taken up by
- Hejunlong27/AIAuditOxedited, first seen Nov 29, 2026
- TeFuirnever/azhou-ai-hubtheir own version, first seen Nov 22, 2026
- tkbk-online/skillsedited, first seen Nov 15, 2026
- qufei1993/skills-hubtheir own version, first seen Nov 1, 2026
- See-Sol-Lab/DeepSeekGUIedited, first seen Oct 25, 2026
- deepseek-ai/deepseek-harnessedited, first seen Oct 13, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 4
- deepseek-ai/deepseek-harness★ 289k68% same
- See-Sol-Lab/DeepSeekGUI★ 27498% same
- Hejunlong27/AIAuditOx★ 668% same
- tkbk-online/skills★ 085% same
Wrote their own version · 2
- qufei1993/skills-hub★ 1.9ksame name
- TeFuirnever/azhou-ai-hub★ 3same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository32 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .agents/notes/AGENTS.mdAGENTS.md
- .agents/notes/archived/AGENTS.mdAGENTS.md
- .agents/notes/implemented/AGENTS.mdAGENTS.md
- benchmarks/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- packages/AGENTS.mdAGENTS.md
- scripts/AGENTS.mdAGENTS.md
- snapshots/AGENTS.mdAGENTS.md
- vendor/AGENTS.mdAGENTS.md
- website/AGENTS.mdAGENTS.md
- agent-experienceSkill
- cordis-styling-nitpickingSkill
- dsh-archive-agent-notesSkill
- dsh-ci-test-reliabilitySkill
- dsh-client-ui-uxSkill
- dsh-code-reviewSkill
- dsh-create-upgrade-guideSkill
- dsh-cua-macos-signingSkill
- dsh-doc-writingSkill
- dsh-find-simplificationsSkill
- dsh-merging-stacked-prsSkill
- dsh-official-plugin-artworkSkill
- dsh-pr-descriptionSkill
- dsh-pre-push-checksSkill
- dsh-prose-standardSkill
- dsh-responsive-uiSkill
- dsh-session-projectionSkill
- dsh-speed-up-perfSkill
- dsh-translate-docsSkill
- dsh-trim-cot-leakageSkill
- record-browser-gifSkill
The file
We split this skill into the rules it gives an agent
2 rules. 2 are common, 0 are distinctive, and 0 are very specific to this project.
2
Common
Most of the 4 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Common: line 39
Every final report needs a readable summary, affected operation, and safe next action.
- Common: line 43
Verify resulting state and visible outcomes, not merely that an exception was caught.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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 operations need budgets, while continuing supervision needs lifecycle ownership and observable degradation.
Localized, actionable, visible reports
Every final report needs a readable summary, affected operation, and safe next action. Localize through the receiving application's locale mechanism where one exists; other diagnostics use their existing output language. Keep sensitive internal details out of user-facing text.
Untrusted state or unknown outcomes must be visible through UI or default-enabled, accessible logs: report the impact, uncertainty, system disposition, and safe next step. Persistent invalid state needs persistent visibility. Never claim success, rollback, or safe retry without guarantees. Reporting failures need an independent fallback.
Verify resulting state and visible outcomes, not merely that an exception was caught.
Foundations
Meyer's Object-Oriented Software Construction (1997): contracts and invariants; Sutter's Exceptional C++ (1999): exception safety guarantees; Armstrong's thesis (2003): isolation and supervision.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

