Skip to content
Back to skills

Error Handler

ASecurity

Creates a centralized error handling system with typed errors and proper HTTP responses

  • 10 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 1, 2026
ai-agentsbash

Security analysis

A100/100

Scanned June 1, 2026

npx -y skills add berkcangumusisik/claude-code-practices --skill error-handler --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Error Handler?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Error Handler
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/berkcangumusisik-error-handler/badge)](https://www.skillsdirectory.com/skills/berkcangumusisik-error-handler)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: error-handler
description: Creates a centralized error handling system with typed errors and proper HTTP responses
user-invocable: true
allowed-tools: Read Glob Edit
effort: medium
---

## Generate Error Handling System

1. Check existing error handling:
```bash
grep -rn "catch\|try\|throw\|Error(" src/ --include="*.ts" -l | head -10
grep -rn "class.*Error" src/ --include="*.ts" | head -10
```

2. Generate typed error classes:
```ts
export class AppError extends Error {
  constructor(
    message: string,
    public readonly statusCode: number,
    public readonly code: string,
    public readonly isOperational = true,
  ) {
    super(message)
    this.name = this.constructor.name
  }
}

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

export class ValidationError extends AppError {
  constructor(details: ZodIssue[]) {
    super('Validation failed', 400, 'VALIDATION_ERROR')
  }
}

export class UnauthorizedError extends AppError {
  constructor() { super('Unauthorized', 401, 'UNAUTHORIZED') }
}
```

3. Generate global error handler middleware.

4. Add `Result<T, E>` type for functions that can fail without throwing.

5. Replace generic `try/catch` blocks with typed errors throughout the codebase.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…