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 skills add asgarovf/locusai --skill error-handlinggit clone --depth 1 https://github.com/asgarovf/locusaiWrote 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/asgarovf/locusai/error-handling)<a href="https://agentmods.dev/skills/asgarovf/locusai/error-handling"><img src="https://agentmods.dev/badge/skills/asgarovf/locusai/error-handling/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/asgarovf/locusai/error-handling"><img src="https://agentmods.dev/badge/skills/asgarovf/locusai/error-handling.svg" alt="Reviewed on agentmods" width="80" 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.1 | $0.00036 | $0.01525 |
| Opus 5.5 | $0.00014 | $0.00610 |
| Sonnet 5.5 | $0.00007 | $0.00305 |
| Haiku 4.5 | $0.00004 | $0.00153 |
Grade A, and why
error-handling 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 1mo 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.
How it starts
The opening of the file, as written. The whole thing — 251 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Error Handling
When to use this skill
- Building or improving error handling in an API
- Adding proper error responses to endpoints
- Creating custom error classes
- Setting up global error handling
- Adding retry logic or circuit breakers
- Improving error messages and logging
Custom error classes
TypeScript
class AppError extends Error {
constructor(
message: string,
public readonly code: string,
public readonly statusCode: number = 500,
public readonly details?: Record<string, unknown>,
) {
super(message);
this.name = 'AppError';
}
}
class NotFoundError extends AppError {
constructor(resource: string, id: string) {
super(`${resource} with id '${id}' not found`, 'NOT_FOUND', 404);
}
}
class ValidationError extends AppError {
constructor(errors: { field: string; message: string }[]) {
super('Validation failed', 'VALIDATION_ERROR', 400, { errors });
}
}
class ConflictError extends AppError {
constructor(message: string) {
super(message, 'CONFLICT', 409);
}
}
Python
class AppError(Exception):
def __init__(self, message: str, code: str, status_code: int = 500, details: dict = None):
super().__init__(message)
self.code = code
self.status_code = status_code
self.details = details or {}
class NotFoundError(AppError):
def __init__(self, resource: str, id: str):
super().__init__(f"{resource} with id '{id}' not found", "NOT_FOUND", 404)
class ValidationError(AppError):
def __init__(self, errors: list[dict]):
super().__init__("Validation failed", "VALIDATION_ERROR", 400, {"errors": errors})
Global error handler
Express.js
// Error handler middleware (must be last)
app.use((err: Error, req: Request, res: Response, next: NextFunction) => {
// Known application errors
if (err instanceof AppError) {
return res.status(err.statusCode).json({
error: {
code: err.code,
message: err.message,
...(err.details && { details: err.details }),
},
});
}
// Zod validation errors
if (err instanceof ZodError) {
return res.status(400).json({
error: {
code: 'VALIDATION_ERROR',
message: 'Invalid input',
details: err.issues,
},
});
}
// Unknown errors — log full details, return generic message
console.error('Unhandled error:', err);
res.status(500).json({
error: {
code: 'INTERNAL_ERROR',
message: 'An unexpected error occurred',
},
});
});
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.
- 1mo ago First seen · 251 lines · 36 tokens per session scan A c465ff56eadf
error-handling is a skill published in the GitHub repository asgarovf/locusai (23 stars, last pushed 7mo ago), licensed MIT. It adds 36 tokens to every session and 1,525 once invoked, about $0.0001 per session on Opus 5.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-30.
Other skills, from other repositories
error-handling
Use when designing the reaction to a class of failures — typed error taxonomies, retry/backoff/timeout policy, circuit breakers, React/Next error boundaries, and the user-message vs operator-log split. NOT diagnosing one specific crash (that is debug), NOT logs/metrics/traces (that is observability), NOT the wire…
backend-resilience-patterns
Use this skill when the user says 'resilience', 'circuit breaker', 'retry', 'bulkhead', 'timeout', 'fallback', 'resilience4j', 'fault tolerance', 'rate limiter', 'backoff', 'retry strategy', 'bulkhead pattern'. This skill applies production fault-tolerance patterns: circuit breaker, retry with backoff, bulkhead…
error-handling
Use when implementing custom error classes, error middleware, structured logging, retry logic, or graceful shutdown patterns in backend applications.
error-handling
Error handling patterns. Exception hierarchies, Result types, structured error responses, retry strategies, circuit breakers.
error-handling-architecture
When designing how a system recovers from and reports failures.
printing-press-amend
Amend a published CLI from one of two input sources: (1) dogfood mode mines the active Claude Code session transcript for friction (missing flags, hand- rolled API payloads, silent-null returns); (2) direct-input mode accepts user-supplied asks (rename a command, add commands or feeds, fix a named bug, optionally…