Agent skill

Golang Samber Oops

by context-labs in context-labs/whip

Structured error handling in Golang with samber/oops — error builders, stack traces, codes, context, wrapping, attributes, user-facing vs developer messages, panic recovery, logger integration.

MITAuto-check passedDevelopment

Install Golang Samber Oops

skills CLI
$ npx skills add context-labs/whip --skill golang-samber-oops -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install context-labs/whip golang-samber-oops --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/context-labs/whip.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/golang-samber-oops .claude/skills/golang-samber-oops && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
golang-samber-oops
GitHub stars
1.1k
Used in
1 other repo
Token cost
~2.6k tokens
SKILL.md length
573 words
Files
3 (incl. references)
Skills in repo
40
Repo updated
First seen
Licence
MIT

At a glance

Structured error handling in Golang with samber/oops — error builders, stack traces, codes, context, wrapping, attributes, user-facing vs developer messages, panic recovery, logger integration.

  • Tasks that involve Debugging
  • SKILL.md covers Why use samber/oops, Core pattern: Error builder…, Common scenarios and Error wrapping best practices, plus 5 more sections
  • Reaches doc.acme.org
  • Tasks that involve Error handling

What it does

Golang Samber Oops is an agent skill from context-labs/whip. Structured error handling in Golang with samber/oops — error builders, stack traces, codes, context, wrapping, attributes, user-facing vs developer messages, panic recovery, logger integration. Apply when using/adopting samber/oops or the codebase imports github.com/samber/oops.

Its SKILL.md is about 2.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `evals/evals.json` and `references/advanced.md`). Compatibility notes: Designed for Claude Code, Codex or similar harness, and for projects using Golang.

It sits in Development, covering Debugging and Error handling. It works with Go and GitHub. The repository describes itself as: A fast coding-agent harness in Go. Tool-use loop, bubbletea TUI, provider-routable models with live catalog discovery, MCP support, background subagents. One binary, no runtime… The licence is MIT.

When your agent uses it

  • Tasks that involve Debugging
  • Tasks that involve Error handling

Example prompts

  • “/golang-samber-oops”

Requirements

  • Compatibility (from SKILL.md): Designed for Claude Code, Codex or similar harness, and for projects using Golang.
  • Pre-approved tools (allowed-tools): Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), Agent, WebFetch, mcp__context7__resolve-library-id, mcp__context7__query-docs, Bash(godig:*), Bash(gopls:*), LSP, mcp__gopls__*

What it can do on your machine

Read from SKILL.md and the folder at commit 8876467. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Edit
    • Write
    • Glob
    • Grep
    • Bash(go:*)
    • Bash(golangci-lint:*)
    • Bash(git:*)
    • Agent
    • WebFetch

    …and 6 more on the same allowed-tools line.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are go).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • doc.acme.org

    Also links to:

    • github.com
    • pkg.go.dev

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code, Codex or similar harness, and for projects using Golang.

    From compatibility in the SKILL.md frontmatter.

Context cost

Golang Samber Oops loads about 2.6k tokens when it runs, and up to ~2.9k if it reads all its reference files. Until then it costs about 75 tokens; SKILL.md has 573 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~75
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from context-labs/whip at commit 8876467, republished under its MIT licence (© context-labs). 573 words, ~2,594 tokens.

