# Implement Global Error Handling

Application errors often become inconsistent, noisy, or unsafe when each layer handles them differently. This skill guides Claude, Codex, and Claude Code toward centralized handling, specific exceptions, safe messages, retries, and cleanup.

## Install

```bash
npx skillstore add devanb/global-error-handling
```

## Metadata

- Status: approved
- Slug: devanb-global-error-handling
- Skillstore revision: r1
- Version status: missing
- Tree hash: 09d7e8241d5efd39c599b19ce460e10df073ebbea7bbb532a30f015c34b0e4fe
- Author: DevanB
- GitHub username: DevanB
- License: MIT
- Repository: https://github.com/DevanB/lucidlog/tree/master/.claude/skills/global-error-handling
- Ref: 0519034dad657fb1f7706e0550e962beeda73fdf
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: filesystem
- Quality score: 79
- Quality tier: bronze
- Public page: https://skillstore.pages.dev/skills/devanb-global-error-handling
- Manifest: https://skillstore.pages.dev/api/skills/devanb-global-error-handling/manifest

## Capabilities

- Identifies when to use centralized error handling in controllers, services, and API endpoints
- Guides creation of specific exception classes for distinct error scenarios
- Promotes user-friendly error messages that avoid technical detail exposure
- Recommends graceful degradation and retry strategies for external service failures
- Highlights cleanup of file handles, database connections, and other resources

## Use Cases

- API Error Strategy: Backend developers can standardize validation failures, service errors, and client responses across API endpoints.
- External Service Failures: Platform engineers can plan retries, fallbacks, and user messaging when third-party services fail.
- Application Maintainability: Tech leads can reduce scattered try-catch blocks and guide teams toward consistent error boundaries.

## Prompt Templates

### Review Basic Handling

```
Review this controller for error handling gaps. Suggest clearer exception types, safer user messages, and better cleanup points.
```

### Design Error Boundaries

```
Help me design centralized error handling for a service and API layer. Include where errors should be caught, logged, and translated.
```

### Handle External Failures

```
Design error handling for calls to a payment provider. Include retry rules, graceful degradation, user-facing messages, and permanent failure handling.
```

### Audit System Strategy

```
Audit this application's error handling strategy. Identify scattered catch blocks, unsafe messages, missing cleanup, and inconsistent transient versus permanent failure handling.
```

## Limitations

- Provides guidance only; it does not modify code without a separate user request
- Does not include framework-specific implementation examples in the scanned skill file
- Relies on a parent-directory markdown link that may be unavailable after packaging
- Does not replace security review for sensitive logging and error disclosure decisions

## Best Practices

- Use specific exception types so callers can handle known failure modes.
- Log enough context for diagnosis while filtering secrets and user-sensitive data.
- Centralize translation from internal errors to user-facing messages at application boundaries.

## Anti Patterns

- Do not expose stack traces, database errors, or secret values to users.
- Do not catch every exception in low-level code without preserving useful context.
- Do not retry permanent failures or unbounded transient failures.

## Security Audit

- Audited at: 2026-07-09T11:18:10.51\+00:00
- Summary: The path traversal finding is confirmed because SKILL.md directs the assistant to read a parent-directory markdown file outside the skill package. No prompt injection or additional malicious intent was found in the reviewed SKILL.md content.

## Stats

- Views: 204
- Downloads: 6
- Favorites: 0
- Popularity score: 0
