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/luqiang-code/claude-code-skills/api-error-handlernpx skills add luqiang-code/claude-code-skills --skill api-error-handlergit clone --depth 1 https://github.com/luqiang-code/claude-code-skillsWhat 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.00040 | $0.00588 |
| Opus 5 | $0.00020 | $0.00294 |
| Sonnet 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 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.
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.
- yesterday 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 (2 stars, last pushed 3mo ago), licensed MIT. It adds 40 tokens to every session and 588 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-31.
Other skills, from other repositories
skill-builder
Automatically detect source types and build AI skills using Skill Seekers. Use when the user wants to create skills from documentation, repos, PDFs, videos, or other knowledge sources.
golden-chat
Use when testing the goldenchat golden build.
golden-epub
Use when testing the epub golden build.
golden-epub-kw
Use when testing keyword categorization.
golden-html-multi
Use when testing the multi-file html build.
golden-jupyter-dir
Use when testing the goldenjupyterdir golden build.