golang-fullstack-error-handling

golang-fullstack-error-handling is a skill for Claude Code, Codex from saifoelloh/golang-best-practices-skill. It costs 60 tokens per session (821 once invoked), scanned A, original, MIT.

A review guide for handling errors in Go services that use GORM, a Go database library, and PostgreSQL, a relational database.

In plain words
What is it for?
Use it to review error propagation, error wrapping, database error mapping, transaction retries, and context use.
Why use it?
It helps prevent lost error details, incorrect database-error handling, context leaks, and unsafe retries.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to review error propagation, error wrapping, database error mapping, transaction retries, and context use.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/saifoelloh/golang-best-practices-skill/error-handling
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add saifoelloh/golang-best-practices-skill --skill error-handling
Clone the repo
git clone --depth 1 https://github.com/saifoelloh/golang-best-practices-skill

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for golang-fullstack-error-handling

README.md
[![agentmods](https://agentmods.dev/badge/skills/saifoelloh/golang-best-practices-skill/error-handling/github.svg)](https://agentmods.dev/skills/saifoelloh/golang-best-practices-skill/error-handling)
Your own site
<a href="https://agentmods.dev/skills/saifoelloh/golang-best-practices-skill/error-handling"><img src="https://agentmods.dev/badge/skills/saifoelloh/golang-best-practices-skill/error-handling/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for golang-fullstack-error-handling

Your own site · 80×15
<a href="https://agentmods.dev/skills/saifoelloh/golang-best-practices-skill/error-handling"><img src="https://agentmods.dev/badge/skills/saifoelloh/golang-best-practices-skill/error-handling.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 821 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00060 $0.00821
Opus 5 $0.00030 $0.00411
Sonnet 5 $0.00012 $0.00164
Haiku 4.5 $0.00006 $0.00082

Measured 11d ago against content hash 40a028094de1, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

golang-fullstack-error-handling scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

error-handling/SKILL.md · 88 lines

How it starts

The opening of the file, as written. The whole thing — 88 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Error Handling (Unified Go & DB)

Expert-level review for error handling in Go services using GORM and PostgreSQL. Ensures errors are correctly identified, preserved via wrapping, mapped to domain errors, and retried where appropriate.

When to Apply

Use this skill when:

  • Reviewing general Go error propagation and context usage
  • Debugging database errors (e.g., duplicate keys, serialization failures)
  • Auditing error wrapping with %w vs %v
  • Ensuring correct use of errors.Is / errors.As
  • Adding retry logic for serializable transactions or deadlocks

Rule Categories

Priority Count Focus
CRITICAL 6 error chains, context leaks, PgError mapping, retries
HIGH 6 propagation, Is/As usage, RowsAffected, deadlock detection
MEDIUM 2 sentinel errors, structured logging

Rules Covered (14 total)

Critical Issues (6)

  • critical-error-wrapping — Use %w, not %v, to preserve error chains
  • critical-context-leak — Always defer cancel() after context creation
  • critical-error-shadow — Don't shadow err in nested scopes
  • critical-errors-is-as — Use errors.Is/As for DB and wrapped errors
  • critical-pg-error-mapping — Map Postgres codes to domain errors at repo boundary
  • critical-serialization-retry — Retry transactions on 40001 serialization failure

High-Impact Patterns (6)

  • high-context-propagation — Propagate context through the call chain
  • high-error-is-as — Prescriptive rule for using Is/As over string matching
  • high-interface-nil — Check for nil in interfaces correctly
  • high-rows-affected — Check RowsAffected after Update/Delete
  • high-wrap-with-context — Wrap DB errors with operation context
  • high-deadlock-detection — Handle 40P01 deadlocks as retryable

Medium Improvements (2)

  • medium-sentinel-error-usage — Use sentinel errors for stable categories
  • medium-structured-logging — Log DB/Go errors with structured fields

Trigger Phrases

Read the full file on GitHub · 88 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 88 lines · 60 tokens per session scan A 40a028094de1

Subscribe to this mod's changes

golang-fullstack-error-handling is a skill published in the GitHub repository saifoelloh/golang-best-practices-skill (15 stars, last pushed 6mo ago), licensed MIT. It adds 60 tokens to every session and 821 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

go-add-migration

Create properly named PostgreSQL migration files for GOB microservices.

JotJunior/cstk · 17 tokens

encore-go-database

Work with PostgreSQL in Encore Go using sqldb.NewDatabase from encore.dev/storage/sqldb — schema migrations and SQL queries.

encoredev/skills · 37 tokens

mfd

A Go code generator that reads XML descriptions of a PostgreSQL schema and creates models, repositories, services, and test helpers. It is used through project Makefile commands.

vmkteam/claude-plugins · 67 tokens

golang-database

Comprehensive guide for Go database access. Covers parameterized queries, struct scanning, NULLable column handling, error patterns, transactions, isolation levels, SELECT FOR UPDATE, connection pool, batch processing, context propagation, and migration tooling. Use this skill whenever writing, reviewing, or debugging…

emilioforrer/go-stack · 116 tokens

golang-samber-hot

In-memory caching in Golang using samber/hot — eviction algorithms (LRU, LFU, TinyLFU, W-TinyLFU, S3FIFO, ARC, TwoQueue, SIEVE, FIFO), TTL, cache loaders, sharding, stale-while-revalidate, missing key caching, and Prometheus metrics. Apply when using or adopting samber/hot, when the codebase imports…

emilioforrer/go-stack · 122 tokens

azure-resource-manager-postgresql-dotnet

Azure PostgreSQL Flexible Server SDK for .NET. Database management for PostgreSQL Flexible Server deployments. Use for creating servers, databases, firewall rules, configurations, backups, and high availability. Triggers: "PostgreSQL", "PostgreSqlFlexibleServer", "PostgreSQL Flexible Server", "Azure Database for…

microsoft/skills · 97 tokens