golang-samber-oops

Create structured Go errors with context, codes, and stack traces.

Updated May 19, 2026
One-click install
npx skills add https://github.com/monforje/.opencode --skill golang-samber-oops-monforje
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-samber-oops
Source: https://github.com/monforje/.opencode/tree/main/skills/cc-skills-golang/skills/golang-samber-oops
Command: npx skills add https://github.com/monforje/.opencode --skill golang-samber-oops-monforje

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires github.com/samber/oops, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides structured error handling in Golang, enhancing traceability and context awareness for error messages.

Core Features & Use Cases

  • Structured Error Handling: Adds structured context, stack traces, error codes, and error wrapping to standard Go errors.
  • Error Attributes: Enables the addition of key-value attributes to errors, improving APM tooling and debugging.
  • Use Case: When implementing samber/oops in a Golang project, this Skill helps to create and manage structured errors.

Quick Start

Use the golang-samber-oops skill to create a structured error in your Golang code: oops.Errorf("failed to connect to database").

Frequently Asked Questions about golang-samber-oops

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

FAQPage Schema
How do I add structured context and stack traces to Golang errors?

To add structured context and stack traces to Golang errors, you can use the samber/oops library to wrap standard errors with key-value attributes, error codes, and traceable stack frames. This improves error diagnosis and APM integration.

What is the best way to improve error traceability for APM tooling in Go?

The best way to improve error traceability for APM tooling in Go is to attach structured error attributes and stack traces to your errors. This allows monitoring tools to capture richer context, making it easier to diagnose application failures.

How do I create a structured error using samber/oops in my Golang project?

To create a structured error using samber/oops, call oops.Errorf("message") in your Golang code. You can then chain methods to append error codes and key-value context attributes before returning the error to the caller.

Do I need a specific Go environment setup to use structured error handling with samber/oops?

You need a configured Go environment and the samber/oops library installed as a dependency. This setup allows you to generate structured errors with stack traces and contextual attributes for your application.

How does structured error wrapping differ from standard Golang error handling?

Structured error wrapping differs from standard Golang error handling by embedding rich metadata, error codes, and stack traces directly into the error object. Standard errors typically only provide simple string messages without execution context.

Can I attach custom key-value attributes to Go errors for better debugging?

You can attach custom key-value attributes to Go errors using structured error handling techniques. This enriches the error payload with contextual data, enabling more effective debugging and detailed tracking within APM systems.