error-handling
Skill2 starsChanged 7 months agoMITView on GitHub
Use when implementing error types, error formatting, user-facing error messages, recovery logic, or diagnostic output. Also use when adding new failure modes to existing commands or when working on the doctor command.
- Installs packages
We split this skill into the rules it gives an agent
7 rules. 0 are common, 4 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 58 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Every error path should follow this hierarchy, in order:
- Distinctive: line 13
Suggest a fix if possible: Every error that has a known remediation should include the fix in the message.
- Very specific: line 21
Use thiserror for all error definitions in skald-core.
- Very specific: line 36
Use cliclack's log::error() and log::warning() for styled error output in TTY mode.
- Distinctive: line 38
Never print a raw error code, stack trace, or Rust panic message at default verbosity.
- Distinctive: line 44
When an error occurs, always log the full context at DEBUG level before formatting the user-facing message.
- Very specific: line 59
Use Result everywhere. The binary's main() should be the only place that unwraps, and it should catch and format the error using the error …
“Common” is measured: kept by at least 6 in 10 of the 58 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
Error Handling Guidelines
Recovery Hierarchy
Every error path should follow this hierarchy, in order:
- Auto-fix if safe. Missing config directory? Create it silently and continue. No staged changes but unstaged exist? Offer to stage them interactively.
- Suggest a fix if possible. Every error that has a known remediation should include the fix in the message. Examples:
claude CLI not found→ "Install with: npm install -g @anthropic-ai/claude-code"gh not authenticated→ "Run: gh auth login"Config parse error→ show the line number, the problematic value, and what was expected
- Fail clearly with context. Say what was attempted, what went wrong, and where to look for more information. At
-v, include the log file path.
Error Types
Use thiserror for all error definitions in skald-core. Error types should be specific enough to pattern-match on:
// Good: specific, actionable
#[error("Provider '{provider}' not configured. Run `sk config init` to set up.")]
ProviderNotConfigured { provider: String },
// Bad: generic, useless to the caller
#[error("Configuration error: {0}")]
ConfigError(String),Formatting
- Errors print to stderr, never stdout (stdout is for data output).
- Use cliclack's
log::error()andlog::warning()for styled error output in TTY mode. - In piped/non-TTY mode, errors are plain text to stderr.
- Never print a raw error code, stack trace, or Rust panic message at default verbosity.
- At
-v, append: "See log file at ~/.config/skald/logs/skald-YYYY-MM-DD.log for details" - At
-vv, include the full error chain inline.
Logging on Errors
When an error occurs, always log the full context at DEBUG level before formatting the user-facing message. The log file should contain:
- What operation was attempted
- The full error chain (including source errors)
- Relevant state (which config was loaded, what provider was selected, etc.)
- Timing (how long the operation ran before failing)
Exit Codes
0— success1— general error (config issues, provider errors, etc.)2— usage error (bad flags, missing arguments)130— interrupted (Ctrl+C / Esc in interactive mode)
Never Panic
Use Result everywhere. The binary's main() should be the only place that unwraps, and it should catch and format the error using the error formatting infrastructure. A panic in a CLI tool is a bug.
Other versions72 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 72
- microsoft/data-formulator★ 17ksame name
- epicenter-md/epicenter★ 4.8ksame name
- EpicenterHQ/epicenter★ 4.8ksame name
- NVIDIA-NeMo/RL★ 2.1ksame name
- software-mansion/react-native-executorch★ 1.8ksame name
- CloudAI-X/claude-workflow★ 1.4ksame name
- CloudAI-X/claude-workflow-v2★ 1.4ksame name
- alchemyplatform/aa-sdk★ 321same name
- Resgrid/Core★ 229same name
- DevelopersGlobal/ai-agent-skills★ 216same name
62 more not listed
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.
Used alongsideProjects with it also use caching, logging and 8 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
zebbernSkillcaching
Caching strategies — invalidation, TTL guidelines, cache keys, cache layers, and when not to cache. Use when implementing or reviewing caching logic.
Also in 5 projects that use this
diego-tobalinaSkilllogging
Logging best practices for Java (SLF4J/Logback) and Node.js (Winston/Pino). Use for structured logging, log levels, and avoiding sensitive data exposure.
Also in 10 projects that use this
WelluxSkilltype-safety
Add or fix type annotations and enforce strict type safety. Invoke for: "add types", "type annotation", "TypeScript types", "Python type hints", "mypy", "tsc strict", "type errors", "any type", "unsafe cast", "missing types", "type this".
Also in 3 projects that use this
MicrosoftSkillresilience
Apply resilience patterns (retry, backoff, circuit breaking) when writing or reviewing code that makes outbound HTTP/REST calls, database operations, or any I/O that can experience transient failures. Use this skill when: (1) writing new code that calls external services or APIs, (2) reviewing code that uses fetch, HTTP clients, or service-to-service calls, (3) adding queue consumers or workers that interact with remote systems, (4) debugging intermittent failures in production.
Also in 3 projects that use this
OpenAISkillauth
Authentication integration guidance — Clerk (native Vercel Marketplace), Descope, and Auth0 setup for Next.js applications. Covers middleware auth patterns, sign-in/sign-up flows, and Marketplace provisioning. Use when implementing user authentication.
Also in 5 projects that use this
JohnJBorenSkillci-cd
CI/CD pipeline design, GitHub Actions, testing automation, and deployment strategies
Also in 7 projects that use this
In this repository6 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- config-and-aliasesSkill
- dependenciesSkill
- releaseSkill
- testingSkill
- ui-and-outputSkill
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.

