golang-error-handling

Tinjau · 73
Diindeks di Registry

Idiomatic Golang error handling — creation, wrapping with %w, errors.Is/As, errors.Join, custom error types, sentinel errors, panic/recover, the single handling rule, structured logging with slog, HTTP request logging middleware, and samber/oops for production errors. Built to ma

Verified installs0
Star3.0K
Versi1.0.0
Kualitas82/100 · Kuat
Kepercayaan73/100 · Hanya sandbox
Audit85/100 · Aman untuk dicoba

Profil aset

Agent pemrograman dan pengembangan

Code review, repo analysis, testing, CI, GitHub, DevOps, and developer workflow skills.

Lihat kategori

Skenario

Agent pemrograman

I need a coding agent that can understand a repository, edit code, and review pull requests.

Kecocokan Agent

Claude Code + OpenAI Agents + CLI

Cocok untuk Codex, Claude Code, Cursor, CLI, atau Agent khusus.

Pasang

Siap

npx skills add samber/cc-skills-golang --skill golang-error-handling

Pemeliharaan

Terkini

1 hari sejak push

Risiko

Aman untuk dicoba

Quality score needs review

Kualitas GitHub

3.0K

82/100 Kualitas · 81/100 Kepercayaan

Tag cakupan

CodingAgent pemrogramanRisetagent-skill

Catatan ulasan

Quality score needs review

Kartu adopsi Agent

Kepercayaan, audit, dan kesiapan pemasangan dalam sekali lihat

Skor ini menggabungkan metadata repositori publik, sinyal ulasan OpenAgentSkill, kebaruan pemeliharaan, dan kesiapan pemasangan. Ini adalah sinyal shortlist, bukan pengganti peninjauan manusia.

Kualitas

Kuat
82

Solid option that is likely worth shortlisting for production workflows.

Kepercayaan

Hanya sandbox
73

Kandidat berguna dengan sinyal kepercayaan yang kurang atau bercampur. Gunakan di ruang kerja terisolasi hingga loop hasil membuktikan kecocokan tugas.

Audit

Aman untuk dicoba
85

Tinjauan yang dapat dibaca mesin tentang kesiapan pemasangan, metadata keamanan, pemeliharaan, dan risiko adopsi.

Trust Score OpenAgentSkill v5

Tinjauan manusia sebelum pemasangan

Jalankan hanya dalam sandbox dan bandingkan alternatif terdekat sebelum digunakan untuk kerja nyata.

CodexClaude CodeCursorOpenAgentSkill CLI

Star

3.0K star GitHub

Aktivitas repositori

3.0K star dan 197 fork

Pemeliharaan

1 hari sejak push

Lisensi

MIT

Pasang

npx skills add samber/cc-skills-golang --skill golang-error-handling

Keamanan pemasangan

Jalur pemasangan paket atau runtime standar

Cakupan izin

shell or command execution, network or browser access

Hasil Agent

Belum ada data hasil Agent

Dokumentasi

Konteks README/SKILL.md kuat

Ringkasan risiko

Tinjau sebelum produksi

  • Quality score needs review

Kesiapan pemasangan

Jalur pemasangan tersedia

  • Jalur pemasangan tersedia
  • Bukti repositori tersedia
  • Lisensi dinyatakan
  • Belum ada bukti hasil Agent-Proven

Metadata yang dapat dibaca Agent

Data keputusan yang dapat dibaca mesin untuk skill ini.

Gunakan blok ini atau JSON tersemat untuk memutuskan apakah Agent perlu memasang skill ini, memilih alternatif, atau meminta tinjauan manusia terlebih dahulu.

Buka JSON

Tugas yang sesuai

  • alur kerja Agent pemrograman
  • Tim Claude Code
  • Tim yang menghargai sinyal adopsi GitHub
  • Inspect source files

Agent yang sesuai

CodexClaude CodeCursorOpenAgentSkill CLIOpenAI AgentsCLI

Keputusan pemasangan

Perintah
npx skills add samber/cc-skills-golang --skill golang-error-handling
Kebijakan
Tinjau
Tinjauan manusia
Ya

Kepercayaan dan risiko

Kepercayaan
73/100
Audit
85/100
Tingkat risiko
Aman untuk dicoba

Lingkar hasil

Endpoint
/api/agent/outcome
ID event
resolve
Hasil
5

Perintah pemasangan

npx skills add samber/cc-skills-golang --skill golang-error-handling

