[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79ZXR3GHK664HH1HTAG939A":3,"skill-same:01M79ZXR3GHK664HH1HTAG939A":56},{"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":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":29,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M79ZXR3GHK664HH1HTAG939A","go-logging",null,"Use when choosing a logging approach, configuring slog, writing structured log statements, or deciding log levels in Go. Also use when setting up production logging, adding request-scoped context to logs, or migrating from log to slog, even if the user doesn't explicitly mention logging. Does not cover error handling strategy (see go-error-handling).","kongnakornna\u002Fgolangapi","kongnakornna","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F10528904?v=4","01M79Z5JQPPV5CWQHXS235Q9MD","Kongnakorn Jantakun","01M79Z5JRHJJJ6PR2DGQS4P985",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgolang-skills\u002Fskills\u002Fgo-logging\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: go-logging\ndescription: Use when choosing a logging approach, configuring slog, writing structured log statements, or deciding log levels in Go. Also use when setting up production logging, adding request-scoped context to logs, or migrating from log to slog, even if the user doesn't explicitly mention logging. Does not cover error handling strategy (see go-error-handling).\n---\n\n# Go Logging\n\n> Compatibility: `log\u002Fslog` requires Go 1.21+; `testing\u002Fslogtest` requires Go 1.22+.\n\n## Resource Routing\n\n- `references\u002FLEVELS-AND-CONTEXT.md` - Read when choosing log levels, deciding logger-in-context versus explicit parameters, or excluding sensitive fields.\n- `references\u002FLOGGING-PATTERNS.md` - Read when configuring slog handlers, logging HTTP requests, testing handlers, or migrating from `log.Printf`.\n\n## Core Principle\n\nLogs are for **operators**, not developers. Every log line should help someone\ndiagnose a production issue. If it doesn't serve that purpose, it's noise.\n\n---\n\n## Choosing a Logger\n\n> **Normative**: Use `log\u002Fslog` for new Go code.\n\n`slog` is structured, leveled, and in the standard library (Go 1.21+). It\ncovers the vast majority of production logging needs.\n\n```\nWhich logger?\n├─ New production code      → log\u002Fslog\n├─ Trivial CLI \u002F one-off    → log (standard)\n└─ Measured perf bottleneck → zerolog or zap (benchmark first)\n```\n\nDo not introduce a third-party logging library unless profiling shows `slog`\nis a bottleneck in your hot path. When you do, keep the same structured\nkey-value style.\n\n---\n\n## Structured Logging\n\n> **Normative**: Always use key-value pairs. Never interpolate values into the message string.\n\nThe message is a **static description** of what happened. Dynamic data goes in\nkey-value attributes:\n\n```go\n\u002F\u002F Good: static message, structured fields\nslog.Info(\"order placed\", \"order_id\", orderID, \"total\", total)\n\n\u002F\u002F Bad: dynamic data baked into the message string\nslog.Info(fmt.Sprintf(\"order %d placed for $%.2f\", orderID, total))\n```\n\n### Key Naming\n\n> **Advisory**: Use `snake_case` for log attribute keys.\n\nKeys should be lowercase, underscore-separated, and consistent across the\ncodebase: `user_id`, `request_id`, `elapsed_ms`.\n\n### Typed Attributes\n\nFor performance-critical paths, use typed constructors to avoid allocations:\n\n```go\nslog.LogAttrs(ctx, slog.LevelInfo, \"request handled\",\n    slog.String(\"method\", r.Method),\n    slog.Int(\"status\", code),\n    slog.Duration(\"elapsed\", elapsed),\n)\n```\n\n---\n\n## Log Levels\n\n> **Advisory**: Follow these level semantics consistently.\n\n| Level | When to use | Production default |\n|-------|-------------|--------------------|\n| Debug | Developer-only diagnostics, tracing internal state | Disabled |\n| Info  | Notable lifecycle events: startup, shutdown, config loaded | Enabled |\n| Warn  | Unexpected but recoverable: deprecated feature used, retry succeeded | Enabled |\n| Error | Operation failed, requires operator attention | Enabled |\n\n**Rules of thumb**:\n- If nobody should act on it, it's not Error — use Warn or Info\n- If it's only useful with a debugger attached, it's Debug\n- `slog.Error` should always include an `\"err\"` attribute\n\n```go\nslog.Error(\"payment failed\", \"err\", err, \"order_id\", id)\nslog.Warn(\"retry succeeded\", \"attempt\", n, \"endpoint\", url)\nslog.Info(\"server started\", \"addr\", addr)\nslog.Debug(\"cache lookup\", \"key\", key, \"hit\", hit)\n```\n\n---\n\n## Request-Scoped Logging\n\n> **Advisory**: Derive loggers from context to carry request-scoped fields.\n\nUse middleware to enrich a logger with request ID, user ID, or trace ID, then\npass the enriched logger downstream via context or as an explicit parameter.\nKeep the full context-key and middleware implementation in the logging patterns\nreference so request-scoped logging has one owner.\n\n---\n\n## Log or Return, Not Both\n\nThe handle-once rule belongs to [go-error-handling](..\u002Fgo-error-handling\u002FSKILL.md).\nIn logging work, apply it by choosing either a local log-and-recover path or a\nreturn path with context, not both for the same error.\n\n**Exception**: HTTP handlers and other top-of-stack boundaries may log detailed\nerrors server-side while returning a sanitized message to the client:\n\n```go\nif err != nil {\n    slog.Error(\"checkout failed\", \"err\", err, \"user_id\", uid)\n    http.Error(w, \"internal error\", http.StatusInternalServerError)\n    return\n}\n```\n\nSee [go-error-handling](..\u002Fgo-error-handling\u002FSKILL.md) for the full\nhandle-once pattern and error wrapping guidance.\n\n---\n\n## What NOT to Log\n\n> **Normative**: Never log secrets, credentials, PII, or high-cardinality unbounded data.\n\n- Passwords, API keys, tokens, session IDs\n- Full credit card numbers, SSNs\n- Request\u002Fresponse bodies that may contain user data\n- Entire slices or maps of unbounded size\n\n---\n\n## Quick Reference\n\n| Do | Don't |\n|----|-------|\n| `slog.Info(\"msg\", \"key\", val)` | `log.Printf(\"msg %v\", val)` |\n| Static message + structured fields | `fmt.Sprintf` in message |\n| `snake_case` keys | camelCase or inconsistent keys |\n| Log OR return errors | Log AND return the same error |\n| Derive logger from context | Create a new logger per call |\n| Use `slog.Error` with `\"err\"` attr | `slog.Info` for errors |\n| Pre-check `Enabled()` on hot paths | Always allocate log args |\n\n---\n\n## Related Skills\n\n- **Error handling**: See [go-error-handling](..\u002Fgo-error-handling\u002FSKILL.md) when deciding whether to log or return an error, or for the handle-once pattern\n- **Context propagation**: See [go-context](..\u002Fgo-context\u002FSKILL.md) when passing request-scoped values (including loggers) through context\n- **Performance**: See [go-performance](..\u002Fgo-performance\u002FSKILL.md) when optimizing hot-path logging or reducing allocations in log calls\n- **Code review**: See [go-code-review](..\u002Fgo-code-review\u002FSKILL.md) when reviewing logging practices in Go PRs\n","# Go Logging\n\n> Compatibility: `log\u002Fslog` requires Go 1.21+; `testing\u002Fslogtest` requires Go 1.22+.\n\n## Resource Routing\n\n- `references\u002FLEVELS-AND-CONTEXT.md` - Read when choosing log levels, deciding logger-in-context versus explicit parameters, or excluding sensitive fields.\n- `references\u002FLOGGING-PATTERNS.md` - Read when configuring slog handlers, logging HTTP requests, testing handlers, or migrating from `log.Printf`.\n\n## Core Principle\n\nLogs are for **operators**, not developers. Every log line should help someone\ndiagnose a production issue. If it doesn't serve that purpose, it's noise.\n\n---\n\n## Choosing a Logger\n\n> **Normative**: Use `log\u002Fslog` for new Go code.\n\n`slog` is structured, leveled, and in the standard library (Go 1.21+). It\ncovers the vast majority of production logging needs.\n\n```\nWhich logger?\n├─ New production code      → log\u002Fslog\n├─ Trivial CLI \u002F one-off    → log (standard)\n└─ Measured perf bottleneck → zerolog or zap (benchmark first)\n```\n\nDo not introduce a third-party logging library unless profiling shows `slog`\nis a bottleneck in your hot path. When you do, keep the same structured\nkey-value style.\n\n---\n\n## Structured Logging\n\n> **Normative**: Always use key-value pairs. Never interpolate values into the message string.\n\nThe message is a **static description** of what happened. Dynamic data goes in\nkey-value attributes:\n\n```go\n\u002F\u002F Good: static message, structured fields\nslog.Info(\"order placed\", \"order_id\", orderID, \"total\", total)\n\n\u002F\u002F Bad: dynamic data baked into the message string\nslog.Info(fmt.Sprintf(\"order %d placed for $%.2f\", orderID, total))\n```\n\n### Key Naming\n\n> **Advisory**: Use `snake_case` for log attribute keys.\n\nKeys should be lowercase, underscore-separated, and consistent across the\ncodebase: `user_id`, `request_id`, `elapsed_ms`.\n\n### Typed Attributes\n\nFor performance-critical paths, use typed constructors to avoid allocations:\n\n```go\nslog.LogAttrs(ctx, slog.LevelInfo, \"request handled\",\n    slog.String(\"method\", r.Method),\n    slog.Int(\"status\", code),\n    slog.Duration(\"elapsed\", elapsed),\n)\n```\n\n---\n\n## Log Levels\n\n> **Advisory**: Follow these level semantics consistently.\n\n| Level | When to use | Production default |\n|-------|-------------|--------------------|\n| Debug | Developer-only diagnostics, tracing internal state | Disabled |\n| Info  | Notable lifecycle events: startup, shutdown, config loaded | Enabled |\n| Warn  | Unexpected but recoverable: deprecated feature used, retry succeeded | Enabled |\n| Error | Operation failed, requires operator attention | Enabled |\n\n**Rules of thumb**:\n- If nobody should act on it, it's not Error — use Warn or Info\n- If it's only useful with a debugger attached, it's Debug\n- `slog.Error` should always include an `\"err\"` attribute\n\n```go\nslog.Error(\"payment failed\", \"err\", err, \"order_id\", id)\nslog.Warn(\"retry succeeded\", \"attempt\", n, \"endpoint\", url)\nslog.Info(\"server started\", \"addr\", addr)\nslog.Debug(\"cache lookup\", \"key\", key, \"hit\", hit)\n```\n\n---\n\n## Request-Scoped Logging\n\n> **Advisory**: Derive loggers from context to carry request-scoped fields.\n\nUse middleware to enrich a logger with request ID, user ID, or trace ID, then\npass the enriched logger downstream via context or as an explicit parameter.\nKeep the full context-key and middleware implementation in the logging patterns\nreference so request-scoped logging has one owner.\n\n---\n\n## Log or Return, Not Both\n\nThe handle-once rule belongs to [go-error-handling](..\u002Fgo-error-handling\u002FSKILL.md).\nIn logging work, apply it by choosing either a local log-and-recover path or a\nreturn path with context, not both for the same error.\n\n**Exception**: HTTP handlers and other top-of-stack boundaries may log detailed\nerrors server-side while returning a sanitized message to the client:\n\n```go\nif err != nil {\n    slog.Error(\"checkout failed\", \"err\", err, \"user_id\", uid)\n    http.Error(w, \"internal error\", http.StatusInternalServerError)\n    return\n}\n```\n\nSee [go-error-handling](..\u002Fgo-error-handling\u002FSKILL.md) for the full\nhandle-once pattern and error wrapping guidance.\n\n---\n\n## What NOT to Log\n\n> **Normative**: Never log secrets, credentials, PII, or high-cardinality unbounded data.\n\n- Passwords, API keys, tokens, session IDs\n- Full credit card numbers, SSNs\n- Request\u002Fresponse bodies that may contain user data\n- Entire slices or maps of unbounded size\n\n---\n\n## Quick Reference\n\n| Do | Don't |\n|----|-------|\n| `slog.Info(\"msg\", \"key\", val)` | `log.Printf(\"msg %v\", val)` |\n| Static message + structured fields | `fmt.Sprintf` in message |\n| `snake_case` keys | camelCase or inconsistent keys |\n| Log OR return errors | Log AND return the same error |\n| Derive logger from context | Create a new logger per call |\n| Use `slog.Error` with `\"err\"` attr | `slog.Info` for errors |\n| Pre-check `Enabled()` on hot paths | Always allocate log args |\n\n---\n\n## Related Skills\n\n- **Error handling**: See [go-error-handling](..\u002Fgo-error-handling\u002FSKILL.md) when deciding whether to log or return an error, or for the handle-once pattern\n- **Context propagation**: See [go-context](..\u002Fgo-context\u002FSKILL.md) when passing request-scoped values (including loggers) through context\n- **Performance**: See [go-performance](..\u002Fgo-performance\u002FSKILL.md) when optimizing hot-path logging or reducing allocations in log calls\n- **Code review**: See [go-code-review](..\u002Fgo-code-review\u002FSKILL.md) when reviewing logging practices in Go PRs\n",{"name":5,"description":7},"main","19f4d52a98d557f3a645a2cfbbeb5bd54f28831d",".github\u002Fskills\u002Fgolang-skills\u002Fskills\u002Fgo-logging","https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi","https:\u002F\u002Fgithub.com\u002Fkongnakornna","http:\u002F\u002Fcmoniot.trueddns.com:52160","Technical Skills and Expertise\r\nLanguages and Frameworks\r\nFrontend: HTML, JavaScript, TypeScript, React, Vue, Angular, Next.js\r\nBackend: Node.js,Python,Golang","2026-10-06 23:01:46",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add kongnakornna\u002Fgolangapi --skill go-logging",{"tool":38,"command":39},"bunx","bunx skills add kongnakornna\u002Fgolangapi --skill go-logging",{"tool":41,"command":42},"pnpm","pnpm dlx skills add kongnakornna\u002Fgolangapi --skill go-logging","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgolang-skills\u002Fskills\u002Fgo-logging\u002FSKILL.md",true,[46,52],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"references\u002FLEVELS-AND-CONTEXT.md","REFERENCE","参考文档",7424,"https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgolang-skills\u002Fskills\u002Fgo-logging\u002Freferences\u002FLEVELS-AND-CONTEXT.md",{"path":53,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002FLOGGING-PATTERNS.md",7051,"https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgolang-skills\u002Fskills\u002Fgo-logging\u002Freferences\u002FLOGGING-PATTERNS.md",[57,64,71,78,85,92],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M7A0M9RJJ3383VEFYKABWV15","tb-writing-plans","Use when you have a spec or requirements for a multi-step task, before touching code","https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ftb-writing-plans\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M7A0M4JKY4DEDRP1CBHT00WV","tb-using-git-worktrees","Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback","https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ftb-using-git-worktrees\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M7A0KZ5HRAQAAT2KXR6146Q7","tb-test-driven-development","Use when implementing any feature or bugfix, before writing implementation code","https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ftb-test-driven-development\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M7A0KW92W3F18E2MRP8H62P2","tb-subagent-driven-development","Use when executing implementation plans with independent tasks in the current session","https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ftb-subagent-driven-development\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7A0KKYQCHYYRHA5J5BAP24M","tb-scrutinize","Outsider-perspective end-to-end review of a plan, PR, or code change. First questions intent and whether a simpler\u002Fmore elegant approach would achieve the same goal, then traces the actual code path (not just the diff) to verify the change does what it claims. Output is concise, actionable, and every call carries its rationale. Trigger on \u002Ftb-scrutinize and proactively whenever the user asks to review, audit, sanity-check, or get a second opinion on a plan, PR, diff, design doc, or proposed code change.","https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ftb-scrutinize\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M7A0KFDR1V3RW7SW1XNHP82P","tb-requesting-code-review","Use when completing tasks, implementing major features, or before merging to verify work meets requirements","https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ftb-requesting-code-review\u002FSKILL.md",[],[]]