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.
npx agentmods add skills/madappgang/claude-code/error-handlingnpx skills add MadAppGang/claude-code --skill error-handlinggit clone --depth 1 https://github.com/MadAppGang/claude-codeWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/madappgang/claude-code/error-handling)<a href="https://agentmods.dev/skills/madappgang/claude-code/error-handling"><img src="https://agentmods.dev/badge/skills/madappgang/claude-code/error-handling.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00028 | $0.02500 |
| Opus 5 | $0.00014 | $0.01250 |
| Sonnet 5 | $0.00006 | $0.00500 |
| Haiku 4.5 | $0.00003 | $0.00250 |
Grade A, and why
error-handling scanned grade A with 1 finding 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 yesterday.
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.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
const response = await fetch(url, { How it starts
The opening of the file, as written. The whole thing — 468 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Error Handling Patterns
Overview
Backend error handling patterns for building robust and debuggable services.
Error Types
Custom Error Classes
// Base application error
class AppError extends Error {
constructor(
message: string,
public code: string,
public statusCode: number = 500,
public isOperational: boolean = true
) {
super(message);
this.name = this.constructor.name;
Error.captureStackTrace(this, this.constructor);
}
}
// Specific error types
class ValidationError extends AppError {
constructor(message: string, public fields?: Record<string, string>) {
super(message, 'VALIDATION_ERROR', 400);
}
}
class NotFoundError extends AppError {
constructor(resource: string, id?: string) {
super(
id ? `${resource} with id ${id} not found` : `${resource} not found`,
'NOT_FOUND',
404
);
}
}
class UnauthorizedError extends AppError {
constructor(message: string = 'Unauthorized') {
super(message, 'UNAUTHORIZED', 401);
}
}
class ForbiddenError extends AppError {
constructor(message: string = 'Forbidden') {
super(message, 'FORBIDDEN', 403);
}
}
class ConflictError extends AppError {
constructor(message: string) {
super(message, 'CONFLICT', 409);
}
}
class RateLimitError extends AppError {
constructor(public retryAfter: number) {
super('Too many requests', 'RATE_LIMIT', 429);
}
}
Error Response Format
Standard Format
interface ErrorResponse {
error: {
code: string;
message: string;
details?: unknown;
stack?: string; // Only in development
};
meta: {
requestId: string;
timestamp: string;
};
}
function formatError(error: AppError, requestId: string): ErrorResponse {
const response: ErrorResponse = {
error: {
code: error.code,
message: error.message,
},
meta: {
requestId,
timestamp: new Date().toISOString(),
},
};
if (error instanceof ValidationError && error.fields) {
response.error.details = error.fields;
}
if (process.env.NODE_ENV === 'development') {
response.error.stack = error.stack;
}
return response;
}
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.
- yesterday First seen · 468 lines · 28 tokens per session scan A 2aab410a0f5d
error-handling is a skill published in the GitHub repository MadAppGang/claude-code (279 stars, last pushed 5mo ago), licensed MIT. It adds 28 tokens to every session and 2,500 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
review-logging-patterns
Review code for logging patterns and suggest evlog adoption. Optionally use @evlog/cli (evlog init to wire evlog, evlog agents to write the conventions into AGENTS.md, evlog map to score entry-point coverage, --baseline to gate regressions in CI) on Nuxt, Nitro, Next.js, TanStack Start, and Hono. Guides setup on those…
build-audit-logs
Build or review audit trails in TypeScript/JavaScript apps using evlog (pipelines, typed actions, denials, retention, compliance-style reviews). For application code, not for extending the evlog package.
create-evlog-framework-integration
Create a new evlog framework integration to add automatic wide-event logging to an HTTP framework. Use when adding middleware/plugin support for a framework (e.g., Koa, H3 standalone, Deno Fresh, etc.) to the evlog package. Covers source code, build config, package exports, tests, example app, and all documentation.
content-pass
The daily pass over evlog's written surfaces. Picks the files the scanner ranks worst across the docs, the landing, the package READMEs, the skills, and the AGENTS.md files, reviews them against the content doctrine, applies what holds, and opens one draft PR whose body is the report. Also covers the enrichment half…
create-evlog-adapter
Create a new built-in evlog adapter to send wide events to an external observability platform. Use when adding a new drain adapter (e.g., for Elasticsearch, Honeycomb, SigNoz, etc.) to the evlog package. Covers source code, build config, package exports, tests, e2e, and all documentation.
create-evlog-map-rule
Add a new rule or a new framework adapter to evlog map in @evlog/cli. Use when adding a coverage check (requirement or opportunity) that scores entry points, or when extending the map scanner to a new framework. Covers rule source, registry, types, tests, docs, and the published skill.