golang-error-handling

Create, wrap, inspect, and log Go errors with %w and slog.

Updated Jun 27, 2026
One-click install
npx skills add https://github.com/LuigiAPCPereira/evolutiondocs --skill golang-error-handling-luigiapcpereira
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-error-handling
Source: https://github.com/LuigiAPCPereira/evolutiondocs/tree/main/.agents/skills/golang-error-handling
Command: npx skills add https://github.com/LuigiAPCPereira/evolutiondocs --skill golang-error-handling-luigiapcpereira

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires go, golangci-lint, git, slog, samber/oops, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps in creating, wrapping, inspecting, and logging errors in Go code, following idiomatic best practices and reducing the risk of silent failures.

Core Features & Use Cases

  • Idiomatic Error Handling: Provides guidance on error creation, wrapping with %w, error types, panic/recover, structured logging with slog, and middleware for HTTP requests.
  • Coding Mode: Offers step-by-step instructions for coding best practices and integrates a sub-agent to find potential issues in adjacent code.
  • Review Mode: Assesses error handling changes in PRs, focusing on diffs and looking for issues like swallowed errors and missing wrapping context.
  • Audit Mode: Scans the entire codebase, utilizing parallel sub-agents to ensure thorough auditing of various error handling categories.

Quick Start

To audit the error handling of a specific project, activate the skill in the context of a Golang codebase.

Frequently Asked Questions about golang-error-handling

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

FAQPage Schema
How do I handle Go errors using slog and structured logging?

Handle Go errors using slog by wrapping errors with %w and integrating structured logging to capture detailed context. This Skill automates error structuring with samber/oops and slog, reducing silent failures in large-scale log aggregation.

What is the best way to audit a Golang codebase for swallowed errors?

The best way to audit for swallowed errors is running an automated codebase scan. This Skill utilizes parallel sub-agents to inspect error handling categories, identifying missing wrapping context and silent failures across your entire project.

How do I wrap errors in Go without losing the original stack trace?

Wrap errors in Go without losing the original trace by using the %w verb and structuring errors with samber/oops. This Skill provides idiomatic error wrapping and inspection guidance to ensure full context is retained for debugging.

Does this Go error handling approach work with golangci-lint?

Yes, this Go error handling approach works directly with golangci-lint. The Skill integrates with Golang-specific linters and AI coding agents to enforce best practices and review PR diffs for swallowed errors or missing wrapping context.

How do I review PR diffs for missing error wrapping context in Go?

Review PR diffs for missing error wrapping context by using the Skill's Review Mode. It assesses error handling changes in pull requests, focusing specifically on diffs to find swallowed errors and ensure proper %w wrapping integration.

Can I use this Skill to find potential error handling issues in adjacent Go code?

Yes, you can find potential error handling issues in adjacent code by using Coding Mode. It offers step-by-step best practices and integrates a sub-agent specifically designed to find potential issues in adjacent code while you develop.