go-error-mapper

Generates typed Go domain errors with gRPC/HTTP status mapping and optional stack traces.

Updated Jan 17, 2026
One-click install
npx skills add https://github.com/saddam-eng-tech/ai-agent-skills --skill go-error-mapper
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-error-mapper
Source: https://github.com/saddam-eng-tech/ai-agent-skills/tree/main/go-error-mapper
Command: npx skills add https://github.com/saddam-eng-tech/ai-agent-skills --skill go-error-mapper

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the common issue in Go microservices where developers tend to return generic codes.Internal errors, obscuring the actual domain-specific error conditions and hindering proper error handling by clients.

Core Features & Use Cases

  • Typed Domain Errors: Define custom, typed errors that represent specific business logic failures.
  • gRPC Status Mapping: Automatically map these domain errors to appropriate gRPC status codes (e.g., NotFound, InvalidArgument).
  • HTTP Status Mapping: Optionally map domain errors to corresponding HTTP status codes for RESTful APIs.
  • Stack Trace Capture: Includes optional stack trace capture for enhanced debugging.
  • Use Case: When a user is not found, instead of returning codes.Internal, this skill ensures the service returns codes.NotFound, allowing the client to handle this specific scenario gracefully.

Quick Start

Generate a Go error handling package that maps domain errors to gRPC and HTTP status codes.

Frequently Asked Questions about go-error-mapper

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I map Go domain errors to gRPC status codes in microservices?

Generate a typed domain error package for Go that translates specific business logic failures into appropriate gRPC status codes like NotFound or InvalidArgument, ensuring clients can handle distinct error scenarios gracefully instead of receiving generic Internal errors.

Can I map Go errors to HTTP status codes as well as gRPC codes?

Yes, you can map Go domain errors to HTTP status codes. The generated typed error package optionally supports mapping domain-specific errors to corresponding HTTP status codes for RESTful APIs alongside the primary gRPC status code mapping.

Why does my Go microservice return generic codes.Internal for domain errors?

Go microservices return generic codes.Internal because developers often lack a standardized error mapping mechanism. Defining typed domain errors and specifying target transports allows automatic mapping to correct gRPC status codes based on the specific business logic failure.

How do I generate a Go error handling package with stack trace capture?

Generate a Go error handling package with stack trace capture by defining custom typed domain errors and specifying your target transports. The generated package includes optional stack trace capture to enhance debugging capabilities for gRPC and HTTP services.

What do I need to define before generating a Go domain error package?

Before generating a Go domain error package, you need to define your custom domain error types representing specific business logic failures and specify the target transports, such as gRPC and HTTP, for accurate status code mapping generation.