golang-error-handling
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
Profil aset
Agent pemrograman dan pengembangan
Code review, repo analysis, testing, CI, GitHub, DevOps, and developer workflow skills.
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
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
KuatSolid option that is likely worth shortlisting for production workflows.
Kepercayaan
Hanya sandboxKandidat berguna dengan sinyal kepercayaan yang kurang atau bercampur. Gunakan di ruang kerja terisolasi hingga loop hasil membuktikan kecocokan tugas.
Audit
Aman untuk dicobaTinjauan 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.
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.
Tugas yang sesuai
- alur kerja Agent pemrograman
- Tim Claude Code
- Tim yang menghargai sinyal adopsi GitHub
- Inspect source files
Agent yang sesuai
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-handlingJangan 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
Skill alternatif
Last30days Skill
53.5K Star
npx skills add mvanhorn/last30days-skill -g
Skill alternatif
Academic Research Skills
38.4K Star
npx skills add Imbad0202/academic-research-skills
Skill alternatif
GPT Researcher
28.0K Star
npx skills add assafelovic/gpt-researcher
Skill alternatif
DeepResearch
19.8K Star
npx skills add Alibaba-NLP/DeepResearch
Keamanan Agent v2
61/100 · Tinjau sebelum memasang
Kandidat yang dapat digunakan, tetapi Agent harus menampilkan catatan izin dan audit sebelum memasang.
Memerlukan persetujuan manusia sebelum memasang ke workspace nyata.
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.
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-handlingRencana 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 JSON
/api/agent/resolve?task=Use%20golang-error-handling%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Teks Resolve
/api/agent/resolve?task=Use%20golang-error-handling%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
Serah-terima pemasangan
/api/skills/samber-golang-error-handling/install
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.
Serah-terima pemasangan
/api/skills/samber-golang-error-handling/install
Format teks LLM
/api/skills/samber-golang-error-handling/install?format=text
Cari alternatif
/api/skills/search?q=golang-error-handling&limit=3
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-handlingMetadata Registry
Profil yang dapat dibaca Agent untuk pemilihan skill otomatis.
API Registry menyediakan sinyal keputusan, kepercayaan, audit, use case, dan pemasangan tanpa mengikis UI.
Manifest
/api/registry/manifest/samber-golang-error-handling
Teks LLM
/api/registry/manifest/samber-golang-error-handling?format=text
Alias pemasangan
/api/registry/install/samber-golang-error-handling
Rekomendasikan
/api/registry/recommend?task=Use%20golang-error-handling%20in%20an%20agent%20workflow&limit=3
Kecocokan Agent
Agent pemrograman
Tag use case
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.
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.
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
- 1Pasang di Agent sandbox dan jalankan satu tugas Agent pemrograman dari awal hingga akhir.
- 2Compare output quality, latency, and failure behavior against at least one alternative.
- 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.
Adopsi GitHub
Lulus3.0K star GitHub
Aktivitas star/fork
Info3.0K star dan 197 fork; aktivitas issue tidak tersedia dalam metadata saat ini
Pemeliharaan terbaru
Lulus1 hari sejak push
Kejelasan lisensi
LulusMIT
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.
Kecocokan alur kerja
Gunakan skill ini pada skenario berikut
Build and ship code
Coding agents
I need a coding agent that can understand a repository, edit code, and review pull requests.
Manage repositories
GitHub automation
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
Investigate faster
Research agents
I need my agent to research a topic, compare sources, and produce a concise report.
Kecocokan alur kerja
Tambahkan ke alur kerja lengkap
Inspect, patch, and verify code
Coding review agent
A workflow for software agents that inspect repositories, review pull requests, generate tests, and turn findings into shippable patches.
Find, compare, and synthesize
Research report agent
A workflow for agents that gather sources, compare claims, summarize long material, and draft useful research briefs.
Operate and verify web apps
Browser QA agent
A workflow for agents that navigate products, fill forms, take screenshots, and verify real user flows across web applications.
Daftar alternatif
Bandingkan sebelum memasang
Similar skills that may fit this task.
Last30days Skill
Research the last 30 days across Reddit, X, YouTube, Hacker News, Polymarket, GitHub, and the web, then synthesize a grounded brief for an AI agent.
Academic Research Skills
Academic Research Skills for Claude Code: research → write → review → revise → finalize
GPT Researcher
Run autonomous deep research over web and local sources
DeepResearch
Tongyi Deep Research, the Leading Open-source Deep Research Agent
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
3,022 star GitHub
Audit
Tinjauan pemasangan
Tinjauan pemasangan dan adopsi
- Keamanan
- 83/100
- Pemeliharaan
- 100/100
- Pasang
- 92/100
Bukti tervalidasi Agent
Bukti tervalidasi Agent
Laporan hasil setelah resolve, tinjau, pasang, dan satu eksekusi terbatas.
- 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
Draf berbasis skenario untuk golang-error-handling, siap untuk posting manual di X.
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
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
Sumber listing
Diindeks Registry
Listing ini diindeks dari sumber publik dan belum ditandai resmi hingga klaim pemelihara disetujui.
- Kreator
- samber
- Sumber
- samber/cc-skills-golang
- Diindeks oleh
- Indeks komunitas OpenAgentSkill
Atribusi menautkan ke repositori publik atau profil kreator. Kreator dapat mengklaim listing untuk memperbarui sinyal kepemilikan.
Klaim skill iniKlaim 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.
[](https://www.openagentskill.com/skills/samber-golang-error-handling)
[](https://www.openagentskill.com/skills/samber-golang-error-handling)
[](https://www.openagentskill.com/skills/samber-golang-error-handling/audit)
[](https://www.openagentskill.com/skills/samber-golang-error-handling)Penulis
samber
@samber
Tag
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
- 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
Skill terkait
Last30days Skill
Research the last 30 days across Reddit, X, YouTube, Hacker News, Polymarket, GitHub, and the web, then synthesize a grounded brief for an AI agent.
53.5K StarAcademic Research Skills
Academic Research Skills for Claude Code: research → write → review → revise → finalize
38.4K StarGPT Researcher
Run autonomous deep research over web and local sources
28.0K StarDeepResearch
Tongyi Deep Research, the Leading Open-source Deep Research Agent
19.8K Star