[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EAH2P129XZPXJWFHQYEMQK":3,"skill-same:01M6EAH2P129XZPXJWFHQYEMQK":96},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":55,"commitSha":56,"skillDirectory":57,"forksCount":58,"repositoryHtmlUrl":59,"repositoryHomepageUrl":60,"ownerHtmlUrl":61,"ownerBlogUrl":6,"ownerDescription":62,"updatedAt":63,"install":64,"resources":77},"01M6EAH2P129XZPXJWFHQYEMQK","golang-error-handling",null,"Idiomatic Golang error handling — creation, wrapping with %w, errors.Is\u002FAs, errors.Join, custom error types, sentinel errors, panic\u002Frecover, the single handling rule, structured logging with slog, HTTP request logging middleware, and samber\u002Foops 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.","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FHarmeet10000\u002Fskills\u002Fgolang-error-handling\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"error","error handling","golang","golang error handling","write","join","false","creation","http request","cc","log","edit","go","read","projects","Bash","logs","git","code","ai coding agents","2026-11-10 10:12:30",false,"---\nname: golang-error-handling\ndescription: \"Idiomatic Golang error handling — creation, wrapping with %w, errors.Is\u002FAs, errors.Join, custom error types, sentinel errors, panic\u002Frecover, the single handling rule, structured logging with slog, HTTP request logging middleware, and samber\u002Foops 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.\"\nuser-invocable: false\nlicense: MIT\ncompatibility: Designed for Claude Code or similar AI coding agents, and for projects using Golang.\nmetadata:\n  author: samber\n  version: \"1.1.1\"\n  openclaw:\n    emoji: \"⚠️\"\n    homepage: https:\u002F\u002Fgithub.com\u002Fsamber\u002Fcc-skills-golang\n    requires:\n      bins:\n        - go\n    install: []\nallowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent\n---\n\n**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.\n\n**Modes:**\n\n- **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.\n- **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.\n- **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\u002Frecover, structured logging).\n\n> **Community default.** A company skill that explicitly supersedes `samber\u002Fcc-skills-golang@golang-error-handling` skill takes precedence.\n\n# Go Error Handling Best Practices\n\nThis skill guides the creation of robust, idiomatic error handling in Go applications. Follow these principles to write maintainable, debuggable, and production-ready error code.\n\n## Best Practices Summary\n\n1. **Returned errors MUST always be checked** — NEVER discard with `_`\n2. **Errors MUST be wrapped with context** using `fmt.Errorf(\"{context}: %w\", err)`\n3. **Error strings MUST be lowercase**, without trailing punctuation\n4. **Use `%w` internally, `%v` at system boundaries** to control error chain exposure\n5. **MUST use `errors.Is` and `errors.As`** instead of direct comparison or type assertion\n6. **SHOULD use `errors.Join`** (Go 1.20+) to combine independent errors\n7. **Errors MUST be either logged OR returned**, NEVER both (single handling rule)\n8. **Use sentinel errors** for expected conditions, custom types for carrying data\n9. **NEVER use `panic` for expected error conditions** — reserve for truly unrecoverable states\n10. **SHOULD use `slog`** (Go 1.21+) for structured error logging — not `fmt.Println` or `log.Printf`\n11. **Use `samber\u002Foops`** for production errors needing stack traces, user\u002Ftenant context, or structured attributes\n12. **Log HTTP requests** with structured middleware capturing method, path, status, and duration\n13. **Use log levels** to indicate error severity\n14. **Never expose technical errors to users** — translate internal errors to user-friendly messages, log technical details separately\n15. **Keep error messages low-cardinality** — don't interpolate variable data (IDs, paths, line numbers) into error strings; attach them as structured attributes instead (via `slog` at the log site, or via `samber\u002Foops` `.With()` on the error itself) so APM\u002Flog aggregators (Datadog, Loki, Sentry) can group errors properly\n\n## Detailed Reference\n\n- **[Error Creation](.\u002Freferences\u002Ferror-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.\n\n- **[Error Wrapping and Inspection](.\u002Freferences\u002Ferror-wrapping.md)** — Why `fmt.Errorf(\"{context}: %w\", err)` beats `fmt.Errorf(\"{context}: %v\", err)` (chains vs concatenation). How to inspect chains with `errors.Is`\u002F`errors.As` for type-safe error handling, and `errors.Join` for combining independent errors.\n\n- **[Error Handling Patterns and Logging](.\u002Freferences\u002Ferror-handling.md)** — The single handling rule: errors are either logged OR returned, NEVER both (prevents duplicate logs cluttering aggregators). Panic\u002Frecover design, `samber\u002Foops` for production errors, and `slog` structured logging integration for APM tools.\n\n## Parallelizing Error Handling Audits\n\nWhen auditing error handling across a large codebase, use up to 5 parallel sub-agents (via the Agent tool) — each targets an independent error category:\n\n- Sub-agent 1: Error creation — validate `errors.New`\u002F`fmt.Errorf` usage, low-cardinality messages, custom types\n- Sub-agent 2: Error wrapping — audit `%w` vs `%v`, verify `errors.Is`\u002F`errors.As` patterns\n- Sub-agent 3: Single handling rule — find log-and-return violations, swallowed errors, discarded errors (`_`)\n- Sub-agent 4: Panic\u002Frecover — audit `panic` usage, verify recovery at goroutine boundaries\n- Sub-agent 5: Structured logging — verify `slog` usage at error sites, check for PII in error messages\n\n## Cross-References\n\n- → See `samber\u002Fcc-skills-golang@golang-samber-oops` for full samber\u002Foops API, builder patterns, and logger integration\n- → See `samber\u002Fcc-skills-golang@golang-observability` for structured logging setup, log levels, and request logging middleware\n- → See `samber\u002Fcc-skills-golang@golang-safety` for nil interface trap and nil error comparison pitfalls\n- → See `samber\u002Fcc-skills-golang@golang-naming` for error naming conventions (ErrNotFound, PathError)\n\n## References\n\n- [lmittmann\u002Ftint](https:\u002F\u002Fgithub.com\u002Flmittmann\u002Ftint)\n- [samber\u002Foops](https:\u002F\u002Fgithub.com\u002Fsamber\u002Foops)\n- [samber\u002Fslog-multi](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-multi)\n- [samber\u002Fslog-sampling](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-sampling)\n- [samber\u002Fslog-formatter](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-formatter)\n- [samber\u002Fslog-http](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-http)\n- [samber\u002Fslog-sentry](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-sentry)\n- [log\u002Fslog package](https:\u002F\u002Fpkg.go.dev\u002Flog\u002Fslog)\n","**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.\n\n**Modes:**\n\n- **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.\n- **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.\n- **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\u002Frecover, structured logging).\n\n> **Community default.** A company skill that explicitly supersedes `samber\u002Fcc-skills-golang@golang-error-handling` skill takes precedence.\n\n# Go Error Handling Best Practices\n\nThis skill guides the creation of robust, idiomatic error handling in Go applications. Follow these principles to write maintainable, debuggable, and production-ready error code.\n\n## Best Practices Summary\n\n1. **Returned errors MUST always be checked** — NEVER discard with `_`\n2. **Errors MUST be wrapped with context** using `fmt.Errorf(\"{context}: %w\", err)`\n3. **Error strings MUST be lowercase**, without trailing punctuation\n4. **Use `%w` internally, `%v` at system boundaries** to control error chain exposure\n5. **MUST use `errors.Is` and `errors.As`** instead of direct comparison or type assertion\n6. **SHOULD use `errors.Join`** (Go 1.20+) to combine independent errors\n7. **Errors MUST be either logged OR returned**, NEVER both (single handling rule)\n8. **Use sentinel errors** for expected conditions, custom types for carrying data\n9. **NEVER use `panic` for expected error conditions** — reserve for truly unrecoverable states\n10. **SHOULD use `slog`** (Go 1.21+) for structured error logging — not `fmt.Println` or `log.Printf`\n11. **Use `samber\u002Foops`** for production errors needing stack traces, user\u002Ftenant context, or structured attributes\n12. **Log HTTP requests** with structured middleware capturing method, path, status, and duration\n13. **Use log levels** to indicate error severity\n14. **Never expose technical errors to users** — translate internal errors to user-friendly messages, log technical details separately\n15. **Keep error messages low-cardinality** — don't interpolate variable data (IDs, paths, line numbers) into error strings; attach them as structured attributes instead (via `slog` at the log site, or via `samber\u002Foops` `.With()` on the error itself) so APM\u002Flog aggregators (Datadog, Loki, Sentry) can group errors properly\n\n## Detailed Reference\n\n- **[Error Creation](.\u002Freferences\u002Ferror-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.\n\n- **[Error Wrapping and Inspection](.\u002Freferences\u002Ferror-wrapping.md)** — Why `fmt.Errorf(\"{context}: %w\", err)` beats `fmt.Errorf(\"{context}: %v\", err)` (chains vs concatenation). How to inspect chains with `errors.Is`\u002F`errors.As` for type-safe error handling, and `errors.Join` for combining independent errors.\n\n- **[Error Handling Patterns and Logging](.\u002Freferences\u002Ferror-handling.md)** — The single handling rule: errors are either logged OR returned, NEVER both (prevents duplicate logs cluttering aggregators). Panic\u002Frecover design, `samber\u002Foops` for production errors, and `slog` structured logging integration for APM tools.\n\n## Parallelizing Error Handling Audits\n\nWhen auditing error handling across a large codebase, use up to 5 parallel sub-agents (via the Agent tool) — each targets an independent error category:\n\n- Sub-agent 1: Error creation — validate `errors.New`\u002F`fmt.Errorf` usage, low-cardinality messages, custom types\n- Sub-agent 2: Error wrapping — audit `%w` vs `%v`, verify `errors.Is`\u002F`errors.As` patterns\n- Sub-agent 3: Single handling rule — find log-and-return violations, swallowed errors, discarded errors (`_`)\n- Sub-agent 4: Panic\u002Frecover — audit `panic` usage, verify recovery at goroutine boundaries\n- Sub-agent 5: Structured logging — verify `slog` usage at error sites, check for PII in error messages\n\n## Cross-References\n\n- → See `samber\u002Fcc-skills-golang@golang-samber-oops` for full samber\u002Foops API, builder patterns, and logger integration\n- → See `samber\u002Fcc-skills-golang@golang-observability` for structured logging setup, log levels, and request logging middleware\n- → See `samber\u002Fcc-skills-golang@golang-safety` for nil interface trap and nil error comparison pitfalls\n- → See `samber\u002Fcc-skills-golang@golang-naming` for error naming conventions (ErrNotFound, PathError)\n\n## References\n\n- [lmittmann\u002Ftint](https:\u002F\u002Fgithub.com\u002Flmittmann\u002Ftint)\n- [samber\u002Foops](https:\u002F\u002Fgithub.com\u002Fsamber\u002Foops)\n- [samber\u002Fslog-multi](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-multi)\n- [samber\u002Fslog-sampling](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-sampling)\n- [samber\u002Fslog-formatter](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-formatter)\n- [samber\u002Fslog-http](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-http)\n- [samber\u002Fslog-sentry](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fslog-sentry)\n- [log\u002Fslog package](https:\u002F\u002Fpkg.go.dev\u002Flog\u002Fslog)\n",{"name":5,"license":15,"metadata":44,"description":7,"allowed-tools":53,"compatibility":54,"user-invocable":40},{"author":45,"version":46,"openclaw":47},"samber","1.1.1",{"emoji":48,"install":49,"homepage":50,"requires":51},"⚠️",[],"https:\u002F\u002Fgithub.com\u002Fsamber\u002Fcc-skills-golang",{"bins":52},[31],"Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent","Designed for Claude Code or similar AI coding agents, and for projects using Golang.","main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FHarmeet10000\u002Fskills\u002Fgolang-error-handling",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":65,"prompt":75,"zipAvailable":76},[66,69,72],{"tool":67,"command":68},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill golang-error-handling",{"tool":70,"command":71},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill golang-error-handling",{"tool":73,"command":74},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill golang-error-handling","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FHarmeet10000\u002Fskills\u002Fgolang-error-handling\u002FSKILL.md",true,[78,84,88,92],{"path":79,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":82,"sourceHtmlUrl":83},"evals\u002Fevals.json","REFERENCE","参考文档",12963,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FHarmeet10000\u002Fskills\u002Fgolang-error-handling\u002Fevals\u002Fevals.json",{"path":85,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":86,"sourceHtmlUrl":87},"references\u002Ferror-creation.md",4977,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FHarmeet10000\u002Fskills\u002Fgolang-error-handling\u002Freferences\u002Ferror-creation.md",{"path":89,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":90,"sourceHtmlUrl":91},"references\u002Ferror-handling.md",4275,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FHarmeet10000\u002Fskills\u002Fgolang-error-handling\u002Freferences\u002Ferror-handling.md",{"path":93,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":94,"sourceHtmlUrl":95},"references\u002Ferror-wrapping.md",2822,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FHarmeet10000\u002Fskills\u002Fgolang-error-handling\u002Freferences\u002Ferror-wrapping.md",[97,106,115,124,130,136],{"skillNo":98,"name":99,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":39},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[103,104,105],"model","model hierarchy","model hierarchy skill",{"skillNo":107,"name":108,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":39},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[112,113,114],"MCP","zoom","zoom mcp",{"skillNo":116,"name":117,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":39},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[121,122,123,113],"sdk","zoom apps sdk","apps",{"skillNo":125,"name":126,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":127,"categories":128,"keywords":129,"publishedAt":39},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[126],{"skillNo":131,"name":132,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":133,"categories":134,"keywords":135,"publishedAt":39},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[132],{"skillNo":137,"name":138,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":139,"categories":140,"keywords":141,"publishedAt":39},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[138]]