Jangan gunakan ketika

  • Tim yang membutuhkan SLA dengan dukungan vendor
  • Lingkungan berkompliansi tinggi tanpa tinjauan keamanan internal
  • No major risk signals from current metadata
  • Petunjuk izin berisiko tinggi: eksekusi shell atau perintah
  • Quality score needs review

Keamanan Agent v2

61/100 · Tinjau sebelum memasang

Ditinjau dengan catatan izinTinjau

Kandidat yang dapat digunakan, tetapi Agent harus menampilkan catatan izin dan audit sebelum memasang.

Memerlukan persetujuan manusia sebelum memasang ke workspace nyata.

Selesaikan via API

Tinggi

Eksekusi shell atau perintah

Metadata skill merujuk terminal, CLI, shell, subprocess, atau alur kerja eksekusi perintah.

Sedang

Akses jaringan

Skill kemungkinan mengambil halaman jarak jauh, API, repositori, atau layanan eksternal.

  • Petunjuk izin berisiko tinggi: eksekusi shell atau perintah
  • Quality score needs review

Target pemasangan

Pasang skill ini di alur Agent Anda

Gunakan endpoint publik untuk mengambil perintah, checklist keamanan, prompt target, dan tautan kanonis.

skill install

OpenAgentSkill CLI

Resolve policy, run the source installer safely, and report a verified install receipt.

$ npx --yes https://github.com/Leon-Drq/openagentskill/releases/download/cli-v0.2.1/openagentskill-0.2.1.tgz install samber-golang-error-handling

Rencana resolusi Agent

Biarkan Agent memverifikasi kecocokan sebelum memasang.

API Resolve mengembalikan skill utama, alternatif, kebijakan keamanan, catatan audit, target pemasangan, dan prompt siap pakai.

Buka rencana teks

Agent harus memeriksa

  • Task fit and alternatives from Resolve API.
  • Audit score, trust score, and safety policy warnings.
  • Install target compatibility for Codex, Claude Code, Cursor, or CLI.

Salin prompt

Task: Use golang-error-handling in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20golang-error-handling%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/samber-golang-error-handling/install
Install command: npx skills add samber/cc-skills-golang --skill golang-error-handling
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.

Serah-terima Agent

Berikan jalur pemasangan kepada Agent, bukan direktori lain.

Gunakan endpoint publik untuk mengambil perintah, checklist keamanan, prompt target, dan tautan kanonis.

Buka API pemasangan

Prompt Agent

Use golang-error-handling for this task. Review https://www.openagentskill.com/api/skills/samber-golang-error-handling/install, then install with: npx skills add samber/cc-skills-golang --skill golang-error-handling

Metadata Registry

Profil yang dapat dibaca Agent untuk pemilihan skill otomatis.

API Registry menyediakan sinyal keputusan, kepercayaan, audit, use case, dan pemasangan tanpa mengikis UI.

Buka Manifest

Kecocokan Agent

95/100

Agent pemrograman

Platform

Claude Code, OpenAI Agents

Laporan audit

Aman untuk dicoba · 85/100

Tinjauan yang dapat dibaca mesin tentang kesiapan pemasangan, metadata keamanan, pemeliharaan, dan risiko adopsi.

Lihat laporan auditLihat laporan evaluasi

Panel keputusan Agent

Pilihan utama untuk Agent pemrograman

Use this as a leading candidate, then validate the README and install path in your own agent stack.

95
Kesiapan
Adopsi
Tahap

Peran di stack

Pilihan utama

Kecocokan utama

Agent pemrograman

Label kepercayaan

Siap produksi

Jalur pemasangan

Perintah siap

Gunakan saat

  • alur kerja Agent pemrograman
  • Tim Claude Code
  • Tim yang menghargai sinyal adopsi GitHub

Bukti

  • 3,022 star GitHub
  • recent repository activity
  • install command or GitHub repo available
  • profil kualitas 82/100
  • 6 event interaksi OpenAgentSkill

tinjau dulu

  • No major risk signals from current metadata

Jalur implementasi

  1. 1Pasang di Agent sandbox dan jalankan satu tugas Agent pemrograman dari awal hingga akhir.
  2. 2Compare output quality, latency, and failure behavior against at least one alternative.
  3. 3Promote it into production only after reviewing repository permissions, license, and maintenance signals.

Profil kepercayaan

Hanya sandbox

Kandidat berguna dengan sinyal kepercayaan yang kurang atau bercampur. Gunakan di ruang kerja terisolasi hingga loop hasil membuktikan kecocokan tugas.

