Agent skill

API Error Handling

by secondsky in secondsky/claude-skills

Implements standardized API error responses with proper status codes, logging, and user-friendly messages.

MITAuto-check passedDevelopment

Install API Error Handling

skills CLI
$ npx skills add secondsky/claude-skills --skill api-error-handling -a claude-code

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

GitHub CLI
$ gh skill install secondsky/claude-skills api-error-handling --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/secondsky/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/api-error-handling/skills/api-error-handling .claude/skills/api-error-handling && 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
api-error-handling
GitHub stars
227
Used in
1 other repo
Token cost
~713 tokens
SKILL.md length
84 words
Files
2 (incl. references)
Skills in repo
169
Repo updated
First seen
Licence
MIT

At a glance

Implements standardized API error responses with proper status codes, logging, and user-friendly messages.

  • Building production APIs
  • SKILL.md covers Standard Error Response Format, Error Class (Node.js), Circuit Breaker Pattern and Additional Implementations, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Implementing error recovery patterns

What it does

API Error Handling is an agent skill from secondsky/claude-skills. Implements standardized API error responses with proper status codes, logging, and user-friendly messages. Use when building production APIs, implementing error recovery patterns, or integrating error monitoring services.

Its SKILL.md is about 710 tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/python-flask.md`).

It sits in Development, covering Error handling. It works with Flask and Python. The repository describes itself as: Production-ready skills for Claude Code CLI - Cloudflare, React, Tailwind v4, and AI integrations. The licence is MIT.

When your agent uses it

  • Building production APIs
  • Implementing error recovery patterns
  • Integrating error monitoring services

Example prompts

  • “Use the api-error-handling skill to implement standardized API error responses with proper status codes, logging, and user-friendly messages”
  • “/api-error-handling”

Requirements

  • Python 3
  • Node.js

What it can do on your machine

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

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are javascript and json).

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

  • Network

    No URLs in SKILL.md.

    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.

Context cost

API Error Handling loads about 713 tokens when it runs, and up to ~2.4k if it reads all its reference files. Until then it costs about 60 tokens; SKILL.md has 84 words of instructions outside code blocks.

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

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 secondsky/claude-skills at commit 8837836, republished under its MIT licence (© secondsky). 84 words, ~713 tokens.

Download SKILL.mdSave it as .claude/skills/api-error-handling/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
api-error-handling
description
Implements standardized API error responses with proper status codes, logging, and user-friendly messages. Use when building production APIs, implementing error recovery patterns, or integrating error monitoring services.
license
MIT

API Error Handling

Implement robust error handling with standardized responses and proper logging.

Standard Error Response Format

json
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request parameters",
    "status": 400,
    "requestId": "req_abc123",
    "timestamp": "2025-01-15T10:30:00Z",
    "details": [
      { "field": "email", "message": "Invalid email format" }
    ]
  }
}

Error Class (Node.js)

javascript
class ApiError extends Error {
  constructor(code, message, status = 500, details = null) {
    super(message);
    this.code = code;
    this.status = status;
    this.details = details;
  }

  static badRequest(message, details) {
    return new ApiError('BAD_REQUEST', message, 400, details);
  }

  static notFound(resource) {
    return new ApiError('NOT_FOUND', `${resource} not found`, 404);
  }

  static unauthorized() {
    return new ApiError('UNAUTHORIZED', 'Authentication required', 401);
  }
}

// Global error handler
app.use((err, req, res, next) => {
  const status = err.status || 500;
  const response = {
    error: {
      code: err.code || 'INTERNAL_ERROR',
      message: status === 500 ? 'Internal server error' : err.message,
      status,
      requestId: req.id
    }
  };

  if (err.details) response.error.details = err.details;
  if (status >= 500) logger.error(err);

  res.status(status).json(response);
});

Circuit Breaker Pattern

javascript
class CircuitBreaker {
  constructor(threshold = 5, timeout = 30000) {
    this.failures = 0;
    this.threshold = threshold;
    this.timeout = timeout;
    this.state = 'CLOSED';
  }

  async call(fn) {
    if (this.state === 'OPEN') throw new Error('Circuit open');
    try {
      const result = await fn();
      this.failures = 0;
      return result;
    } catch (err) {
      this.failures++;
      if (this.failures >= this.threshold) {
        this.state = 'OPEN';
        setTimeout(() => this.state = 'HALF_OPEN', this.timeout);
      }
      throw err;
    }
  }
}

Additional Implementations

See references/python-flask.md for:

  • Python Flask error handling with custom exceptions
  • Circuit breaker with automatic recovery
  • Retry with exponential backoff
  • Sentry integration

Best Practices

  • Use consistent error format across all endpoints
  • Include request IDs for traceability
  • Log errors at appropriate severity levels
  • Never expose stack traces to clients
  • Distinguish client errors (4xx) from server errors (5xx)
  • Provide actionable error messages

© secondsky, 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 1 other file (references) in plugins/api-error-handling/skills/api-error-handling of secondsky/claude-skills.

  • SKILL.md
  • references/python-flask.md

Open the folder on GitHubat commit 8837836

Used in 1 other repository

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

Compare with similar skills

API Error Handling 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.

API Error Handling compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
API Error Handling this skillsecondsky/claude-skills2271 repos~713Automated safety check: PassMIT
Crafting Effective Readmescumbucadev/cinemaempoa1465 repos~669Automated safety check: PassGPL-3.0
Cross-Language Coding Standardszereight/gitlab-mcp2k1 repos~1.4kAutomated safety check: PassMIT
Python Devdatabricks-solutions/ai-dev-kit1.9k—~1.6kAutomated safety check: PassCustom licence
Python Patternskurealnum/dotfiles2908 repos~4.1kAutomated safety check: PassNone
Python Script Runnercongchuanling-dot/Cohort199—~577Automated safety check: NotesMIT

Similar skills

  • Crafting Effective Readmes

    cumbucadev/cinemaempoa

    A skill your agent uses when writing or improving README files.

    146 GitHub starsUsed in 5 repos~669 tokens
    DevelopmentAuto-check passed
  • Shared reference for naming, function size, complexity and error handling rules that reviewer agents apply across TypeScript, Python, Go, Rust, Java, C# and Swift.

    2k GitHub starsUsed in 1 repo~1.4k tokens
    DevelopmentAuto-check passed
  • Python Dev

    databricks-solutions/ai-dev-kit

    Python development guidance with code quality standards, error handling, testing practices, and environment management.

    1.9k GitHub stars~1.6k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Python Patterns

    kurealnum/dotfiles

    Pythonic idioms, PEP 8 standards, type hints, and best practices for building robust, efficient, and maintainable Python applications.

    290 GitHub starsUsed in 8 repos~4.1k tokens
    DevelopmentAuto-check passed
  • Python Script Runner

    congchuanling-dot/Cohort

    Runs a Python script with checks first: confirms the interpreter version, compiles it for syntax errors, verifies imports, then explains any traceback in plain language.

    199 GitHub stars~577 tokensUpdated 1 mo ago
    DevelopmentAuto-check: notes
  • A skill your agent uses when writing shell scripts, Python automation, or any unattended batch job.

    3.5k GitHub stars~225 tokensUpdated 4 mo ago
    DevelopmentAuto-check passed

More from secondsky/claude-skills

All 169 skills in this repo
  • Tanstack AI

    secondsky/claude-skills

    TanStack AI (alpha) provider-agnostic type-safe chat with streaming for OpenAI, Anthropic, Gemini, Ollama.

    227 GitHub starsUsed in 1 repo~3.6k tokens
    Auto-check: notes
  • Auto Animate

    secondsky/claude-skills

    AutoAnimate (@formkit/auto-animate) zero-config animations for React.

    227 GitHub stars~2.9k tokensUpdated 9 days ago
    Auto-check passed
  • Base UI React

    secondsky/claude-skills

    MUI Base UI unstyled React components with Floating UI. An agent skill from secondsky/claude-skills.

    227 GitHub stars~1.9k tokensUpdated 9 days ago
    Auto-check passed
  • Cloudflare Images

    secondsky/claude-skills

    This skill should be used when the user asks to "upload images to Cloudflare", "implement direct creator upload", "configure image transformations", "optimize WebP/AVIF", "create image variants"…

    227 GitHub stars~3.6k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Nextjs

    secondsky/claude-skills

    Deploy Next.js to Cloudflare Workers via the OpenNext adapter (@opennextjs/cloudflare).

    227 GitHub stars~5.3k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Sandbox

    secondsky/claude-skills

    Cloudflare Sandboxes SDK for secure code execution in Linux containers at edge.

    227 GitHub stars~4.5k tokensUpdated 9 days ago
    Auto-check passed

Works with

Categories

Questions about API Error Handling

What does API Error Handling do?

Implements standardized API error responses with proper status codes, logging, and user-friendly messages. API Error Handling is an agent skill from secondsky/claude-skills. Implements standardized API error responses with proper status codes, logging, and user-friendly messages.

When should I use API Error Handling?

API Error Handling fits situations like: building production APIs; implementing error recovery patterns; integrating error monitoring services.

How do I install API Error Handling in Claude Code?

Run `npx skills add secondsky/claude-skills --skill api-error-handling -a claude-code`. Or copy the skill folder (plugins/api-error-handling/skills/api-error-handling in secondsky/claude-skills) into .claude/skills/api-error-handling in your project. Claude Code loads it when a task matches its description.

How do I install API Error Handling in Codex?

Run `npx skills add secondsky/claude-skills --skill api-error-handling -a codex`. Or copy the skill folder (plugins/api-error-handling/skills/api-error-handling in secondsky/claude-skills) into .agents/skills/api-error-handling in your project. Codex loads it when a task matches its description.

Can I use API Error Handling 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 secondsky/claude-skills --skill api-error-handling -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/api-error-handling, .gemini/skills/api-error-handling, .github/skills/api-error-handling and .opencode/skills/api-error-handling in your project.

What does API Error Handling need to run?

SKILL.md names no scripts, command-line tools or credentials: API Error Handling is instructions for the agent only. Our summary lists: Python 3; Node.js.

Does API Error Handling access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is API Error Handling 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 API Error Handling use?

API Error Handling 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 API Error Handling use?

About 713 tokens (SKILL.md is roughly 2.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 1.7k tokens, read only when the agent opens those files.

What are the alternatives to API Error Handling?

Skills that share tags, products or a category with API Error Handling: Crafting Effective Readmes (cumbucadev/cinemaempoa, 146 stars), Cross-Language Coding Standards (zereight/gitlab-mcp, 2k stars), Python Dev (databricks-solutions/ai-dev-kit, 1.9k stars) and Python Patterns (kurealnum/dotfiles, 290 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains API Error Handling?

secondsky (a GitHub user) maintains it in secondsky/claude-skills, which has 227 GitHub stars. The repository holds 169 skills in this directory. The repository was last updated on September 28, 2026.

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