Download SKILL.mdSave it as .claude/skills/golang-samber-oops/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
golang-samber-oops
description
Structured error handling in Golang with samber/oops — error builders, stack traces, codes, context, wrapping, attributes, user-facing vs developer messages, panic recovery, logger integration. Apply when using/adopting samber/oops or the codebase imports github.com/samber/oops.
allowed-tools
Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), Agent, WebFetch, mcp__context7__resolve-library-id, mcp__context7__query-docs, Bash(godig:*), Bash(gopls:*), LSP, mcp__gopls__*
compatibility
Designed for Claude Code, Codex or similar harness, and for projects using Golang.
user-invocable
true
license
MIT
metadata.author
samber
metadata.version
1.2.0
paths
**/*.go

Persona: You are a Go engineer who treats errors as structured data. Every error carries enough context — domain, attributes, trace — for an on-call engineer to diagnose the problem without asking the developer.

samber/oops Structured Error Handling

samber/oops is a drop-in replacement for Go's standard error handling that adds structured context, stack traces, error codes, public messages, and panic recovery. Variable data goes in .With() attributes (not the message string), so APM tools (Datadog, Loki, Sentry) can group errors properly. Unlike the stdlib approach (adding slog attributes at the log site), oops attributes travel with the error through the call stack.

Why use samber/oops

Standard Go errors lack context — you see connection failed but not which user triggered it, what query was running, or the full call stack. samber/oops provides:

  • Structured context — key-value attributes on any error
  • Stack traces — automatic call stack capture
  • Error codes — machine-readable identifiers
  • Public messages — user-safe messages separate from technical details
  • Low-cardinality messages — variable data in .With() attributes, not the message string, so APM tools group errors properly

This skill is not exhaustive. Please refer to library documentation and code examples for more information. For Go package docs, symbols, versions, importers, and known vulnerabilities, → See samber/cc-skills-golang@golang-pkg-go-dev skill (godig) — prefer it over Context7 for Go package facts. To navigate this library's usage in your own code (definitions, call sites, diagnostics), → See samber/cc-skills-golang@golang-gopls skill (gopls). Context7 remains a fallback for docs not indexed on pkg.go.dev.

Core pattern: Error builder chain

All oops errors use a fluent builder pattern:

go
err := oops.
    In("user-service").           // domain/feature
    Tags("database", "postgres").  // categorization
    Code("network_failure").       // machine-readable identifier
    User("user-123", "email", "foo@bar.com").  // user context
    With("query", query).          // custom attributes
    Errorf("failed to fetch user: %s", "timeout")

Terminal methods:

  • .Errorf(format, args...) — create a new error
  • .Wrap(err) — wrap an existing error
  • .Wrapf(err, format, args...) — wrap with a message
  • .Join(err1, err2, ...) — combine multiple errors
  • .Recover(fn) / .Recoverf(fn, format, args...) — convert panic to error
Show full SKILL.md (291 more words)Show less
Error builder methods
MethodsUse case
.With("key", value)Add custom key-value attribute (lazy func() any values supported)
.WithContext(ctx, "key1", "key2")Extract values from Go context into attributes (lazy values supported)
.In("domain")Set the feature/service/domain
.Tags("auth", "sql")Add categorization tags (query with err.HasTag("tag"))
.Code("iam_authz_missing_permission")Set machine-readable error identifier/slug
.Public("Could not fetch user.")Set user-safe message (separate from technical details)
.Hint("Runbook: https://doc.acme.org/doc/abcd.md")Add debugging hint for developers
.Owner("team/slack")Identify responsible team/owner
.User(id, "k", "v")Add user identifier and attributes
.Tenant(id, "k", "v")Add tenant/organization context and attributes
.Trace(id)Add trace / correlation ID (default: ULID)
.Span(id)Add span ID representing a unit of work/operation (default: ULID)
.Time(t)Override error timestamp (default: time.Now())
.Since(t)Set duration based on time since t (exposed via err.Duration())
.Duration(d)Set explicit error duration
.Request(req, includeBody)Attach *http.Request (optionally including body)
.Response(res, includeBody)Attach *http.Response (optionally including body)
oops.FromContext(ctx)Start from an OopsErrorBuilder stored in a Go context

Common scenarios

Database/repository layer
go
func (r *UserRepository) FetchUser(id string) (*User, error) {
    query := "SELECT * FROM users WHERE id = $1"
    row, err := r.db.Query(query, id)
    if err != nil {
        return nil, oops.
            In("user-repository").
            Tags("database", "postgres").
            With("query", query).
            With("user_id", id).
            Wrapf(err, "failed to fetch user from database")
    }
    // ...
}
HTTP handler layer
go
func (h *Handler) CreateUser(w http.ResponseWriter, r *http.Request) {
    userID := getUserID(r)

    err := h.service.CreateUser(r.Context(), userID)
    if err != nil {
        err = oops.
            In("http-handler").
            Tags("endpoint", "/users").
            Request(r, false).
            User(userID).
            Wrapf(err, "create user failed")
        http.Error(w, oops.GetPublic(err, "Internal server error"), http.StatusInternalServerError)
        return
    }

    w.WriteHeader(http.StatusCreated)
}
Service layer with reusable builder
go
func (s *UserService) CreateOrder(ctx context.Context, req CreateOrderRequest) error {
    builder := oops.
        In("order-service").
        Tags("orders", "checkout").
        Tenant(req.TenantID, "plan", req.Plan).
        User(req.UserID, "email", req.UserEmail)

    product, err := s.catalog.GetProduct(ctx, req.ProductID)
    if err != nil {
        return builder.
            With("product_id", req.ProductID).
            Wrapf(err, "product lookup failed")
    }

    if product.Stock < req.Quantity {
        return builder.
            Code("insufficient_stock").
            Public("Not enough items in stock.").
            With("requested", req.Quantity).
            With("available", product.Stock).
            Errorf("insufficient stock for product %s", req.ProductID)
    }

    return nil
}

Error wrapping best practices

DO: Wrap directly, no nil check needed
go
// ✓ Good — Wrap returns nil if err is nil
return oops.Wrapf(err, "operation failed")

// ✗ Bad — unnecessary nil check
if err != nil {
    return oops.Wrapf(err, "operation failed")
}
return nil
DO: Add context at each layer

Each architectural layer SHOULD add context via Wrap/Wrapf — at least once per package boundary (not necessarily at every function call).

go
// ✓ Good — each layer adds relevant context
func Controller() error {
    return oops.In("controller").Trace(traceID).Wrapf(Service(), "user request failed")
}

func Service() error {
    return oops.In("service").With("op", "create_user").Wrapf(Repository(), "db operation failed")
}

func Repository() error {
    return oops.In("repository").Tags("database", "postgres").Errorf("connection timeout")
}
DO: Keep error messages low-cardinality

Error messages MUST be low-cardinality for APM aggregation. Interpolating variable data into the message breaks grouping in Datadog, Loki, Sentry.

go
// ✗ Bad — high-cardinality, breaks APM grouping
oops.Errorf("failed to process user %s in tenant %s", userID, tenantID)

// ✓ Good — static message + structured attributes
oops.With("user_id", userID).With("tenant_id", tenantID).Errorf("failed to process user")

Panic recovery

oops.Recover() MUST be used in goroutine boundaries. Convert panics to structured errors:

go
func ProcessData(data string) (err error) {
    return oops.
        In("data-processor").
        Code("panic_recovered").
        Hint("Check input data format and dependencies").
        With("input_data", data).
        Recover(func() {
            riskyOperation(data)
        })
}

Accessing error information

samber/oops errors implement the standard error interface. Access additional info:

go
if oopsErr, ok := err.(oops.OopsError); ok {
    fmt.Println("Code:", oopsErr.Code())
    fmt.Println("Domain:", oopsErr.Domain())
    fmt.Println("Tags:", oopsErr.Tags())
    fmt.Println("Context:", oopsErr.Context())
    fmt.Println("Stacktrace:", oopsErr.Stacktrace())
}

// Get public-facing message with fallback
publicMsg := oops.GetPublic(err, "Something went wrong")
Output formats
go
fmt.Printf("%+v\n", err)       // verbose with stack trace
bytes, _ := json.Marshal(err)  // JSON for logging
slog.Error(err.Error(), slog.Any("error", err))  // slog integration

Context propagation

Carry error context through Go contexts:

go
func middleware(next http.Handler) http.Handler {
    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        builder := oops.
            In("http").
            Request(r, false).
            Trace(r.Header.Get("X-Trace-ID"))

        ctx := oops.WithBuilder(r.Context(), builder)
        next.ServeHTTP(w, r.WithContext(ctx))
    })
}

func handler(ctx context.Context) error {
    return oops.FromContext(ctx).Tags("handler", "users").Errorf("something failed")
}

For assertions, configuration, and additional logger examples, see Advanced patterns.

References

Cross-References

  • → See samber/cc-skills-golang@golang-error-handling skill for general error handling patterns
  • → See samber/cc-skills-golang@golang-observability skill for logger integration and structured logging

© context-labs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in .agents/skills/golang-samber-oops of context-labs/whip.

  • SKILL.md
  • evals/evals.json
  • references/advanced.md

Open the folder on GitHubat commit 8876467

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in context-labs/whip, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Golang Samber Oops next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Golang Samber Oops compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Golang Samber Oops this skillcontext-labs/whip1.1k1 repos~2.6kAutomated safety check: PassMIT
Golang Samber Mosamber/cc-skills-golang3.4k—~2.9kAutomated safety check: PassMIT
Error Recovery Patternsgithub/gh-aw5.4k—~824Automated safety check: PassMIT
Native Data FetchingCherryHQ/cherry-studio-app4k6 repos~2.9kAutomated safety check: NotesMIT
Exposed Bug Fix WorkflowJetBrains/Exposed9.3k—~3.8kAutomated safety check: PassApache-2.0
AO Desktop App LauncherOrchestratorInc/agent-orchestrator13k—~2.4kAutomated safety check: PassApache-2.0

Similar skills

  • Golang Samber Mo

    samber/cc-skills-golang

    Monadic types for Golang using samber/mo — Option, Result, Either, Future, IO, Task, and State types for type-safe nullable values, error handling, and functional composition with pipeline…

    3.4k GitHub stars~2.9k tokensUpdated 9 days ago
    DevelopmentAuto-check passed
  • Official

    Design gh-aw error handling, retry, recovery, and debugging flows.

    5.4k GitHub stars~824 tokensUpdated today
    DevelopmentAuto-check passed
  • Native Data Fetching

    CherryHQ/cherry-studio-app

    A skill your agent uses when implementing or debugging ANY network request, API call, or data fetching.

    4k GitHub starsUsed in 6 repos~2.9k tokens
    DevelopmentAuto-check: notes
  • Exposed Bug Fix Workflow

    JetBrains/Exposed

    Official

    Takes a GitHub or YouTrack issue for the Exposed project through reproduction, a failing test, a fix, validation and a pull request.

    9.3k GitHub stars~3.8k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • AO Desktop App Launcher

    OrchestratorInc/agent-orchestrator

    Launches, restarts and troubleshoots the real AO Electron desktop app from a checkout, with isolated or real local data and checks for stale processes.

    13k GitHub stars~2.4k tokensUpdated today
    DevelopmentAuto-check passed
  • Official

    Prepares a go-redis release locally: picks the next semver, gathers merged PRs, writes the RELEASE-NOTES entry and bumps versions, without publishing.

    22k GitHub stars~1.1k tokensUpdated yesterday
    DevelopmentAuto-check passed

More from context-labs/whip

All 40 skills in this repo
  • Golang Lint

    context-labs/whip

    Linting best practices and golangci-lint configuration for Go — running linters, configuring .golangci.yml, nolint suppressions, selecting linters.

    1.1k GitHub starsUsed in 2 repos~1.8k tokens
    Auto-check passed
  • Golang Project Layout

    context-labs/whip

    Golang project layouts and workspaces. An agent skill from context-labs/whip.

    1.1k GitHub starsUsed in 1 repo~1.8k tokens
    Auto-check passed
  • Golang Pkg Go Dev

    context-labs/whip

    Golang package/module docs via godig, a pkg.go.dev API client (CLI + MCP) — APIs, symbols, versions, importers, licenses, vulnerabilities.

    1.1k GitHub starsUsed in 2 repos~3k tokens
    Auto-check passed
  • Golang Stretchr Testify

    context-labs/whip

    Golang testing with stretchr/testify — assert, require, mock, suite: assertions, mock expectations, argument matchers, suite lifecycle, Eventually, JSONEq.

    1.1k GitHub starsUsed in 2 repos~1.8k tokens
    Auto-check passed
  • CI/CD with GitHub Actions for Golang — testing, linting, SAST, security scanning, coverage, Dependabot, Renovate, GoReleaser, release pipelines.

    1.1k GitHub stars~3.5k tokensUpdated 5 days ago
    Auto-check passed
  • Golang Data Structures

    context-labs/whip

    Golang data structures — slices/maps internals (capacity growth, preallocation, hash buckets), slices/maps packages, container/list/heap/ring, strings.Builder vs bytes.Buffer, generic collections…

    1.1k GitHub starsUsed in 1 repo~2.6k tokens
    Auto-check passed

Works with

Categories

Questions about Golang Samber Oops

What does Golang Samber Oops do?

Structured error handling in Golang with samber/oops — error builders, stack traces, codes, context, wrapping, attributes, user-facing vs developer messages, panic recovery, logger integration. Golang Samber Oops is an agent skill from context-labs/whip. Structured error handling in Golang with samber/oops — error builders, stack traces, codes, context, wrapping, attributes, user-facing vs developer messages, panic recovery, logger integration.

When should I use Golang Samber Oops?

Golang Samber Oops fits situations like: tasks that involve Debugging; tasks that involve Error handling.

How do I install Golang Samber Oops in Claude Code?

Run `npx skills add context-labs/whip --skill golang-samber-oops -a claude-code`. Or copy the skill folder (.agents/skills/golang-samber-oops in context-labs/whip) into .claude/skills/golang-samber-oops in your project. Claude Code loads it when a task matches its description.

How do I install Golang Samber Oops in Codex?

Run `npx skills add context-labs/whip --skill golang-samber-oops -a codex`. Or copy the skill folder (.agents/skills/golang-samber-oops in context-labs/whip) into .agents/skills/golang-samber-oops in your project. Codex loads it when a task matches its description.

Can I use Golang Samber Oops in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add context-labs/whip --skill golang-samber-oops -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/golang-samber-oops, .gemini/skills/golang-samber-oops, .github/skills/golang-samber-oops and .opencode/skills/golang-samber-oops in your project.

What does Golang Samber Oops need to run?

SKILL.md names no scripts, command-line tools or credentials: Golang Samber Oops is instructions for the agent only. Its frontmatter pre-approves these tools: Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), Agent, WebFetch, mcp__context7__resolve-library-id, mcp__context7__query-docs, Bash(godig:*), Bash(gopls:*), LSP, mcp__gopls__*. Compatibility (from SKILL.md): Designed for Claude Code, Codex or similar harness, and for projects using Golang..

Does Golang Samber Oops access the network?

SKILL.md names 3 domains. In commands or code: doc.acme.org; the agent is likely to contact it when it follows the instructions. As links in the text: github.com and pkg.go.dev. This is read from the text; nothing was executed.

Is Golang Samber Oops safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Golang Samber Oops use?

Golang Samber Oops is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Golang Samber Oops use?

About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 337 tokens, read only when the agent opens those files.

What are the alternatives to Golang Samber Oops?

Skills that share tags, products or a category with Golang Samber Oops: Golang Samber Mo (samber/cc-skills-golang, 3.4k stars), Error Recovery Patterns (github/gh-aw, 5.4k stars), Native Data Fetching (CherryHQ/cherry-studio-app, 4k stars) and Exposed Bug Fix Workflow (JetBrains/Exposed, 9.3k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Golang Samber Oops?

context-labs (a GitHub organization) maintains it in context-labs/whip, which has 1,083 GitHub stars. The repository holds 40 skills in this directory. The repository was last updated on October 5, 2026.

Source: context-labs/whip on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.