AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Error Handler

skill-benshapyro-cadre-devkit-claude-error-handler · by benshapyro

Provides battle-tested error handling patterns for TypeScript and Python. Use when implementing error handling, creating try/catch blocks, or handling exceptions.

No reviews yet
0 installs
9 views
0.0% view→install

Install

$ agentstack add skill-benshapyro-cadre-devkit-claude-error-handler

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-benshapyro-cadre-devkit-claude-error-handler)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
8mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Error Handler? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Error Handler Skill

Implements robust error handling patterns that provide meaningful errors, graceful degradation, and proper logging.

Resources

For detailed code examples, see:

  • references/typescript-patterns.md - TypeScript/JavaScript patterns (Express, React)
  • references/python-patterns.md - Python patterns (FastAPI, Flask)

Core Principles

  1. Fail Fast, Fail Loudly - Catch errors early, make them visible
  2. Context is King - Include relevant information in error messages
  3. Never Swallow Errors - Always log, re-throw, or handle explicitly
  4. User-Friendly Messages - Show generic messages to users, log details server-side
  5. Typed Errors - Use custom error classes for different failure types

Quick Patterns

Custom Error Class (TypeScript)

export class AppError extends Error {
  constructor(
    message: string,
    public code: string,
    public statusCode: number = 500,
    public context?: Record
  ) {
    super(message);
    this.name = this.constructor.name;
  }
}

// Specific types
export class ValidationError extends AppError {
  constructor(message: string, context?: Record) {
    super(message, 'VALIDATION_ERROR', 400, context);
  }
}

export class NotFoundError extends AppError {
  constructor(resource: string, id: string) {
    super(`${resource} not found`, 'NOT_FOUND', 404, { resource, id });
  }
}

Custom Exception (Python)

class AppError(Exception):
    def __init__(self, message: str, code: str, status_code: int = 500, context: dict | None = None):
        super().__init__(message)
        self.message = message
        self.code = code
        self.status_code = status_code
        self.context = context or {}

class ValidationError(AppError):
    def __init__(self, message: str, context: dict | None = None):
        super().__init__(message, "VALIDATION_ERROR", 400, context)

Error Handling Pattern

async function fetchData(id: string): Promise {
  if (!id) throw new ValidationError('Invalid ID', { id });

  try {
    const data = await db.find(id);
    if (!data) throw new NotFoundError('Data', id);
    return data;
  } catch (error) {
    if (error instanceof AppError) throw error;
    throw new DatabaseError('Fetch failed', { id, originalError: error.message });
  }
}

Best Practices

DO

  • Use custom error classes for different error types
  • Include context in errors (but sanitize before sending to client)
  • Log errors with structured data (method, path, user ID, etc.)
  • Provide user-friendly error messages
  • Handle errors at appropriate levels (function, route, global)
  • Always clean up resources (use try/finally or context managers)
  • Add retry logic for transient failures
  • Test error paths (negative tests)

DON'T

  • Swallow errors silently (catch (e) {})
  • Leak sensitive information in error messages
  • Use generic error messages without context
  • Ignore promise rejections
  • Re-throw errors without adding context
  • Return errors as values when exceptions are better
  • Use errors for control flow

Error Response Format

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid input data",
    "details": [{ "field": "email", "message": "Invalid format" }]
  }
}

Remember: Good error handling prevents debugging nightmares and provides a better user experience.


Version

  • v1.1.0 (2025-12-05): Split into references (typescript-patterns.md, python-patterns.md)
  • v1.0.0 (2025-11-15): Initial version

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.