73
Trust Score OpenAgentSkill

Adopsi GitHub

Lulus

3.0K star GitHub

Aktivitas star/fork

Info

3.0K star dan 197 fork; aktivitas issue tidak tersedia dalam metadata saat ini

Pemeliharaan terbaru

Lulus

1 hari sejak push

Kejelasan lisensi

Lulus

MIT

Sinyal positif

  • Tinjauan AI disetujui
  • Jalur pemasangan tersedia
  • Bukti repositori tersedia
  • Repositori yang baru dipelihara
  • Sinyal adopsi GitHub yang bermakna
  • Perintah pemasangan tidak memiliki pola berisiko tinggi yang jelas
  • Loop hasil siap tetapi membutuhkan eksekusi Agent nyata pertama

Tinjau sebelum memasang

  • Quality score needs review
  • Belum ada laporan hasil Agent nyata
  • Tinjauan manusia diperlukan sebelum pemasangan tanpa pengawasan

Tindakan yang disarankan

Jalankan hanya dalam sandbox dan bandingkan alternatif terdekat sebelum digunakan untuk kerja nyata.

Profil kualitas

Kuat kandidat untuk alur kerja Agent

Solid option that is likely worth shortlisting for production workflows.

82
Star GitHub
3.0K
Keterkinian
1 hari lalu
Siap dipasang
Ya
Lisensi
MIT

Kecocokan alur kerja

Gunakan skill ini pada skenario berikut

Kecocokan alur kerja

Tambahkan ke alur kerja lengkap

Daftar alternatif

Bandingkan sebelum memasang

Similar skills that may fit this task.

Bandingkan semua

Ringkasan

--- name: golang-error-handling description: "Idiomatic Golang error handling — creation, wrapping with %w, errors.Is/As, errors.Join, custom error types, sentinel errors, panic/recover, the single handling rule, structured logging with slog, HTTP request logging middleware, and samber/oops for production errors. Built to make logs usable at scale with log aggregation 3rd-party tools. Apply when creating, wrapping, inspecting, or logging errors in Go code. For samber/oops specifics → See `samber/cc-skills-golang@golang-samber-oops` skill; for slog handler ecosystem → See `samber/cc-skills-golang@golang-samber-slog` skill." user-invocable: true license: MIT compatibility: Designed for Claude Code, Codex or similar harness, and for projects using Golang. metadata: author: samber version: "1.3.0" openclaw: emoji: "⚠" homepage: https://github.com/samber/cc-skills-golang requires: bins: - go install: [] allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent paths: - "**/*.go" ---

**Persona:** You are a Go reliability engineer. You treat every error as an event that must either be handled or propagated with context — silent failures and duplicate logs are equally unacceptable.

**Orchestration mode:** Fan out the five category sub-agents described in the "Parallelizing Error Handling Audits" section (creation, wrapping, single-handling rule, panic/recover, structured logging) for auditing error handling across a large codebase, and consolidate their findings. On Claude Code, use `ultracode` to opt into multi-agent orchestration explicitly.

**Modes:**

- **Coding mode** — writing new error handling code. Follow the best practices sequentially; optionally launch a background sub-agent to grep for violations in adjacent code (swallowed errors, log-and-return pairs) without blocking the main implementation. - **Review mode** — reviewing a PR's error handling changes. Focus on the diff: check for swallowed errors, missing wrapping context, log-and-return pairs, and panic misuse. Sequential. - **Audit mode** — auditing existing error handling across a codebase. Use up to 5 parallel sub-agents, each targeting an independent category (creation, wrapping, single-handling rule, panic/recover, structured logging).

> **Community default.** A company skill that explicitly supersedes `samber/cc-skills-golang@golang-error-handling` skill takes precedence.

# Go Error Handling Best Practices

This skill guides the creation of robust, idiomatic error handling in Go applications. Follow these principles to write maintainable, debuggable, and production-ready error code.

## Best Practices Summary

