go-error

Generate typed custom Go errors with bricks/pkg/errs library.

Updated Jan 4, 2026
One-click install
npx skills add https://github.com/cristiano-pacheco/ai-tools --skill go-error-cristiano-pacheco
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-error
Source: https://github.com/cristiano-pacheco/ai-tools/tree/main/skills/go-error
Command: npx skills add https://github.com/cristiano-pacheco/ai-tools --skill go-error-cristiano-pacheco

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the creation and management of typed, custom errors within Go modules, ensuring consistent error handling and reducing the risk of unhandled exceptions or generic error messages.

Core Features & Use Cases

  • Typed Error Generation: Creates specific, code-defined error types for different failure scenarios.
  • Validation Error Helpers: Provides functions to create detailed validation errors with field-level information.
  • Use Case: When a user attempts to update a profile with invalid data, this Skill helps generate a ErrProfileValidationFailed error that includes which specific fields were incorrect, aiding in user feedback.

Quick Start

Use the go-error skill to add a new typed error definition for profile not found.

Frequently Asked Questions about go-error

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

FAQPage Schema
How do I generate custom typed errors in Go modules?

To generate custom typed errors in Go modules, use this Skill to scaffold code-defined error types in the `internal/modules/<module>/errs/errs.go` file using the `bricks/pkg/errs` library, ensuring consistent error handling and code uniqueness.

How do I create validation errors with field-level details in Go?

You create validation errors with field-level details in Go by using this Skill to generate validation error helpers, which specify exactly which data fields failed validation to provide precise user feedback.

What is the best way to structure module errors for code uniqueness in Go?

The best way to structure module errors for code uniqueness is to place generated typed errors in `internal/modules/<module>/errs/errs.go`, following a defined pattern for message formatting and error code management.

Can I extend existing error definitions in a Go module?

Yes, you can extend existing error definitions in a Go module by using this Skill to add new error codes or modify existing custom types without breaking the established error handling pattern.

How does typed error generation improve Go application error handling?

Typed error generation improves Go application error handling by replacing generic error messages with specific, code-defined error types, reducing the risk of unhandled exceptions and streamlining failure scenario management.

Do I need the bricks/pkg/errs library to use generated Go errors?

Yes, you need the `bricks/pkg/errs` library, as this Skill generates typed custom errors and validation helpers specifically designed to integrate with its error definition patterns.