error-handling
Patterns for robust error handling across TypeScript, Python, and Go.
Skill by matthewhand
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/matthewhand-error-handling
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/error-handling
What's inside
- Skill name
error-handling- Description
- Patterns for robust error handling across TypeScript, Python, and Go. Covers typed errors, error boundaries, retries, circuit breakers, and user-facing error messages.
- License
- MIT
- Metadata
- origin: ECC
- Instructions
- 372 lines in SKILL.md · view on GitHub
Before installing
- Instructions call the network
Files (1)
- SKILL.md
SKILL.md (first lines)
# Error Handling Patterns
Consistent, robust error handling patterns for production applications.
## When to Activate
- Designing error types or exception hierarchies for a new module or service
- Adding retry logic or circuit breakers for unreliable external dependencies
- Reviewing API endpoints for missing error handling
- Implementing user-facing error messages and feedback
- Debugging cascading failures or silent error swallowing
## Core Principles
1. **Fail fast and loudly** — surface errors at the boundary where they occur; don't bury them
2. **Typed errors over string messages** — errors are first-class values with structure
3. **User messages ≠ developer messages** — show friendly text to users, log full context server-side
4. **Never swallow errors silently** — every `catch` block must either handle, re-throw, or log
5. **Errors are part of your API contract** — document every error code a client may receive
## TypeScript / JavaScript
### Typed Error Classes
```typescript
// Define an error hierarchy for your domain
export class AppError extends Error {
constructor(
message: string,
public readonly code: string,
public readonly statusCode: number = 500,
public readonly details?: unknown,
) {
super(message)
this.name = this.constructor.name
// Maintain correct prototype chain in transpiled ES5 JavaScript.
// Required for `instanceof` checks (e.g., `error instanceof NotFoundError`)
// to work correctly when extending the built-in Error class.
Object.setPrototypeOf(this, new.target.prototype)
}
}
export class NotFoundError extends AppError {
constructor(resource: string, id: string) {
super(`${resource} not found: ${id}`, 'NOT_FOUND', 404)
}
}
export class ValidationError extends AppError {
constructor(message: string, details: { field: string; message: string }[]) {
super(message, 'VALIDATION_ERROR', 422, details)
}
}
export class UnauthorizedError extends AppError {
constructor(reason = 'Authentication required') {
super(reason, 'UNAUTHORIZED', 401)
}
}
export class RateLimitError extends AppError {
constructor(public readonly retryAfterMs: number) {
super('Rate limit exceeded', 'RATE_LIMITED', 429)
}
}
```
### Result Pattern (no-throw style)
For operations where failure is expected and common (parsing, external calls):
```typescript
type Result<T, E = AppError> =
| { ok: true; value: T }
| { ok: false; error: E }
function ok<T>(value: T): Result<T> {
return { ok: true, value }
}
function err<E>(error: E): Result<never, E> {
return { ok: false, error }
}
// Usage
async function fetchUser(id: string): Promise<Result<User>> {
try {
const user = await db.users.findUnique({ where: { id } })
if (!user) return err(new NotFoundError('User', id))
return ok(user)
} catch (e) {
return err(new AppError('Database error', 'DB_ERROR'))
}
}
const result = await fetchUser('abc-123')
if (!result.ok) {
// TypeScript knows result.error here
logger.error('Failed to fetch user', { error: result.error })
return
}
// TypeScript knows result.value here
console.log(result.value.email)
```
### API Error Handler (Next.js / Express)
```typescript
import { NextRequest, NextResponse } from 'next/server'
function handleApiError(error: unknown): NextResponse {
// Known application error
if (error instanceof AppError) {
return NextResponse.json(
{
error: {
code: error.code,
message: error.message,
...(error.details ? { details: error.details } : {}),From matthewhand/operating-swarm, MIT.
More from matthewhand/operating-swarm
- 0.644score
orca-cli
matthewhand
Drive a running Orca ADE (stablyai/orca) through the documented orca JSON CLI for worktrees and agent terminals.
SkillAFreshness: A★ 20Claude Code +9 - 0.644score
support-session-ownership
matthewhand
Teaches Support the first-run open-swarm journey and when Operating Swarm owns a thread versus CLI or remote sessions.
SkillAFreshness: A★ 20Claude Code +9 - 0.641score
database-migrations
matthewhand
Database migration best practices for schema changes, data migrations, rollbacks, and zero-downtime deployments across PostgreSQL, MySQL, and common ORMs…
SkillAFreshness: A★ 20Claude Code +9 - 0.629score
teamai-baseline
matthewhand
Shared TeamAI rules baseline (coding style, review, testing, git, security, performance) for Operating Swarm seats.
SkillAFreshness: A★ 20Claude Code +9 - 0.619score
domain-modeling
matthewhand
Build and sharpen a project's domain model.
SkillAFreshness: A★ 20Claude Code +9 - 0.607score
backend-patterns
matthewhand
Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.
SkillAFreshness: A★ 20Claude Code +9 - 0.604score
self-update-pr
matthewhand
Open a real GitHub pull request on matthewhand/open-swarm from an in-app coding CLI.
SkillBFreshness: B★ 20Claude Code +9 - 0.604score
ddg-search
matthewhand
Perform web searches using DuckDuckGo (free, no API key) via the bundled search.py script.
SkillBFreshness: B★ 20Claude Code +9 - 0.554score
writing-changelog
matthewhand
Writes a Keep a Changelog entry from a description of changes or a git log.
SkillCFreshness: C★ 20Claude Code +9 - 0.554score
reviewing-code
matthewhand
Reviews a diff or file for bugs, security issues, and missing tests, returning prioritized findings.
SkillCFreshness: C★ 20Claude Code +9 - 0.554score
conventional-commit
matthewhand
Writes a single Conventional Commits message from a description of changes or a git diff.
SkillCFreshness: C★ 20Claude Code +9 - 0.549score
counting-lines
matthewhand
Counts the non-blank lines in a file using the bundled count.py script.
SkillCFreshness: C★ 20Claude Code +9
Signals
- Stars
- 20
- Forks
- 6
- Open issues
- 1
- Last commit (this folder)
- Sep 30, 2026 (28 days ago)
- Last release
- Jun 19, 2026 (4 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/matthewhand/operating-swarm
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.334score
error-handling
lengoctuong2005
Patterns for robust error handling across TypeScript, Python, and Go.
SkillAFreshness: AClaude Code +9 - 0.313score
error-handling
airclear
Patterns for robust error handling across TypeScript, Python, and Go.
SkillBFreshness: BClaude Code +9 - 0.313score
error-handling
terryzwt
Patterns for robust error handling across TypeScript, Python, and Go.
SkillBFreshness: BClaude Code +9 - 0.313score
error-handling
worldsoon
Patterns for robust error handling across TypeScript, Python, and Go.
SkillBFreshness: BClaude Code +9 - 0.290score
error-handling
junjiezhou1122
Patterns for robust error handling across TypeScript, Python, and Go.
SkillBFreshness: BClaude Code +9
More from matthewhand
- 0.644score
orca-cli
matthewhand
Drive a running Orca ADE (stablyai/orca) through the documented orca JSON CLI for worktrees and agent terminals.
SkillAFreshness: A★ 20Claude Code +9 - 0.644score
support-session-ownership
matthewhand
Teaches Support the first-run open-swarm journey and when Operating Swarm owns a thread versus CLI or remote sessions.
SkillAFreshness: A★ 20Claude Code +9 - 0.641score
database-migrations
matthewhand
Database migration best practices for schema changes, data migrations, rollbacks, and zero-downtime deployments across PostgreSQL, MySQL, and common ORMs…
SkillAFreshness: A★ 20Claude Code +9 - 0.629score
teamai-baseline
matthewhand
Shared TeamAI rules baseline (coding style, review, testing, git, security, performance) for Operating Swarm seats.
SkillAFreshness: A★ 20Claude Code +9 - 0.619score
domain-modeling
matthewhand
Build and sharpen a project's domain model.
SkillAFreshness: A★ 20Claude Code +9 - 0.607score
backend-patterns
matthewhand
Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.
SkillAFreshness: A★ 20Claude Code +9
Cite this page
error-handling skill. Agent Mart. https://agentmart.dev/skills/matthewhand-error-handling (last updated 2026-10-24)