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 luqiang-code/claude-code-skills --skill api-error-handlergit clone --depth 1 https://github.com/luqiang-code/claude-code-skillsWrote 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/luqiang-code/claude-code-skills/api-error-handler)<a href="https://agentmods.dev/skills/luqiang-code/claude-code-skills/api-error-handler"><img src="https://agentmods.dev/badge/skills/luqiang-code/claude-code-skills/api-error-handler/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/luqiang-code/claude-code-skills/api-error-handler"><img src="https://agentmods.dev/badge/skills/luqiang-code/claude-code-skills/api-error-handler.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.00040 | $0.00588 |
| Opus 5.5 | $0.00016 | $0.00235 |
| Sonnet 5.5 | $0.00008 | $0.00118 |
| Haiku 4.5 | $0.00004 | $0.00059 |
Grade A, and why
api-error-handler 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 3mo 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.
What it actually says
API Error Handler
Add consistent, production-grade error handling to API routes.
When to Use
- API routes lack standardized error responses
- Error handling is inconsistent across endpoints
- User mentions "error handling", "error responses", "error middleware"
When NOT to Use
- GraphQL APIs (different error format)
- WebSocket endpoints (different patterns)
- The project already has a mature error handling layer
Workflow
- Scan API routes to understand current error handling patterns
- Identify the framework (Express, Fastify, Koa, etc.)
- Create an
AppErrorclass with: statusCode, code, message, details - Create error middleware that catches all errors and returns JSON:
{ "error": { "code": "VALIDATION_ERROR", "message": "...", "details": [...] } } - Add error categories: ValidationError, AuthError, NotFoundError, RateLimitError
- Wire into existing routes — replace bare
throw new Error()withAppErrorsubclasses - Add request ID to error responses for traceability
- Run existing tests to verify nothing breaks
Output Structure
src/
├── errors/
│ ├── AppError.ts # Base error class
│ ├── ValidationError.ts # 400
│ ├── AuthError.ts # 401
│ ├── ForbiddenError.ts # 403
│ ├── NotFoundError.ts # 404
│ └── RateLimitError.ts # 429
├── middleware/
│ └── errorHandler.ts # Error middleware
Key Principles
- Never leak stack traces in production
- Always include a machine-readable
codefield - Log errors with request ID for debugging
- DON'T catch errors you can't handle — let the middleware do it
- Use HTTP status codes semantically
Notes
- Don't wrap every route in try-catch — use the error middleware
- Production errors should NOT include internal details
- Add
NODE_ENVcheck: include stack traces only in development
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.
- 3mo ago First seen · 76 lines · 40 tokens per session scan A 3972c82c5234
api-error-handler is a skill published in the GitHub repository luqiang-code/claude-code-skills (7 stars, last pushed 6mo ago), licensed MIT. It adds 40 tokens to every session and 588 once invoked, about $0.0002 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-31.
api-error-handler compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| api-error-handlerluqiang-code/claude-code-skills | Skill | 7 | 6mo ago | MIT | A | 40 | Claude Code |
| authentication-patternstravisjneuman/.claude | Skill | 115 | today | MIT | A | 28 | Claude Code |
| event-driven-architecturetravisjneuman/.claude | Skill | 115 | today | MIT | A | 50 | Claude Code |
| payment-integrationtravisjneuman/.claude | Skill | 115 | today | MIT | A | 40 | Claude Code |
| api-designtravisjneuman/.claude | Skill | 115 | today | MIT | A | 29 | Claude Code |
| agent-auth-specialisttravisjneuman/.claude | Skill | 115 | today | MIT | A | 82 | Claude Code |
| microservices-architecturetravisjneuman/.claude | Skill | 115 | today | MIT | A | 30 | Claude Code |