error-handling-architecture

A set of instructions for designing one consistent way for a backend service to catch, classify, log, and report failures. A backend service is the server-side part of an application.

In plain words
What is it for?
Setting up error handling in backend services, replacing scattered try/catch blocks, separating user or network errors from programming bugs, and standardizing API error responses.
Why use it?
It prevents uncaught errors from crashing services and reduces the risk of exposing sensitive details. It also makes failures easier to diagnose across the application.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/kraitdev/skill.md/error-handling-architecture
Any agent
npx skills add KraitDev/skiLL.Md --skill error-handling-architecture
Clone the repo
git clone --depth 1 https://github.com/KraitDev/skiLL.Md

Made for: Claude Code, Codex.

Per session 18 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,669 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00018 $0.01669
Opus 5 $0.00009 $0.00834
Sonnet 5 $0.00004 $0.00334
Haiku 4.5 $0.00002 $0.00167

Measured 2d ago against content hash 8a61dc94ca27, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

error-handling-architecture scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/backend/error-handling-architecture/SKILL.md · 178 lines

How it starts

The opening of the file, as written. The whole thing — 178 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Error Handling Architecture

Purpose

Uncaught exceptions crash servers. Leaked errors expose vulnerabilities. This skill creates a central, robust pipeline for capturing, categorizing, logging, and responding to failures without leaking sensitive data, ensuring system resilience and debugging capability.

When to use

  • Setting up a new backend service
  • Refactoring code with excessive uncoordinated try/catch blocks
  • Standardizing API error responses across a team
  • Implementing a new microservice with shared error handling

When NOT to use

  • Client-side error handling (different context)
  • Monitoring/alerting setup (separate concern, use Logging & Observability instead)
  • Specific framework error documentation

Inputs required

  • Existing backend service codebase
  • Framework error handling capabilities (Express middleware, Django signals, etc.)
  • Logging infrastructure setup

Workflow

  1. Define Error Classes: Create base AppError class with statusCode, isOperational flag, and metadata
  2. Categorize Errors: Distinguish Operational (bad input, network) from Programmer (null ptr, logic bug)
  3. Centralize Middleware: Add framework-level error handler to catch ALL exceptions globally
  4. Log Appropriately: Full stack for 5xx errors; metadata only for 4xx errors
  5. Sanitize Output: Strip stack traces and internal details before sending to client
  6. Crash on Programmer Error: Unhandled programmer errors MUST crash and restart the process
  7. Test Error Paths: Verify error handling works for all failure scenarios

Rules

  • MUST NEVER silently swallow exceptions (catch(e) {})
  • MUST crash and restart process for unhandled Programmer Errors
  • MUST standardize all HTTP error responses to RFC 7807 format
  • MUST log full stack traces for 5xx errors
  • MUST log only message and context for 4xx errors
  • MUST sanitize all error responses (no DB details, SQL, stack traces)
  • MUST NEVER throw string literals (always throw Error objects)
  • MUST distinguish between Operational and Programmer errors

Read the full file on GitHub · 178 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 178 lines · 18 tokens per session scan A 8a61dc94ca27

Subscribe to this mod's changes

error-handling-architecture is a skill published in the GitHub repository KraitDev/skiLL.Md (7 stars, last pushed 2mo ago), licensed MIT. It adds 18 tokens to every session and 1,669 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

error-handling

Implement robust error handling with custom error types, proper propagation, user-friendly messages, and logging. Use when adding error handling to APIs, libraries, or applications.

asgarovf/locusai · 36 tokens

evaluate-pattern-adoption

Run or plan this repository's pattern-adoption evidence evaluation locally with signed-in Codex agents. Use when asked to refresh stale evidence, assess stable or exploratory patterns, evaluate one or all catalog patterns, discover possible new patterns, or prepare a reviewable evidence PR without model-backed GitHub…

PaulDuvall/ai-development-patterns · 68 tokens

contributing-to-awesome-claude

Use when writing, testing, or preparing ANY contribution or pull request to the JSONbored/awesome-claude (HeyClaude) repo — adding a community content entry (agent/MCP server/skill/hook/command/rule/guide/collection/statusline), or making a platform/code change (website, registry package, MCP package, scripts). The…

JSONbored/awesome-claude · 209 tokens

contributor-pipeline-gardening

Maintenance of the contributor issue pipeline for JSONbored/awesome-claude (HeyClaude) — closing issues that are already done but not marked so, and keeping a small, high-value contributor-available backlog stocked with real website/content/feature/bugfix work. Runs every 24h via a dedicated scheduled task. Invoke for…

JSONbored/awesome-claude · 196 tokens

skills

本目录保存按需阅读的项目参考文档。根目录 CLAUDE.md 负责最小项目上下文与硬性约定;本文档用于选择更详细的专题文档。.

neopen/video-clip-agent · 0 tokens

rails-audit-skill

Perform comprehensive technical reviews of Ruby on Rails applications. Runs automated analysis tools (RubyCritic, Brakeman, bundler-audit, Gitleaks, Debride, linters, SimpleCov, Rails stats, Rails ERD), analyzes code for architecture, security, authorization (Pundit/CanCanCan), dead code, and design issues, and…

rubyroidlabs/rails-audit-skill · 118 tokens