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/asgarovf/locusai/error-handlingnpx 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.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.1 | $0.00036 | $0.01525 |
| Opus 5 | $0.00018 | $0.00763 |
| Sonnet 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 6d 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.
- 6d 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 5mo ago), licensed MIT. It adds 36 tokens to every session and 1,525 once invoked, about $0.0002 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-30.
Other skills, from other repositories
error-handling
Error handling patterns. Exception hierarchies, Result types, structured error responses, retry strategies, circuit breakers.
analyze-logs
Analyze application logs from the .evlog/logs/ directory. Use when debugging errors, investigating slow requests, understanding request patterns, or answering questions about application behavior. Reads structured NDJSON wide events written by evlog's file system drain.
thermo-nuclear-code-quality-review
Run an extremely strict maintainability review for abstraction quality, giant files, and spaghetti-condition growth. Use for a thermo-nuclear code quality review, thermonuclear review, deep code quality audit, or especially harsh maintainability review.
aspire-diagnostics
Use when investigating a running Exceptionless Aspire app through resource state, logs, OpenTelemetry logs/traces/spans, metrics, browser telemetry, dashboard data, or telemetry export. Based on Microsoft's official aspire-monitoring workflow skill. Do not use for ordinary code reading, narrow edits, or normal…
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…