1. **Returned errors MUST always be checked** — NEVER discard with `_` 2. **Errors MUST be wrapped with context** using `fmt.Errorf("{context}: %w", err)` 3. **Error strings MUST be lowercase**, without trailing punctuation 4. **Use `%w` internally, `%v` at system boundaries** to control error chain exposure 5. **MUST use `errors.Is` for sentinel matching and `errors.As`/`errors.AsType` for typed chain inspection** instead of direct comparison or bare type assertions. For Go 1.26+, prefer `errors.AsType[T](err)` when `T` implements `error`; use `errors.As(err, &target)` for Go <1.26 or for non-error interface targets. 6. **SHOULD use `errors.Join`** (Go 1.20+) to combine independent errors 7. **Errors MUST be either logged OR returned**, NEVER both (single handling rule) 8. **Use sentinel errors** for expected conditions, custom types for carrying data 9. **NEVER use `panic` for expected error conditions** — reserve for truly unrecoverable states 10. **SHOULD use `slog`** (Go 1.21+) for structured error logging — not `fmt.Println` or `log.Printf` 11. **Use `samber/oops`** for production errors needing stack traces, user/tenant context, or structured attributes 12. **Log HTTP requests** with structured middleware capturing method, path, status, and duration 13. **Use log levels** to indicate error severity 14. **Never expose technical errors to users** — translate internal errors to user-friendly messages, log technical details separately 15. **Keep log grouping low-cardinality** — at logging/APM boundaries, keep message templates stable and attach IDs, paths, line numbers, and counts as structured attributes. Error values may include useful operational context, but avoid putting high-cardinality data into the stable log message used for grouping.

## Detailed Reference

- **[Error Creation](./references/error-creation.md)** — How to create errors that tell the story: error messages should be lowercase, no punctuation, and describe what happened without prescribing action. Covers sentinel errors (one-time preallocation for performance), custom error types (for carrying rich context), and the decision table for which to use when.

- **[Error Wrapping and Inspection](./references/error-wrapping.md)** — Why `fmt.Errorf("{context}: %w", err)` beats `fmt.Errorf("{context}: %v", err)` (chains vs concatenation). How to inspect chains with `errors.Is`, `errors.As`, and Go 1.26+ `errors.AsType` for type-safe error handling, and `errors.Join` for combining independent errors.

- **[Error Handling Patterns and Logging](./references/error-handling.md)** — The single handling rule: errors are either logged OR returned, NEVER both (prevents duplicate logs cluttering aggregators). Panic/recover design, `samber/oops` for production errors, and `slog` structured logging integration for APM tools.

## Parallelizing Error Handling Audits

When auditing error handling across a large codebase, use up to 5 parallel sub-agents — each targets an independent error category:

- Sub-agent 1: Error creation — validate `errors.New`/`fmt.Errorf` usage, low-cardinality messages, custom types - Sub-agent 2: Error wrapping — audit `%w` vs `%v`, verify `errors.Is`/`errors.As` patterns - Sub-agent 3: Single handling rule — find log-and-return violations, swallowed errors, discarded errors (`_`) - Sub-agent 4: Panic/recover — audit `panic` usage, verify recovery at goroutine boundaries - Sub-agent 5: Structured logging — verify `slog` usage at error sites, check for PII in error messages

## Cross-References

- → See `samber/cc-skills-golang@golang-samber-oops` for full samber/oops API, builder patterns, and logger integration - → See `samber/cc-skills-golang@golang-observability` for structured logging setup, log levels, and request logging middleware - → See `samber/cc-skills-golang@golang-safety` for nil interface trap and nil error comparison pitfalls - → See `samber/cc-skills-golang@golang-naming` for error naming conventions (ErrNotFound, PathError) - → See `samber/cc-skills-golang@golang-continuous-integration` skill for automated AI-driven code review in CI using these guidelines

## References

