[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79ZW481E1BJEXGCDXCYHAQE":3,"skill-same:01M79ZW481E1BJEXGCDXCYHAQE":52},{"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},"01M79ZW481E1BJEXGCDXCYHAQE","go-data-structures",null,"Use when working with Go slices, maps, or arrays — choosing between new and make, using append, declaring empty slices (nil vs literal for JSON), implementing sets with maps, and copying data at boundaries. Also use when building or manipulating collections, even if the user doesn't ask about allocation idioms. Does not cover concurrent data structure safety (see go-concurrency).","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-data-structures\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: go-data-structures\ndescription: Use when working with Go slices, maps, or arrays — choosing between new and make, using append, declaring empty slices (nil vs literal for JSON), implementing sets with maps, and copying data at boundaries. Also use when building or manipulating collections, even if the user doesn't ask about allocation idioms. Does not cover concurrent data structure safety (see go-concurrency).\n---\n\n# Go Data Structures\n\n## Resource Routing\n\n- `references\u002FSLICES.md` - Read when deciding nil versus empty slices, copying slices, or managing slice capacity and aliasing.\n\n## Choosing a Data Structure\n\n```\nWhat do you need?\n├─ Ordered collection of items\n│  ├─ Fixed size known at compile time → Array [N]T\n│  └─ Dynamic size → Slice []T\n│     ├─ Know approximate size? → make([]T, 0, capacity)\n│     └─ Unknown size or nil-safe for JSON? → var s []T (nil)\n├─ Key-value lookup\n│  └─ Map map[K]V\n│     ├─ Know approximate size? → make(map[K]V, capacity)\n│     └─ Need a set? → map[T]struct{} (zero-size values)\n└─ Need to pass to a function?\n   └─ Copy at the boundary if the caller might mutate it\n```\n\n> **When this skill does NOT apply**: For concurrent access to data structures (mutexes, atomic operations), see [go-concurrency](..\u002Fgo-concurrency\u002FSKILL.md). For defensive copying at API boundaries, see [go-defensive](..\u002Fgo-defensive\u002FSKILL.md). For pre-sizing capacity for performance, see [go-performance](..\u002Fgo-performance\u002FSKILL.md).\n\n---\n\n## Slices\n\n### The append Function\n\n**Always assign the result** — the underlying array may change:\n\n```go\nx := []int{1, 2, 3}\nx = append(x, 4, 5, 6)\n\n\u002F\u002F Append a slice to a slice\nx = append(x, y...)  \u002F\u002F Note the ...\n```\n\n### Two-Dimensional Slices\n\n**Independent inner slices** (can grow\u002Fshrink independently):\n\n```go\npicture := make([][]uint8, YSize)\nfor i := range picture {\n    picture[i] = make([]uint8, XSize)\n}\n```\n\n**Single allocation** (more efficient for fixed sizes):\n\n```go\npicture := make([][]uint8, YSize)\npixels := make([]uint8, XSize*YSize)\nfor i := range picture {\n    picture[i], pixels = pixels[:XSize], pixels[XSize:]\n}\n```\n\n### Declaring Empty Slices\n\nPrefer nil slices over empty literals:\n\n```go\n\u002F\u002F Good: nil slice\nvar t []string\n\n\u002F\u002F Avoid: non-nil but zero-length\nt := []string{}\n```\n\nBoth have `len` and `cap` of zero, but the nil slice is the preferred style.\n\n**Exception for JSON**: A nil slice encodes to `null`, while `[]string{}`\nencodes to `[]`. Use non-nil when you need a JSON array.\n\nWhen designing interfaces, avoid distinguishing between nil and non-nil\nzero-length slices.\n\n---\n\n## Maps\n\n### Implementing a Set\n\nUse `map[T]struct{}` when the map is only a set. The empty struct takes no\nstorage and makes membership intent explicit:\n\n```go\nattended := map[string]struct{}{\"Ann\": {}, \"Joe\": {}}\nif _, ok := attended[person]; ok {\n    fmt.Println(person, \"was at the meeting\")\n}\n```\n\nUse boolean map values only when the value carries a separate meaning beyond\npresence.\n\n---\n\n## Copying\n\nBe careful when copying a struct from another package. If the type has methods\non its pointer type (`*T`), copying the value can cause aliasing bugs.\n\n**General rule:** Do not copy a value of type `T` if its methods are associated\nwith the pointer type `*T`. This applies to `bytes.Buffer`, `sync.Mutex`,\n`sync.WaitGroup`, and types containing them.\n\n```go\n\u002F\u002F Bad: copying a mutex\nvar mu sync.Mutex\nmu2 := mu  \u002F\u002F almost always a bug\n\n\u002F\u002F Good: pass by pointer\nfunc increment(sc *SafeCounter) {\n    sc.mu.Lock()\n    sc.count++\n    sc.mu.Unlock()\n}\n```\n\n---\n\n## Quick Reference\n\n| Topic | Key Point |\n|-------|-----------|\n| Slices | Always assign `append` result; `nil` slice preferred over `[]T{}` |\n| Sets | `map[T]struct{}` for membership-only sets |\n| Copying | Don't copy `T` if methods are on `*T`; beware aliasing |\n\n## Related Skills\n\n- **Defensive copying**: See [go-defensive](..\u002Fgo-defensive\u002FSKILL.md) when copying slices or maps at API boundaries to prevent mutation\n- **Capacity hints**: See [go-performance](..\u002Fgo-performance\u002FSKILL.md) when pre-sizing slices or maps for known workloads\n- **Iteration patterns**: See [go-control-flow](..\u002Fgo-control-flow\u002FSKILL.md) when using range loops over slices, maps, or channels\n- **Declaration style**: See [go-declarations](..\u002Fgo-declarations\u002FSKILL.md) when choosing between `new`, `make`, `var`, and composite literals\n","# Go Data Structures\n\n## Resource Routing\n\n- `references\u002FSLICES.md` - Read when deciding nil versus empty slices, copying slices, or managing slice capacity and aliasing.\n\n## Choosing a Data Structure\n\n```\nWhat do you need?\n├─ Ordered collection of items\n│  ├─ Fixed size known at compile time → Array [N]T\n│  └─ Dynamic size → Slice []T\n│     ├─ Know approximate size? → make([]T, 0, capacity)\n│     └─ Unknown size or nil-safe for JSON? → var s []T (nil)\n├─ Key-value lookup\n│  └─ Map map[K]V\n│     ├─ Know approximate size? → make(map[K]V, capacity)\n│     └─ Need a set? → map[T]struct{} (zero-size values)\n└─ Need to pass to a function?\n   └─ Copy at the boundary if the caller might mutate it\n```\n\n> **When this skill does NOT apply**: For concurrent access to data structures (mutexes, atomic operations), see [go-concurrency](..\u002Fgo-concurrency\u002FSKILL.md). For defensive copying at API boundaries, see [go-defensive](..\u002Fgo-defensive\u002FSKILL.md). For pre-sizing capacity for performance, see [go-performance](..\u002Fgo-performance\u002FSKILL.md).\n\n---\n\n## Slices\n\n### The append Function\n\n**Always assign the result** — the underlying array may change:\n\n```go\nx := []int{1, 2, 3}\nx = append(x, 4, 5, 6)\n\n\u002F\u002F Append a slice to a slice\nx = append(x, y...)  \u002F\u002F Note the ...\n```\n\n### Two-Dimensional Slices\n\n**Independent inner slices** (can grow\u002Fshrink independently):\n\n```go\npicture := make([][]uint8, YSize)\nfor i := range picture {\n    picture[i] = make([]uint8, XSize)\n}\n```\n\n**Single allocation** (more efficient for fixed sizes):\n\n```go\npicture := make([][]uint8, YSize)\npixels := make([]uint8, XSize*YSize)\nfor i := range picture {\n    picture[i], pixels = pixels[:XSize], pixels[XSize:]\n}\n```\n\n### Declaring Empty Slices\n\nPrefer nil slices over empty literals:\n\n```go\n\u002F\u002F Good: nil slice\nvar t []string\n\n\u002F\u002F Avoid: non-nil but zero-length\nt := []string{}\n```\n\nBoth have `len` and `cap` of zero, but the nil slice is the preferred style.\n\n**Exception for JSON**: A nil slice encodes to `null`, while `[]string{}`\nencodes to `[]`. Use non-nil when you need a JSON array.\n\nWhen designing interfaces, avoid distinguishing between nil and non-nil\nzero-length slices.\n\n---\n\n## Maps\n\n### Implementing a Set\n\nUse `map[T]struct{}` when the map is only a set. The empty struct takes no\nstorage and makes membership intent explicit:\n\n```go\nattended := map[string]struct{}{\"Ann\": {}, \"Joe\": {}}\nif _, ok := attended[person]; ok {\n    fmt.Println(person, \"was at the meeting\")\n}\n```\n\nUse boolean map values only when the value carries a separate meaning beyond\npresence.\n\n---\n\n## Copying\n\nBe careful when copying a struct from another package. If the type has methods\non its pointer type (`*T`), copying the value can cause aliasing bugs.\n\n**General rule:** Do not copy a value of type `T` if its methods are associated\nwith the pointer type `*T`. This applies to `bytes.Buffer`, `sync.Mutex`,\n`sync.WaitGroup`, and types containing them.\n\n```go\n\u002F\u002F Bad: copying a mutex\nvar mu sync.Mutex\nmu2 := mu  \u002F\u002F almost always a bug\n\n\u002F\u002F Good: pass by pointer\nfunc increment(sc *SafeCounter) {\n    sc.mu.Lock()\n    sc.count++\n    sc.mu.Unlock()\n}\n```\n\n---\n\n## Quick Reference\n\n| Topic | Key Point |\n|-------|-----------|\n| Slices | Always assign `append` result; `nil` slice preferred over `[]T{}` |\n| Sets | `map[T]struct{}` for membership-only sets |\n| Copying | Don't copy `T` if methods are on `*T`; beware aliasing |\n\n## Related Skills\n\n- **Defensive copying**: See [go-defensive](..\u002Fgo-defensive\u002FSKILL.md) when copying slices or maps at API boundaries to prevent mutation\n- **Capacity hints**: See [go-performance](..\u002Fgo-performance\u002FSKILL.md) when pre-sizing slices or maps for known workloads\n- **Iteration patterns**: See [go-control-flow](..\u002Fgo-control-flow\u002FSKILL.md) when using range loops over slices, maps, or channels\n- **Declaration style**: See [go-declarations](..\u002Fgo-declarations\u002FSKILL.md) when choosing between `new`, `make`, `var`, and composite literals\n",{"name":5,"description":7},"main","19f4d52a98d557f3a645a2cfbbeb5bd54f28831d",".github\u002Fskills\u002Fgolang-skills\u002Fskills\u002Fgo-data-structures","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-data-structures",{"tool":38,"command":39},"bunx","bunx skills add kongnakornna\u002Fgolangapi --skill go-data-structures",{"tool":41,"command":42},"pnpm","pnpm dlx skills add kongnakornna\u002Fgolangapi --skill go-data-structures","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgolang-skills\u002Fskills\u002Fgo-data-structures\u002FSKILL.md",true,[46],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"references\u002FSLICES.md","REFERENCE","参考文档",3326,"https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgolang-skills\u002Fskills\u002Fgo-data-structures\u002Freferences\u002FSLICES.md",[53,60,67,74,81,88],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"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":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"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":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"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":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"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":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"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":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"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",[],[]]