Implement standardized error handling with proper HTTP status codes and error responses.

MITAuto-check passedDevelopment

Install Handling API Errors

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill handling-api-errors -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace handling-api-errors --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/handling-api-errors .claude/skills/handling-api-errors && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
handling-api-errors
GitHub stars
2.8k
Used in
1 other repo
Token cost
~1.5k tokens
SKILL.md length
623 words
Files
4 (incl. references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Implement standardized error handling with proper HTTP status codes and error responses.

  • Works in 9 steps: Audit existing error handling using Grep… → Define a standardized error response… → Create typed error classes for each… → …
  • Implementing standardized error handling
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Handling API Errors is an agent skill from jeremylongshore/tons-of-skills-marketplace. Implement standardized error handling with proper HTTP status codes and error responses. Use when implementing standardized error handling. Trigger with phrases like "add error handling", "standardize errors", or "implement error responses".

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/errors.md`, `references/examples.md` and `references/implementation.md`). Compatibility notes: Designed for Claude Code

It sits in Development, covering Error handling. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Implementing standardized error handling
  • With phrases like add error handling
  • Standardize errors
  • Implement error responses

Example prompts

  • “add error handling”
  • “standardize errors”
  • “implement error responses”
  • “/handling-api-errors”

Requirements

  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Grep, Glob, Bash(api:error-*)

Workflow steps

9 steps, taken from the first numbered list in SKILL.md.

  1. Audit existing error handling using Grep to find try/catch blocks, error middleware, and exception handlers, identifying inconsistent…
  2. Define a standardized error response envelope following RFC 7807: type (URI identifying error type), title (human-readable summary)…
  3. Create typed error classes for each error category: ValidationError (400), AuthenticationError (401), AuthorizationError (403)…
  4. Implement centralized error handling middleware that catches all thrown errors, maps them to the appropriate HTTP status code and RFC 7807…
  5. Add validation error formatting that transforms framework-specific validation failures into a consistent array of field-level errors with…
  6. Configure environment-aware error detail: include stack traces and internal error codes in development/staging responses; omit them in…
  7. Integrate error monitoring (Sentry/Bugsnag) that captures 5xx errors with full context (request details, user info, stack trace) and…
  8. Handle unhandled rejections and uncaught exceptions at the process level, returning 500 with a generic error message while logging the…
  9. Write tests verifying that each error type produces the correct HTTP status code, RFC 7807 response body, and that stack traces are hidden…

What it can do on your machine

Read from SKILL.md and the folder at commit 23ea8d4. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Grep
    • Glob
    • Bash(api:error-*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • tools.ietf.org
    • sentry.io

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Handling API Errors loads about 1.5k tokens when it runs, and up to ~3.7k if it reads all its reference files. Until then it costs about 65 tokens; SKILL.md has 623 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~65
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit 23ea8d4, republished under its MIT licence (© jeremylongshore). 623 words, ~1,475 tokens.

Download SKILL.mdSave it as .claude/skills/handling-api-errors/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
handling-api-errors
description
Implement standardized error handling with proper HTTP status codes and error responses. Use when implementing standardized error handling. Trigger with phrases like "add error handling", "standardize errors", or "implement error responses".
allowed-tools
Read, Write, Edit, Grep, Glob, Bash(api:error-*)
compatibility
Designed for Claude Code
version
1.24.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
tags
api, handling-api

Handling API Errors

Overview

Implement standardized API error handling with RFC 7807 Problem Details responses, centralized error middleware, typed error classes, and environment-aware stack trace exposure. Convert framework exceptions, validation failures, database errors, and upstream service failures into consistent, machine-readable error responses with appropriate HTTP status codes.

Prerequisites

  • Web framework with middleware/error handler support (Express, FastAPI, Spring Boot, Gin)
  • Structured logging library for error event recording with correlation IDs
  • Error monitoring service: Sentry, Bugsnag, or Rollbar for production error tracking
  • RFC 7807 Problem Details specification for response format guidance
  • API documentation listing all possible error codes and their meanings

Instructions

  1. Audit existing error handling using Grep to find try/catch blocks, error middleware, and exception handlers, identifying inconsistent error response formats across endpoints.
  2. Define a standardized error response envelope following RFC 7807: type (URI identifying error type), title (human-readable summary), status (HTTP code), detail (specific explanation), and instance (request path).
  3. Create typed error classes for each error category: ValidationError (400), AuthenticationError (401), AuthorizationError (403), NotFoundError (404), ConflictError (409), and RateLimitError (429).
  4. Implement centralized error handling middleware that catches all thrown errors, maps them to the appropriate HTTP status code and RFC 7807 body, and prevents raw stack traces from leaking to clients.
  5. Add validation error formatting that transforms framework-specific validation failures into a consistent array of field-level errors with field, message, and code properties.
  6. Configure environment-aware error detail: include stack traces and internal error codes in development/staging responses; omit them in production while logging the full error server-side.
  7. Integrate error monitoring (Sentry/Bugsnag) that captures 5xx errors with full context (request details, user info, stack trace) and groups them by root cause for triage.
  8. Handle unhandled rejections and uncaught exceptions at the process level, returning 500 with a generic error message while logging the full failure and triggering alerts.
  9. Write tests verifying that each error type produces the correct HTTP status code, RFC 7807 response body, and that stack traces are hidden in production mode.

See ${CLAUDE_SKILL_DIR}/references/implementation.md for the full implementation guide.

Output

  • ${CLAUDE_SKILL_DIR}/src/errors/ - Typed error classes (ValidationError, NotFoundError, etc.)
  • ${CLAUDE_SKILL_DIR}/src/middleware/error-handler.js - Centralized error handling middleware
  • ${CLAUDE_SKILL_DIR}/src/errors/formatters.js - Error-to-RFC-7807 response transformation
  • ${CLAUDE_SKILL_DIR}/src/errors/codes.js - Error code registry with human-readable descriptions
  • ${CLAUDE_SKILL_DIR}/src/config/error-config.js - Environment-aware error detail configuration
  • ${CLAUDE_SKILL_DIR}/tests/errors/ - Error handling tests for each error type and scenario
Show full SKILL.md (245 more words)Show less

Error Handling

ErrorCauseSolution
Stack trace leakedError handler omits production check; raw Error thrown without wrappingVerify NODE_ENV/APP_ENV check in error formatter; wrap all thrown errors in typed classes
Inconsistent error formatSome endpoints return {error: "msg"} while others return RFC 7807Ensure all errors flow through centralized middleware; remove per-handler try/catch that formats differently
Unhandled promise rejectionAsync handler throws without catch; Express does not catch async errorsUse express-async-errors wrapper or explicit async error forwarding with next(err)
Database error exposedRaw SQL error message returned to client containing table/column namesMap database errors to generic messages at the error handler layer; log full details server-side
Error monitoring noiseHigh volume of expected 4xx errors flooding Sentry/BugsnagConfigure error monitoring to capture only 5xx; track 4xx via metrics, not error monitoring

Refer to ${CLAUDE_SKILL_DIR}/references/errors.md for comprehensive error patterns.

Examples

RFC 7807 response: {"type":"https://api.example.com/errors/validation","title":"Validation Error","status":400,"detail":"Request body contains 2 validation errors","errors":[{"field":"email","message":"Invalid email format","code":"INVALID_FORMAT"}]}

Centralized Express error handler: Single app.use((err, req, res, next) => {...}) middleware that handles all error types, sets status codes, formats RFC 7807 bodies, logs with correlation ID, and reports to Sentry.

Graceful upstream failure: When a downstream payment service returns 500, wrap it in a ServiceUnavailableError with a user-friendly message, log the upstream response for debugging, and trigger a circuit breaker.

See ${CLAUDE_SKILL_DIR}/references/examples.md for additional examples.

Resources

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in skills/.curated/handling-api-errors of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/errors.md
  • references/examples.md
  • references/implementation.md

Open the folder on GitHubat commit 23ea8d4

Used in 1 other repository

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in jeremylongshore/tons-of-skills-marketplace, which our catalogue first saw on October 8, 2026.

Compare with similar skills

Handling API Errors next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Handling API Errors compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Handling API Errors this skilljeremylongshore/tons-of-skills-marketplace2.8k1 repos~1.5kAutomated safety check: PassMIT
Mole Bug Patternstw93/Mole70k—~2kAutomated safety check: PassGPL-3.0
Native Data FetchingCherryHQ/cherry-studio-app4k6 repos~2.9kAutomated safety check: NotesMIT
Rust Best Practicesfarm-fe/farm5.6k3 repos~1.1kAutomated safety check: PassMIT
R Function Input Validationtidyverse/dplyr5.1k1 repos~2.3kAutomated safety check: PassCustom licence
Next Best Practicesvercel-labs/openreview1.7k18 repos~1kAutomated safety check: PassNone

Similar skills

  • A catalog of recurring bug shapes in the Mole Mac cleaner, used to review safety-sensitive diffs for deletion safety, unbounded commands, shell traps and weak tests.

    70k GitHub stars~2k tokensUpdated today
    DevelopmentAuto-check passed
  • Native Data Fetching

    CherryHQ/cherry-studio-app

    A skill your agent uses when implementing or debugging ANY network request, API call, or data fetching.

    4k GitHub starsUsed in 6 repos~2.9k tokens
    DevelopmentAuto-check: notes
  • Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook.

    5.6k GitHub starsUsed in 3 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Validates arguments of exported R functions with the standalone check_* type checkers from rlang, in tidyverse style with clear error messages.

    5.1k GitHub starsUsed in 1 repo~2.3k tokens
    DevelopmentAuto-check passed
  • Next Best Practices

    vercel-labs/openreview

    Official

    Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling

    1.7k GitHub starsUsed in 18 repos~1k tokens
    DevelopmentAuto-check passed
  • Error Handling

    microsoft/data-formulator

    Official

    统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用. An agent skill from microsoft/data-formulator.

    18k GitHub stars~3.8k tokensUpdated today
    DevelopmentAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Analyzing Text With NLP

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to perform natural language processing and text analysis using the nlp-text-analyzer plugin.

    2.8k GitHub starsUsed in 1 repo~819 tokens
    Auto-check passed
  • Building Neural Networks

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill allows AI assistant to construct and configure neural network architectures using the neural-network-builder plugin.

    2.8k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed
  • Detecting Data Anomalies

    jeremylongshore/tons-of-skills-marketplace

    Process identify anomalies and outliers in datasets using machine learning algorithms.

    2.8k GitHub starsUsed in 1 repo~1.4k tokens
    Auto-check passed
  • Explaining Machine Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill enables AI assistant to provide interpretability and explainability for machine learning models.

    2.8k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed
  • Optimizing Prompts

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill optimizes prompts for large language models (llms) to reduce token usage, lower costs, and improve performance.

    2.8k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed

Categories

Questions about Handling API Errors

What does Handling API Errors do?

Implement standardized error handling with proper HTTP status codes and error responses. Handling API Errors is an agent skill from jeremylongshore/tons-of-skills-marketplace. Implement standardized error handling with proper HTTP status codes and error responses.

When should I use Handling API Errors?

Handling API Errors fits situations like: implementing standardized error handling; with phrases like add error handling; standardize errors; implement error responses.

How do I install Handling API Errors in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill handling-api-errors -a claude-code`. Or copy the skill folder (skills/.curated/handling-api-errors in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/handling-api-errors in your project. Claude Code loads it when a task matches its description.

How do I install Handling API Errors in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill handling-api-errors -a codex`. Or copy the skill folder (skills/.curated/handling-api-errors in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/handling-api-errors in your project. Codex loads it when a task matches its description.

Can I use Handling API Errors in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill handling-api-errors -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/handling-api-errors, .gemini/skills/handling-api-errors, .github/skills/handling-api-errors and .opencode/skills/handling-api-errors in your project.

What does Handling API Errors need to run?

SKILL.md names no scripts, command-line tools or credentials: Handling API Errors is instructions for the agent only. Its frontmatter pre-approves these tools: Read, Write, Edit, Grep, Glob, Bash(api:error-*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Handling API Errors access the network?

SKILL.md names 2 domains. As links in the text: tools.ietf.org and sentry.io. This is read from the text; nothing was executed.

Is Handling API Errors safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Handling API Errors use?

Handling API Errors is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Handling API Errors use?

About 1.5k tokens (SKILL.md is roughly 5.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2.2k tokens, read only when the agent opens those files.

What are the alternatives to Handling API Errors?

Skills that share tags, products or a category with Handling API Errors: Mole Bug Patterns (tw93/Mole, 70k stars), Native Data Fetching (CherryHQ/cherry-studio-app, 4k stars), Rust Best Practices (farm-fe/farm, 5.6k stars) and R Function Input Validation (tidyverse/dplyr, 5.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Handling API Errors?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,821 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 8, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.