[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79ZA1AS3JH823Z6M875WS6F":3,"skill-same:01M79ZA1AS3JH823Z6M875WS6F":62},{"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":31,"commitSha":32,"skillDirectory":33,"forksCount":14,"repositoryHtmlUrl":34,"repositoryHomepageUrl":6,"ownerHtmlUrl":35,"ownerBlogUrl":36,"ownerDescription":37,"updatedAt":38,"install":39,"resources":51},"01M79ZA1AS3JH823Z6M875WS6F","go-concurrency-review",null,"Review and implement safe concurrency patterns in Go: goroutines, channels, sync primitives, context propagation, and goroutine lifecycle management. Use when writing concurrent code, reviewing async patterns, checking thread safety, debugging race conditions, or designing producer\u002Fconsumer pipelines. Trigger examples: \"check thread safety\", \"review goroutines\", \"race condition\", \"channel patterns\", \"sync.Mutex\", \"context cancellation\", \"goroutine leak\". Not for: general style (go-coding-standards), HTTP handler patterns (go-api-design).","kongnakornna\u002Fgolangapi","kongnakornna","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F10528904?v=4","01M79Z5JQPPV5CWQHXS235Q9MD","Kongnakorn Jantakun","01M79Z5JRHJJJ6PR2DGQS4P985",0,"MIT","https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgo-agent-skills\u002Fskills\u002F(safety)\u002Fgo-concurrency-review\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: go-concurrency-review\ndescription: >\n  Review and implement safe concurrency patterns in Go: goroutines,\n  channels, sync primitives, context propagation, and goroutine lifecycle\n  management. Use when writing concurrent code, reviewing async patterns,\n  checking thread safety, debugging race conditions, or designing\n  producer\u002Fconsumer pipelines. Trigger examples: \"check thread safety\",\n  \"review goroutines\", \"race condition\", \"channel patterns\", \"sync.Mutex\",\n  \"context cancellation\", \"goroutine leak\".\n  Not for: general style (go-coding-standards), HTTP handler patterns\n  (go-api-design).\nuser-invocable: true\nlicense: MIT\ncompatibility: Designed for Claude Code or similar AI coding agents working on Go projects. Requires the Go toolchain. Race detection requires cgo (CGO_ENABLED=1).\nallowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(gofmt:*)\nmetadata:\n  author: eduardo-sl\n  version: \"1.3.0\"\n---\n\n# Go Concurrency Review\n\nConcurrency in Go is powerful and deceptively easy to get wrong.\nThese patterns prevent goroutine leaks, data races, and deadlocks.\n\nDetailed reference material, loaded on demand:\n\n- `references\u002Fchannels.md` — sizing, signalling, producer shutdown.\n- `references\u002Fmutex-and-atomics.md` — mutex placement, lock scope, atomics,\n  `sync.Once`.\n\nRead a reference file only when the section below is not enough.\n\n## Operating Modes\n\nPick the mode that matches the request before starting:\n\n- **Implementation** — writing new concurrent code. Follow the patterns\n  below as construction rules.\n- **Diff review** (default) — check changed code against every section,\n  paying extra attention to new `go` statements and shared state.\n- **Leak\u002Frace hunt** — a symptom is already observed (growing goroutine\n  count, `-race` report, deadlock). Start from \"Auditing Large Codebases\"\n  and the Race Detection section to localize it.\n\n## Auditing Large Codebases\n\nFor a full concurrency audit, run these independent passes rather than\none linear read:\n\n1. **Goroutine lifecycle:** find every `go` statement\n   (`grep -rn \"go func\\|go [a-zA-Z]\" --include=\"*.go\"`) and verify each\n   has a termination path (context, closed channel, WaitGroup).\n2. **Shared state:** find package-level vars and struct fields accessed\n   from multiple goroutines; verify mutex\u002Fatomic protection.\n3. **Channel topology:** map producers\u002Fconsumers per channel; verify\n   close-exactly-once and no send-on-closed paths.\n4. **Context propagation:** verify blocking calls accept and respect\n   `context.Context`.\n\nIf your environment supports delegating work to parallel sub-agents or\ntasks, assign each pass to one; otherwise run them in order. Findings\nmust cite `file.go:line`. Always finish with `go test -race .\u002F...`.\n\n## 1. Goroutine Lifecycle Management\n\nEVERY goroutine MUST have a clear termination path. No fire-and-forget.\n\n### Use `errgroup` for coordinated goroutines:\n\n```go\ng, ctx := errgroup.WithContext(ctx)\n\ng.Go(func() error {\n    return fetchUsers(ctx)\n})\n\ng.Go(func() error {\n    return fetchOrders(ctx)\n})\n\nif err := g.Wait(); err != nil {\n    return fmt.Errorf(\"fetch data: %w\", err)\n}\n```\n\n### Long-running goroutines must respect context:\n\n```go\nfunc (w *Worker) Run(ctx context.Context) error {\n    for {\n        select {\n        case \u003C-ctx.Done():\n            return ctx.Err()\n        case job := \u003C-w.jobs:\n            if err := w.process(job); err != nil {\n                w.logger.Error(\"process job\", slog.Any(\"error\", err))\n            }\n        }\n    }\n}\n```\n\n### Start goroutines in the owner, not the callee:\n\n```go\n\u002F\u002F ✅ Good — caller controls lifecycle\ngo worker.Run(ctx)\n\n\u002F\u002F ❌ Bad — function secretly starts goroutine\nfunc NewWorker() *Worker {\n    w := &Worker{}\n    go w.run() \u002F\u002F hidden goroutine — caller has no control\n    return w\n}\n```\n\n## 2. Channel Patterns\n\n- Size is one or none. Unbuffered is a synchronization point; buffer 1 is a\n  handoff. Any larger buffer needs a comment justifying the number — an\n  arbitrary `100` is a bug waiting for the day production is slower than\n  staging.\n- Signal channels carry `struct{}`, and `close(done)` broadcasts to every\n  receiver at once.\n- The producer owns the channel and is the only one that closes it, with\n  `defer close(ch)` in the producing goroutine. Every send sits in a `select`\n  against `ctx.Done()`, or a consumer that walks away leaks the producer.\n\nExamples in `references\u002Fchannels.md`.\n\n## 3. Mutexes and Atomics\n\n- Zero-value `sync.Mutex` and `sync.RWMutex` are ready to use. A\n  `*sync.Mutex` field is always wrong.\n- Declare the mutex directly above the fields it guards, with a comment\n  naming the relationship. A mutex that guards \"the struct\" guards nothing in\n  particular.\n- Keep the critical section minimal — never call out to an external service,\n  or take a second lock, while holding one.\n- 🔴 Never copy a value containing a mutex (`c2 := *c1`): the copy carries the\n  original's lock state. `go vet` catches most of these; trust it.\n- Use `sync\u002Fatomic` types for counters and flags rather than a mutex around\n  an `int64`.\n- `sync.Once` for lazy initialization that must happen exactly once.\n\nExamples in `references\u002Fmutex-and-atomics.md`.\n\n## 4. Context Propagation\n\nContext is always the first parameter, never a struct field, and every\nblocking operation selects on `ctx.Done()`:\n\n```go\n\u002F\u002F ✅ Good\nselect {\ncase result := \u003C-ch:\n    return result, nil\ncase \u003C-ctx.Done():\n    return nil, ctx.Err()\n}\n\n\u002F\u002F ❌ Bad — blocks forever if the context is cancelled\nresult := \u003C-ch\n```\n\nDerive a child context with its own timeout for each external call and\n`defer cancel()` immediately. Full rules in the `go-context` skill.\n\n## 5. Avoid Mutable Globals\n\n```go\n\u002F\u002F ❌ Bad — mutable global, not safe for concurrent access\nvar db *sql.DB\n\n\u002F\u002F ✅ Good — pass as dependency\ntype Server struct {\n    db *sql.DB\n}\n```\n\n## Race Detection\n\nALWAYS run tests with race detector during CI:\n\n```bash\ngo test -race .\u002F...\n```\n\nThis is non-negotiable. A test suite that passes without `-race` proves nothing\nabout concurrent correctness.\n\n## Red Flags Checklist\n\n- 🔴 Goroutine started without shutdown path\n- 🔴 Channel never closed (potential goroutine leak)\n- 🔴 Mutex copied by value\n- 🔴 Context stored in struct field\n- 🔴 `context.Background()` used where parent context was available\n- 🔴 `select` without `ctx.Done()` case in blocking operation\n- 🔴 Shared map\u002Fslice accessed without synchronization\n- 🟡 Buffered channel with arbitrary large size\n- 🟡 `time.Sleep` used for synchronization instead of proper signaling\n- 🟡 Goroutine starting inside `init()` or constructor without lifecycle control\n","# Go Concurrency Review\n\nConcurrency in Go is powerful and deceptively easy to get wrong.\nThese patterns prevent goroutine leaks, data races, and deadlocks.\n\nDetailed reference material, loaded on demand:\n\n- `references\u002Fchannels.md` — sizing, signalling, producer shutdown.\n- `references\u002Fmutex-and-atomics.md` — mutex placement, lock scope, atomics,\n  `sync.Once`.\n\nRead a reference file only when the section below is not enough.\n\n## Operating Modes\n\nPick the mode that matches the request before starting:\n\n- **Implementation** — writing new concurrent code. Follow the patterns\n  below as construction rules.\n- **Diff review** (default) — check changed code against every section,\n  paying extra attention to new `go` statements and shared state.\n- **Leak\u002Frace hunt** — a symptom is already observed (growing goroutine\n  count, `-race` report, deadlock). Start from \"Auditing Large Codebases\"\n  and the Race Detection section to localize it.\n\n## Auditing Large Codebases\n\nFor a full concurrency audit, run these independent passes rather than\none linear read:\n\n1. **Goroutine lifecycle:** find every `go` statement\n   (`grep -rn \"go func\\|go [a-zA-Z]\" --include=\"*.go\"`) and verify each\n   has a termination path (context, closed channel, WaitGroup).\n2. **Shared state:** find package-level vars and struct fields accessed\n   from multiple goroutines; verify mutex\u002Fatomic protection.\n3. **Channel topology:** map producers\u002Fconsumers per channel; verify\n   close-exactly-once and no send-on-closed paths.\n4. **Context propagation:** verify blocking calls accept and respect\n   `context.Context`.\n\nIf your environment supports delegating work to parallel sub-agents or\ntasks, assign each pass to one; otherwise run them in order. Findings\nmust cite `file.go:line`. Always finish with `go test -race .\u002F...`.\n\n## 1. Goroutine Lifecycle Management\n\nEVERY goroutine MUST have a clear termination path. No fire-and-forget.\n\n### Use `errgroup` for coordinated goroutines:\n\n```go\ng, ctx := errgroup.WithContext(ctx)\n\ng.Go(func() error {\n    return fetchUsers(ctx)\n})\n\ng.Go(func() error {\n    return fetchOrders(ctx)\n})\n\nif err := g.Wait(); err != nil {\n    return fmt.Errorf(\"fetch data: %w\", err)\n}\n```\n\n### Long-running goroutines must respect context:\n\n```go\nfunc (w *Worker) Run(ctx context.Context) error {\n    for {\n        select {\n        case \u003C-ctx.Done():\n            return ctx.Err()\n        case job := \u003C-w.jobs:\n            if err := w.process(job); err != nil {\n                w.logger.Error(\"process job\", slog.Any(\"error\", err))\n            }\n        }\n    }\n}\n```\n\n### Start goroutines in the owner, not the callee:\n\n```go\n\u002F\u002F ✅ Good — caller controls lifecycle\ngo worker.Run(ctx)\n\n\u002F\u002F ❌ Bad — function secretly starts goroutine\nfunc NewWorker() *Worker {\n    w := &Worker{}\n    go w.run() \u002F\u002F hidden goroutine — caller has no control\n    return w\n}\n```\n\n## 2. Channel Patterns\n\n- Size is one or none. Unbuffered is a synchronization point; buffer 1 is a\n  handoff. Any larger buffer needs a comment justifying the number — an\n  arbitrary `100` is a bug waiting for the day production is slower than\n  staging.\n- Signal channels carry `struct{}`, and `close(done)` broadcasts to every\n  receiver at once.\n- The producer owns the channel and is the only one that closes it, with\n  `defer close(ch)` in the producing goroutine. Every send sits in a `select`\n  against `ctx.Done()`, or a consumer that walks away leaks the producer.\n\nExamples in `references\u002Fchannels.md`.\n\n## 3. Mutexes and Atomics\n\n- Zero-value `sync.Mutex` and `sync.RWMutex` are ready to use. A\n  `*sync.Mutex` field is always wrong.\n- Declare the mutex directly above the fields it guards, with a comment\n  naming the relationship. A mutex that guards \"the struct\" guards nothing in\n  particular.\n- Keep the critical section minimal — never call out to an external service,\n  or take a second lock, while holding one.\n- 🔴 Never copy a value containing a mutex (`c2 := *c1`): the copy carries the\n  original's lock state. `go vet` catches most of these; trust it.\n- Use `sync\u002Fatomic` types for counters and flags rather than a mutex around\n  an `int64`.\n- `sync.Once` for lazy initialization that must happen exactly once.\n\nExamples in `references\u002Fmutex-and-atomics.md`.\n\n## 4. Context Propagation\n\nContext is always the first parameter, never a struct field, and every\nblocking operation selects on `ctx.Done()`:\n\n```go\n\u002F\u002F ✅ Good\nselect {\ncase result := \u003C-ch:\n    return result, nil\ncase \u003C-ctx.Done():\n    return nil, ctx.Err()\n}\n\n\u002F\u002F ❌ Bad — blocks forever if the context is cancelled\nresult := \u003C-ch\n```\n\nDerive a child context with its own timeout for each external call and\n`defer cancel()` immediately. Full rules in the `go-context` skill.\n\n## 5. Avoid Mutable Globals\n\n```go\n\u002F\u002F ❌ Bad — mutable global, not safe for concurrent access\nvar db *sql.DB\n\n\u002F\u002F ✅ Good — pass as dependency\ntype Server struct {\n    db *sql.DB\n}\n```\n\n## Race Detection\n\nALWAYS run tests with race detector during CI:\n\n```bash\ngo test -race .\u002F...\n```\n\nThis is non-negotiable. A test suite that passes without `-race` proves nothing\nabout concurrent correctness.\n\n## Red Flags Checklist\n\n- 🔴 Goroutine started without shutdown path\n- 🔴 Channel never closed (potential goroutine leak)\n- 🔴 Mutex copied by value\n- 🔴 Context stored in struct field\n- 🔴 `context.Background()` used where parent context was available\n- 🔴 `select` without `ctx.Done()` case in blocking operation\n- 🔴 Shared map\u002Fslice accessed without synchronization\n- 🟡 Buffered channel with arbitrary large size\n- 🟡 `time.Sleep` used for synchronization instead of proper signaling\n- 🟡 Goroutine starting inside `init()` or constructor without lifecycle control\n",{"name":5,"license":15,"metadata":24,"description":27,"allowed-tools":28,"compatibility":29,"user-invocable":30},{"author":25,"version":26},"eduardo-sl","1.3.0","Review and implement safe concurrency patterns in Go: goroutines, channels, sync primitives, context propagation, and goroutine lifecycle management. Use when writing concurrent code, reviewing async patterns, checking thread safety, debugging race conditions, or designing producer\u002Fconsumer pipelines. Trigger examples: \"check thread safety\", \"review goroutines\", \"race condition\", \"channel patterns\", \"sync.Mutex\", \"context cancellation\", \"goroutine leak\". Not for: general style (go-coding-standards), HTTP handler patterns (go-api-design).\n","Read Edit Write Glob Grep Bash(go:*) Bash(gofmt:*)","Designed for Claude Code or similar AI coding agents working on Go projects. Requires the Go toolchain. Race detection requires cgo (CGO_ENABLED=1).",true,"main","19f4d52a98d557f3a645a2cfbbeb5bd54f28831d",".github\u002Fskills\u002Fgo-agent-skills\u002Fskills\u002F(safety)\u002Fgo-concurrency-review","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":40,"prompt":50,"zipAvailable":30},[41,44,47],{"tool":42,"command":43},"npx","npx skills add kongnakornna\u002Fgolangapi --skill go-concurrency-review",{"tool":45,"command":46},"bunx","bunx skills add kongnakornna\u002Fgolangapi --skill go-concurrency-review",{"tool":48,"command":49},"pnpm","pnpm dlx skills add kongnakornna\u002Fgolangapi --skill go-concurrency-review","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgo-agent-skills\u002Fskills\u002F(safety)\u002Fgo-concurrency-review\u002FSKILL.md",[52,58],{"path":53,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":56,"sourceHtmlUrl":57},"references\u002Fchannels.md","REFERENCE","参考文档",1015,"https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgo-agent-skills\u002Fskills\u002F(safety)\u002Fgo-concurrency-review\u002Freferences\u002Fchannels.md",{"path":59,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":60,"sourceHtmlUrl":61},"references\u002Fmutex-and-atomics.md",1832,"https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgo-agent-skills\u002Fskills\u002F(safety)\u002Fgo-concurrency-review\u002Freferences\u002Fmutex-and-atomics.md",[63,71,78,85,92,99],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":67,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M7A0M9RJJ3383VEFYKABWV15","tb-writing-plans","Use when you have a spec or requirements for a multi-step task, before touching code","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ftb-writing-plans\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":67,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"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":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":67,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"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":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":67,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"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":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":67,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"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":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":67,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"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",[],[]]