/waris-skill-library:warisskill-error-handling-observabilityfrom waris-skill-library
Use when writing code that can fail — external calls, parsing, database operations, anything with a real failure mode — and when deciding how a failure gets surfaced (logs, user-facing message, API error shape). Trigger on any new error type, catch block, retry logic, or API error response. Pairs with warisskill-system-design-api-design's error response format and warisskill-security-practices' rule against leaking internals in error messages.
Ships in waris-skill-library. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
warisskill-security-practices).catch either handles,
re-throws, or logs. An empty catch block is always wrong.warisskill-system-design-api-design.AppError
base (code, message, status, optional details) so instanceof checks
and a central API error handler both work cleanly.{ ok: true, value } | { ok: false, error }) for
operations where failure is a normal, expected outcome — parsing,
external API calls, anything where "this commonly fails and the caller
needs to branch on it" is true. Don't apply Result-pattern ceremony
universally; reserve it for genuinely expected-failure operations.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
Object.setPrototypeOf(this, new.target.prototype)
}
}
export class NotFoundError extends AppError {
constructor(resource: string, id: string) {
super(`${resource} not found: ${id}`, 'NOT_FOUND', 404)
}
}
A central API error handler maps AppError subclasses to the
response envelope; unknown/unexpected errors get a generic 500 with a
logged (not exposed) stack trace.
For unreliable external dependencies: retry transient failures with backoff, but cap retries and fail loudly once exhausted — a silent infinite retry loop is worse than a fast, visible failure. Reach for a circuit breaker only when a dependency's outages are frequent enough that retry-storming it makes things worse.
No third-party error-tracking service by default at this scale —
structured logs (not bare console.log strings) with enough context to
debug from: error code, relevant IDs, request context. Log at the point
the error is handled, not redundantly at every layer it passes through.
Revisit this default (Sentry or platform-native equivalent) once a project has real production traffic where errors need to be triaged without direct log access, or ships to end users where "someone tells me it's broken" isn't a fast enough feedback loop.
warisskill-system-design-distributed-patterns's triggers are actually
met.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub sodiqabdulwaris/waris-skill-library --plugin waris-skill-library129 skills in this plugin
/api-and-interface-designGuides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints, defining type contracts between modules, or establishing boundaries between frontend and backend./browser-testing-with-devtoolsTests in real browsers via Chrome DevTools MCP. Use when building or debugging anything that runs in a browser. Use when you need to inspect the DOM, capture console errors, analyze network requests, profile performance, or verify visual output with real runtime data. Requires the chrome-devtools MCP server to be configured./