- [lmittmann/tint](https://github.com/lmittmann/tint) - [samber/oops](https://github.com/samber/oops) - [samber/slog-multi](https://github.com/samber/slog-multi) - [samber/slog-sampling](https://github.com/samber/slog-sampling) - [samber/slog-formatter](https://github.com/samber/slog-formatter) - [samber/slog-http](https://github.com/samber/slog-http) - [samber/slog-sentry](https://github.com/samber/slog-sentry) - [log/slog package](https://pkg.go.dev/log/slog)

Detail teknis

Versi
1.0.0
Lisensi
MIT
Pembaruan terakhir
21 Agu 2026
Diterbitkan
21 Agu 2026

Ringkasan keputusan

Pilihan utama

95
Siap
Adopsi
Tahap

3,022 star GitHub

Audit

Tinjauan pemasangan

Tinjauan pemasangan dan adopsi

85
Aman untuk dicoba
Keamanan
83/100
Pemeliharaan
100/100
Pasang
92/100
Buka audit lengkapLihat laporan evaluasi

Bukti tervalidasi Agent

Bukti tervalidasi Agent

Laporan hasil setelah resolve, tinjau, pasang, dan satu eksekusi terbatas.

0
Terbukti
Needs first agent runPasang otomatis: tinjau duluTerakhir: Tidak diketahui
Tingkat sukses
Kegagalan terbaru
Hasil
0
Kualitas output
Gagal
0
Tidak relevan
0
Pemasangan
0
Diblokir risiko
0
Perlu penyiapan
0
Produksi
0

Belum ada data hasil Agent. Eksekusi pertama dapat melaporkan keberhasilan, kebutuhan setup, blok risiko, kegagalan, atau tidak relevan melalui /api/agent/outcome.

Pasang

Tambahkan ke alur Agent

Gratis dan sumber terbuka. Tinjau laporan sebelum memasang pada Agent produksi.

Siklus pertumbuhan

Kit berbagi

X

Draf berbasis skenario untuk golang-error-handling, siap untuk posting manual di X.

Catatan kurator
golang-error-handling: Idiomatic Golang error handling — creation, wrapping with %w, errors.Is/As, errors.Join, cust...

3.0K stars

https://www.openagentskill.com/skills/samber-golang-error-handling?ref=x
Buka draf X
Balasan opsional dengan perintah pemasangan
Listing + install path for golang-error-handling:
https://www.openagentskill.com/skills/samber-golang-error-handling?ref=x

Install: npx skills add samber/cc-skills-golang --skill golang-error-handling
Buka draf balasan

Sumber listing

Diindeks Registry

Dapat diklaim

Listing ini diindeks dari sumber publik dan belum ditandai resmi hingga klaim pemelihara disetujui.

Kreator
samber
Diindeks oleh
Indeks komunitas OpenAgentSkill

Atribusi menautkan ke repositori publik atau profil kreator. Kreator dapat mengklaim listing untuk memperbarui sinyal kepemilikan.

Klaim skill ini

Klaim pemilik

Klaim listing skill ini

Listing Diindeks Registry ini dikaitkan dengan samber, tetapi belum ditandai resmi. Klaim untuk menambahkan sinyal pemilik terverifikasi dan membuat pembaruan peluncuran, pemasangan, serta audit berikutnya lebih tepercaya.

Kit backlink kreator

Tambahkan badge bukti ke README Anda

Tampilkan listing kanonis, sinyal kepercayaan dan audit saat ini, serta bukti Agent-Proven nyata di tempat pengembang mengevaluasi repositori.

[![Listed on OpenAgentSkill](https://www.openagentskill.com/api/badge/samber-golang-error-handling?metric=listed&label=Listed)](https://www.openagentskill.com/skills/samber-golang-error-handling)
[![OpenAgentSkill Trust](https://www.openagentskill.com/api/badge/samber-golang-error-handling?metric=trust&label=Trust)](https://www.openagentskill.com/skills/samber-golang-error-handling)
[![OpenAgentSkill Audit](https://www.openagentskill.com/api/badge/samber-golang-error-handling?metric=audit&label=Audit)](https://www.openagentskill.com/skills/samber-golang-error-handling/audit)
[![Agent Proven](https://www.openagentskill.com/api/badge/samber-golang-error-handling?metric=proven&label=Agent%20Proven)](https://www.openagentskill.com/skills/samber-golang-error-handling)

Penulis

S

samber

@samber

Kecocokan platform

Sinyal kesehatan

Star GitHub
3.0K
Skor kualitas
48/100
Push GitHub terakhir
21 Agu 2026
Petunjuk framework
Tidak diketahui
Tampilan OpenAgentSkill
6
Salinan pemasangan
0
Klik keluar
0

Sinyal komunitas

Bagikan apakah skill ini bermanfaat untuk alur kerja Agent Anda. Masukan gabungan meningkatkan peringkat dari waktu ke waktu.

Kepercayaan & keamanan

Hanya sandbox

73
  • Adopsi GitHub3.0K star GitHubLulus
  • Aktivitas star/fork3.0K star dan 197 fork; aktivitas issue tidak tersedia dalam metadata saat iniInfo
  • Pemeliharaan terbaru1 hari sejak pushLulus
  • Kejelasan lisensiMITLulus
  • Kelengkapan README/SKILL.mdMetadata memuat konteks penggunaan dan alur kerja yang cukupLulus
  • Risiko dependensi/runtimecommand execution surface, network or browser surfaceInfo