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 de l’actif
Agents de code et de développement
Code review, repo analysis, testing, CI, GitHub, DevOps, and developer workflow skills.
Scénario
Agents de code
I need a coding agent that can understand a repository, edit code, and review pull requests.
Adéquation Agent
Claude Code + OpenAI Agents + CLI
Compatible avec Codex, Claude Code, Cursor, CLI ou des Agents personnalisés.
Installer
Prêt
npx skills add samber/cc-skills-golang --skill golang-error-handling
Maintenance
À jour
1 jours depuis le dernier push
Risque
Sûr à essayer
Quality score needs review
Qualité GitHub
3.0K
82/100 Qualité · 81/100 Confiance
Tags de couverture
Notes de revue
Quality score needs review
Carte d’adoption Agent
Confiance, audit et préparation à l’installation en un coup d’œil
Ces scores combinent les métadonnées publiques du dépôt, les signaux de revue OpenAgentSkill, la fraîcheur de maintenance et la préparation à l’installation. Ils servent à présélectionner et ne remplacent pas la revue humaine.
Qualité
SolideSolid option that is likely worth shortlisting for production workflows.
Confiance
Sandbox uniquementCandidate utile avec des signaux de confiance incomplets ou mixtes. Gardez-la dans un espace isolé jusqu’à ce que la boucle de résultats confirme son adéquation.
Audit
Sûr à essayerRevue lisible par machine de la préparation à l’installation, des métadonnées de sécurité, de la maintenance et du risque d’adoption.
Trust Score OpenAgentSkill v5
Revue humaine avant installation
Exécutez uniquement dans un sandbox et comparez les alternatives proches avant usage réel.
Stars
3.0K stars GitHub
Activité du dépôt
3.0K stars et 197 forks
Maintenance
1 jours depuis le dernier push
Licence
MIT
Installer
npx skills add samber/cc-skills-golang --skill golang-error-handling
Sécurité d’installation
Chemin d’installation standard de package ou runtime
Surface de permissions
shell or command execution, network or browser access
Résultats Agent
Pas encore de données de résultats Agent
Documentation
Contexte README/SKILL.md solide
Résumé des risques
Revoir avant production
- Quality score needs review
Préparation à l’installation
Chemin d’installation disponible
- Le chemin d’installation est disponible
- La preuve du dépôt est disponible
- La licence est déclarée
- Pas encore de preuve de résultat Agent-Proven
Métadonnées lisibles par Agent
Données de décision lisibles par machine pour ce skill.
Utilisez ce bloc ou le JSON intégré pour décider si un Agent doit installer ce skill, choisir une alternative ou demander d’abord une revue humaine.
Tâches adaptées
- workflows Agents de code
- Équipes Claude Code
- Équipes qui valorisent les signaux d’adoption GitHub
- Inspect source files
Agents adaptés
Décision d’installation
- Commande
- npx skills add samber/cc-skills-golang --skill golang-error-handling
- Politique
- Revoir
- Revue humaine
- Oui
Confiance et risque
- Confiance
- 73/100
- Audit
- 85/100
- Niveau de risque
- Sûr à essayer
Boucle de résultat
- Endpoint
- /api/agent/outcome
- ID d’événement
- resolve
- Résultats
- 5
Commande d’installation
npx skills add samber/cc-skills-golang --skill golang-error-handlingNe pas utiliser quand
- Équipes qui nécessitent un SLA soutenu par le fournisseur
- Environnements fortement conformes sans revue interne de sécurité
- No major risk signals from current metadata
- Indices de permissions à haut risque : exécution shell ou de commande
- Quality score needs review
Skill alternatif
Last30days Skill
53.5K Stars
npx skills add mvanhorn/last30days-skill -g
Skill alternatif
Academic Research Skills
38.4K Stars
npx skills add Imbad0202/academic-research-skills
Skill alternatif
GPT Researcher
28.0K Stars
npx skills add assafelovic/gpt-researcher
Skill alternatif
DeepResearch
19.8K Stars
npx skills add Alibaba-NLP/DeepResearch
Sécurité Agent v2
61/100 · Revoir avant installation
Candidat utilisable, mais l’Agent doit afficher les notes de permissions et d’audit avant l’installation.
Une approbation humaine est requise avant l’installation dans un espace de travail réel.
Élevé
Exécution shell ou de commande
Les métadonnées de la skill font référence à des workflows de terminal, CLI, shell, sous-processus ou exécution de commande.
Moyen
Accès réseau
La skill récupère probablement des pages distantes, API, dépôts ou services externes.
- Indices de permissions à haut risque : exécution shell ou de commande
- Quality score needs review
Cibles d’installation
Installer ce skill dans votre workflow Agent
Utilisez le point de terminaison public pour récupérer la commande, la checklist, les prompts et les liens canoniques.
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-handlingPlan de résolution Agent
Laissez un Agent vérifier la pertinence avant l’installation.
L’API Resolve renvoie la skill sélectionnée, des alternatives, la politique de sécurité, les notes d’audit, la cible d’installation et un prompt prêt à l’emploi.
Ouvrir JSON
/api/agent/resolve?task=Use%20golang-error-handling%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Texte Resolve
/api/agent/resolve?task=Use%20golang-error-handling%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
Relais d’installation
/api/skills/samber-golang-error-handling/install
L’Agent doit vérifier
- 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.
Copier le 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.Relais Agent
Donnez à l’Agent le chemin d’installation, pas un autre annuaire.
Utilisez le point de terminaison public pour récupérer la commande, la checklist, les prompts et les liens canoniques.
Relais d’installation
/api/skills/samber-golang-error-handling/install
Format texte LLM
/api/skills/samber-golang-error-handling/install?format=text
Trouver des alternatives
/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-handlingMétadonnées Registry
Profil lisible par Agent pour la sélection automatique de skills.
L’API Registry fournit les signaux de décision, confiance, audit, cas d’usage et installation sans analyser l’interface.
Manifest
/api/registry/manifest/samber-golang-error-handling
Texte LLM
/api/registry/manifest/samber-golang-error-handling?format=text
Alias d’installation
/api/registry/install/samber-golang-error-handling
Recommander
/api/registry/recommend?task=Use%20golang-error-handling%20in%20an%20agent%20workflow&limit=3
Adéquation Agent
Agents de code
Tags de cas d’usage
Plateformes
Claude Code, OpenAI Agents
Rapport d’audit
Sûr à essayer · 85/100
Revue lisible par machine de la préparation à l’installation, des métadonnées de sécurité, de la maintenance et du risque d’adoption.
Panneau de décision Agent
Choix principal pour Agents de code
Use this as a leading candidate, then validate the README and install path in your own agent stack.
Rôle dans la pile
Choix principal
Pertinence principale
Agents de code
Libellé de confiance
Prêt pour la production
Chemin d’installation
Commande prête
À utiliser lorsque
- workflows Agents de code
- Équipes Claude Code
- Équipes qui valorisent les signaux d’adoption GitHub
Preuves
- 3,022 stars GitHub
- recent repository activity
- install command or GitHub repo available
- profil qualité 82/100
- 6 événements OpenAgentSkill
revoir d’abord
- No major risk signals from current metadata
Chemin d’implémentation
- 1Installez-le dans un Agent en sandbox et exécutez une tâche de Agents de code de bout en bout.
- 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 de confiance
Sandbox uniquement
Candidate utile avec des signaux de confiance incomplets ou mixtes. Gardez-la dans un espace isolé jusqu’à ce que la boucle de résultats confirme son adéquation.
Adoption GitHub
Validé3.0K stars GitHub
Activité stars/forks
Info3.0K stars et 197 forks; l’activité des issues n’est pas disponible dans les métadonnées actuelles
Maintenance récente
Validé1 jours depuis le dernier push
Clarté de licence
ValidéMIT
Signaux positifs
- Revue IA approuvée
- Le chemin d’installation est disponible
- La preuve du dépôt est disponible
- Dépôt maintenu récemment
- Signal d’adoption GitHub significatif
- La commande d’installation ne présente aucun motif de haut risque évident
- La boucle de résultats est prête mais nécessite la première exécution réelle de l’Agent
Réviser avant installation
- Quality score needs review
- Pas encore de rapports de résultats Agent réels
- Une revue humaine est requise avant une installation sans surveillance
Action recommandée
Exécutez uniquement dans un sandbox et comparez les alternatives proches avant usage réel.
Profil qualité
Solide candidat pour les workflows Agent
Solid option that is likely worth shortlisting for production workflows.
Adéquation au workflow
Utilisez cette skill dans ces scénarios
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.
Adéquation au workflow
Ajouter à un workflow complet
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.
Liste d’alternatives
Comparer avant installation
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
Vue d’ensemble
--- 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)
Détails techniques
- Version
- 1.0.0
- Licence
- MIT
- Dernière mise à jour
- 21 août 2026
- Publié
- 21 août 2026
Instantané de décision
Choix principal
3,022 stars GitHub
Audit
Revue d’installation
Revue d’installation et d’adoption
- Sécurité
- 83/100
- Maintenance
- 100/100
- Installer
- 92/100
Preuves validées par Agent
Preuves validées par Agent
Rapports après resolve, revue, installation et une exécution limitée.
- Taux de réussite
- —
- Échec récent
- —
- Résultats
- 0
- Qualité de sortie
- —
- Échecs
- 0
- Non pertinent
- 0
- Installations
- 0
- Bloqué par le risque
- 0
- Configuration requise
- 0
- Production
- 0
Aucune donnée de résultat Agent pour l’instant. La première exécution peut signaler succès, besoin de configuration, blocage de risque, échec ou non-pertinence via /api/agent/outcome.
Installer
Ajouter au workflow Agent
Gratuit et open source. Examinez le rapport avant l’installation dans des Agents de production.
Boucle de croissance
Kit de partage
Brouillon guidé par scénario pour golang-error-handling, prêt pour une publication manuelle sur 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
Réponse facultative avec commande d’installation
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
Source de la fiche
Indexé par Registry
Cette fiche a été indexée à partir de sources publiques et n’est pas marquée officielle tant qu’une revendication de mainteneur n’est pas approuvée.
- Créateur
- samber
- Source
- samber/cc-skills-golang
- Indexé par
- Index communautaire OpenAgentSkill
L’attribution renvoie au dépôt public ou au profil du créateur. Les créateurs peuvent revendiquer la fiche pour mettre à jour les signaux de propriété.
Revendiquer ce skillRevendication du propriétaire
Revendiquer cette fiche de skill
Cette fiche Indexé par Registry est attribuée à samber, mais n’est pas encore marquée officielle. Revendiquez-la pour ajouter un signal de propriétaire vérifié et rendre les futures mises à jour de lancement, d’installation et d’audit plus fiables.
Kit de backlinks créateur
Ajoutez les badges de preuve à votre README
Affichez la fiche canonique, les signaux actuels de confiance et d’audit, ainsi que de vraies preuves Agent-Proven là où les développeurs évaluent le dépôt.
[](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)Auteur
samber
@samber
Tags
Adéquation plateforme
Signaux de santé
- Stars GitHub
- 3.0K
- Score de qualité
- 48/100
- Dernier push GitHub
- 21 août 2026
- Indications de framework
- Inconnu
- Vues OpenAgentSkill
- 6
- Copies d’installation
- 0
- Clics sortants
- 0
Signal de communauté
Indiquez si ce skill semble utile à votre workflow Agent. Les retours agrégés améliorent le classement au fil du temps.
Confiance et sécurité
Sandbox uniquement
- Adoption GitHub3.0K stars GitHubValidé
- Activité stars/forks3.0K stars et 197 forks; l’activité des issues n’est pas disponible dans les métadonnées actuellesInfo
- Maintenance récente1 jours depuis le dernier pushValidé
- Clarté de licenceMITValidé
- Complétude README/SKILL.mdLes métadonnées incluent suffisamment de contexte d’usage et de workflowValidé
- Risque dépendances/runtimecommand execution surface, network or browser surfaceInfo
Skills associés
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 StarsAcademic Research Skills
Academic Research Skills for Claude Code: research → write → review → revise → finalize
38.4K StarsGPT Researcher
Run autonomous deep research over web and local sources
28.0K StarsDeepResearch
Tongyi Deep Research, the Leading Open-source Deep Research Agent
19.8K Stars