golang-error-handling
Improve Go Error Handling
Go error paths often lose context, duplicate logs, or expose internals. This skill gives Claude, Codex, and Claude Code concrete rules for safer Go errors.
Install with my Agent
Copy this request to your Agent. It includes the canonical Skill page and manifest.
Review the Skillstore skill "golang-error-handling" from https://skillstore.io/skills/samber-golang-error-handling.md and its manifest at https://skillstore.io/api/skills/samber-golang-error-handling/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.Your Agent should still show its plan and request any confirmation required by the security policy.
Agent-readable resources
Use these links when an AI agent, crawler, or script needs clean context instead of reading the full page.
Test it
Using "golang-error-handling". A service function logs a database failure and then returns the same wrapped error.
Expected outcome:
Flags the duplicate handling, recommends returning contextual error once, and moves logging to the boundary.
Using "golang-error-handling". A public gateway wraps backend errors with chain-preserving context.
Expected outcome:
Explains that public boundaries should translate errors and avoid exposing backend types through unwrapping.
Using "golang-error-handling". A validator stops at the first invalid field.
Expected outcome:
Recommends collecting independent validation failures and returning a joined error with stable messages.
Security Audit
SafeAll static findings appear to be false positives from Markdown code spans, JSON evaluation prompts, and illustrative Go examples. I found no prompt injection, data exfiltration intent, unsafe command execution, or automatic network activity in the reviewed files.
Risk Factors
โ๏ธ External commands (24)
Share & cite this report
Share the versioned assessment report, neutral badge, embed card, and citations. Skillstore reports evidence without deciding whether this Skill is safe.
Copy report link
https://skillstore.io/skills/samber-golang-error-handling/audits/3?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown badge
[](https://skillstore.io/skills/samber-golang-error-handling?utm_source=security_passport_badge)HTML badge
<a href="https://skillstore.io/skills/samber-golang-error-handling?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/samber-golang-error-handling/security.svg" alt="Skillstore security assessment" loading="lazy"></a>Embed card
<iframe src="https://skillstore.io/embed/skills/samber-golang-error-handling.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>Academic citations (APA ยท BibTeX ยท CFF)
APA citation
samber. (2026). golang-error-handling security audit report (audit version 3) [Author version 1.2.0]. Skillstore. https://skillstore.io/skills/samber-golang-error-handling/audits/3BibTeX citation
@techreport{samber-samber-golang-error-handling-2026,
author = {samber},
title = {golang-error-handling security audit report (audit version 3)},
institution = {Skillstore},
year = {2026},
number = {3},
url = {https://skillstore.io/skills/samber-golang-error-handling/audits/3},
note = {Author version 1.2.0}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "golang-error-handling security audit report (audit version 3)"
version: "1.2.0"
type: report
authors:
- name: "samber"
date-released: "2026-07-06"
url: "https://skillstore.io/skills/samber-golang-error-handling/audits/3"
identifiers:
- type: other
value: "skillstore:samber-golang-error-handling:audit:3"
description: "Skillstore immutable audit report identifier"
Skillstore Score
Why this score Evidence Confidence: HighWhat You Can Build
Service Developer
Add context-rich returned errors without duplicate logs or high-cardinality messages.
Code Reviewer
Review pull requests for swallowed errors, unsafe panic use, and incorrect wrapped-error inspection.
Platform Maintainer
Standardize structured error logs and public boundary behavior across Go services.
Try These Prompts
Review this Go function for unchecked errors, lowercase messages, and useful wrapping context. Suggest minimal fixes.
Update this Go code to use errors.Is and errors.As correctly. Preserve behavior for wrapped errors and explain each change.
Modernize this Go error path with slog and structured attributes. Follow the single handling rule and avoid high-cardinality messages.
Audit these Go packages for error creation, wrapping, panic recovery, joined errors, and public API boundaries. Return prioritized findings and fixes.
Best Practices
- Use %w inside module boundaries and %v when intentionally hiding internal error types.
- Log or return each error once, with structured attributes for IDs and counts.
- Keep stable messages lowercase and low-cardinality; place variable data in attributes.
Avoid
- Discarding returned errors with blank identifiers or using results before checking errors.
- Logging an error at every layer and returning it again.
- Interpolating user, tenant, path, or row IDs into stable production messages.
Frequently Asked Questions
Does this skill run commands?
Can it fix code automatically?
Does it require samber/oops?
What Go versions does it cover?
How does it treat public API boundaries?
Is it only for new code?
Developer Details
Author
samberLicense
MIT
Author version
v1.2.0
Skillstore revision
r1
Ref
e397ce5a135369cd6def89cb6400d013e2f68f2f
Maintenance freshness
7/18/2026
Usage
2 downloads ยท 2 views
File structure
๐ evals/
๐ evals.json
๐ references/
๐ error-creation.md
๐ error-handling.md
๐ error-wrapping.md
๐ SKILL.md