go-error-handling-patterns

Community

Standardize Go error handling across services.

AuthorPremModhaOfficial
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Go applications often duplicate error handling logic, leading to inconsistent messages and debugging challenges. This skill provides a unified AppError type and a standardized error workflow across services, including stack traces for debugging while emitting user-safe messages to clients.

Core Features & Use Cases

  • Unified AppError type with Code, Message, Detail, HTTPStatus, and stack traces, enabling consistent error responses and easier tracing.
  • Constructors for common domain errors (NotFound, Validation, Unauthorized, Forbidden, Internal, TenantMismatch), plus a simple Internal wrapper for unexpected causes.
  • Error wrapping with fmt.Errorf %w to preserve error chains for errors.Is / errors.As.
  • Domain-level error catalogs and sentinel errors to centralize domain semantics and reduce duplication.
  • PII-safe user messages with internal details kept in non-serialized fields for debugging.

Quick Start

Start using the shared AppError constructors in your services to emit consistent, safe errors.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: go-error-handling-patterns
Download link: https://github.com/PremModhaOfficial/go-sdk-pipeline/archive/main.zip#go-error-handling-patterns

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.