[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79ZAA28H25678HTDX5YS8KQ":3,"skill-same:01M79ZAA28H25678HTDX5YS8KQ":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},"01M79ZAA28H25678HTDX5YS8KQ","go-defensive-coding",null,"Prevent panics, silent corruption, and subtle runtime bugs in Go: typed-nil interfaces, slice aliasing, integer overflow on conversion, float comparison, defer in loops, defensive copying at API boundaries, and zero-value design. Use when hardening code against crashes, reviewing for nil-safety, converting between numeric types, or deciding what to copy at a package boundary. Trigger examples: \"nil pointer panic\", \"why is my error not nil\", \"slice aliasing\", \"integer overflow\", \"compare floats\", \"defer in a loop\", \"defensive copy\", \"make this crash-proof\". Not for: data races and goroutine lifecycle (go-concurrency-review), injection and auth (go-security-audit), a panic that already happened (go-troubleshooting).","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-defensive-coding\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: go-defensive-coding\ndescription: >\n  Prevent panics, silent corruption, and subtle runtime bugs in Go:\n  typed-nil interfaces, slice aliasing, integer overflow on conversion,\n  float comparison, defer in loops, defensive copying at API boundaries, and\n  zero-value design. Use when hardening code against crashes, reviewing for\n  nil-safety, converting between numeric types, or deciding what to copy at\n  a package boundary. Trigger examples: \"nil pointer panic\", \"why is my\n  error not nil\", \"slice aliasing\", \"integer overflow\", \"compare floats\",\n  \"defer in a loop\", \"defensive copy\", \"make this crash-proof\".\n  Not for: data races and goroutine lifecycle (go-concurrency-review),\n  injection and auth (go-security-audit), a panic that already happened\n  (go-troubleshooting).\nuser-invocable: true\nlicense: MIT\ncompatibility: Designed for Claude Code or similar AI coding agents working on Go projects. Requires the Go toolchain. golangci-lint and gosec are optional, for enforcing the rules below.\nallowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(gofmt:*) Bash(golangci-lint:*) Bash(gosec:*)\nmetadata:\n  author: eduardo-sl\n  version: \"1.1.1\"\n---\n\n# Go Defensive Coding\n\nGo has no exceptions and no null-safety in the type system. Every trap below\ncompiles cleanly, passes review, and fails in production.\n\nDetailed reference material, loaded on demand:\n\n- `references\u002Fnil-and-aliasing.md` — the full typed-nil rules, slice\n  aliasing scenarios, and memory retention.\n- `references\u002Fnumeric-safety.md` — conversion range checks, overflow\n  detection, float and time comparison.\n\nRead a reference file only when the section below is not enough.\n\n## Operating Modes\n\n- **Harden** — you are writing or changing code. Apply every rule as you go.\n- **Review** — you are auditing existing code. Report findings with severity\n  (🔴 panic or corruption, 🟡 latent bug, 🟢 style) and cite file:line.\n\n## 1. The Typed-Nil Interface Trap\n\nA non-nil interface can hold a nil pointer. This is the single most common\nsource of \"impossible\" nil checks in Go.\n\n```go\ntype NotFoundError struct{ ID string }\n\nfunc (e *NotFoundError) Error() string { return \"not found: \" + e.ID }\n\n\u002F\u002F ❌ Bad — returns a non-nil error even on success\nfunc find(id string) error {\n    var err *NotFoundError \u002F\u002F typed nil\n    if id == \"\" {\n        err = &NotFoundError{ID: id}\n    }\n    return err \u002F\u002F interface is (type=*NotFoundError, value=nil) — NOT nil\n}\n\n\u002F\u002F ✅ Good — return the untyped nil literal\nfunc find(id string) error {\n    if id == \"\" {\n        return &NotFoundError{ID: id}\n    }\n    return nil\n}\n```\n\nRules:\n\n- Never declare a concrete error\u002Fpointer variable and return it as an\n  interface. Return `nil` explicitly on the success path.\n- Never store a possibly-nil concrete pointer in an `error`, `io.Reader`, or\n  any interface-typed struct field.\n- `go vet`'s `nilness` analyzer catches some of these. It does not catch all.\n\n## 2. Nil Map, Slice, and Channel Behaviour\n\nMemorise this table — half of these are safe and half panic or hang.\n\n| Operation | nil map | nil slice | nil channel |\n|---|---|---|---|\n| Read \u002F receive | zero value | index panics | blocks forever |\n| Write \u002F send | **panics** | `append` works | blocks forever |\n| `len` \u002F `cap` | `0` | `0` | `0` |\n| `range` | zero iterations | zero iterations | blocks forever |\n| `close` | n\u002Fa | n\u002Fa | **panics** |\n\n```go\n\u002F\u002F ✅ A nil slice is a valid empty slice — do not guard append\nvar out []string\nout = append(out, \"a\")\n\n\u002F\u002F ❌ A nil map is read-only\nvar m map[string]int\nm[\"k\"] = 1 \u002F\u002F panic: assignment to entry in nil map\n\n\u002F\u002F ✅ Initialise every map before writing\nm := make(map[string]int)\n```\n\nReturn nil slices, not `[]T{}`. They marshal identically in JSON for\n`encoding\u002Fjson` when the field is `omitempty`, and cost no allocation.\nReturn an empty non-nil map only when the caller is documented to write to it.\n\n## 3. Slice Aliasing\n\nA slice is a view. `append` writes through that view whenever capacity\nallows, mutating data the caller still owns.\n\n```go\na := []int{1, 2, 3, 4}\nb := a[:2]\nb = append(b, 99) \u002F\u002F ❌ overwrites a[2]; a is now [1 2 99 4]\n```\n\n```go\n\u002F\u002F ✅ Full slice expression caps the view — append must reallocate\nb := a[:2:2]\nb = append(b, 99) \u002F\u002F a is untouched\n```\n\nApply this whenever you hand a subslice to code you do not control, and\nwhenever a struct field holds a subslice of a larger buffer.\n\nA subslice also keeps the entire backing array alive. To release a large\nbuffer, copy what you need: `head := slices.Clone(buf[:64])`.\n\n## 4. Defensive Copying at Boundaries\n\nSlices and maps are reference types. Storing or returning one without a copy\nhands out a mutable handle to your internals.\n\n```go\ntype Config struct{ hosts []string }\n\n\u002F\u002F ❌ Bad — caller can mutate our state, both ways\nfunc NewConfig(hosts []string) *Config { return &Config{hosts: hosts} }\nfunc (c *Config) Hosts() []string      { return c.hosts }\n\n\u002F\u002F ✅ Good — copy in, copy out\nfunc NewConfig(hosts []string) *Config {\n    return &Config{hosts: slices.Clone(hosts)}\n}\nfunc (c *Config) Hosts() []string { return slices.Clone(c.hosts) }\n```\n\nUse `maps.Clone` for maps. Both are shallow — a `[]*User` clone still shares\nthe pointed-to users.\n\nCopy when the value is retained past the call or exposed to a caller. Do not\ncopy a slice you only read inside the function; that is wasted allocation.\n\n### Preventing accidental copies\n\nA struct containing a `sync.Mutex`, `sync.WaitGroup`, or `atomic.Int64` must\nnever be copied — the copy gets its own independent lock, and both halves\nbelieve they are synchronised.\n\n```go\n\u002F\u002F ❌ Bad — the receiver is a copy, so the mutex protects nothing\nfunc (c Counter) Value() int { ... }\n\n\u002F\u002F ❌ Bad — passing by value copies the mutex\nfunc report(c Counter) { ... }\n```\n\n`go vet`'s `copylocks` analyzer catches these. For types that must not be\ncopied but hold no lock, embed a `noCopy` marker so `vet` catches them too:\n\n```go\ntype noCopy struct{}\n\nfunc (*noCopy) Lock()   {}\nfunc (*noCopy) Unlock() {}\n\ntype Tracker struct {\n    noCopy noCopy\n    \u002F\u002F ...\n}\n```\n\n## 5. Numeric Conversion and Comparison\n\nGo never panics on numeric conversion. It truncates.\n\n```go\n\u002F\u002F ❌ Silent corruption when the value does not fit\ncount := int32(int64Total)\n\n\u002F\u002F ✅ Range-check before narrowing\nif int64Total > math.MaxInt32 || int64Total \u003C math.MinInt32 {\n    return fmt.Errorf(\"total %d out of int32 range\", int64Total)\n}\ncount := int32(int64Total)\n```\n\nThe same applies to `int` → `uint` (negatives wrap to huge values) and to\n`len()` results assigned to sized types. `gosec` reports these as G115.\n\nNever compare floats with `==`; never compare `time.Time` with `==`.\n\n```go\n\u002F\u002F ✅ Floats: compare against a tolerance\nif math.Abs(got-want) \u003C 1e-9 { ... }\n\n\u002F\u002F ✅ Times: Equal compares the instant, == also compares wall clock and location\nif t1.Equal(t2) { ... }\n```\n\nInteger division by zero panics; float division by zero yields `±Inf` or\n`NaN`, and `NaN != NaN`. Guard divisors that come from input.\n\n## 6. Resource Lifecycle\n\n`defer` runs at **function** return, not at the end of the block.\n\n```go\n\u002F\u002F ❌ Bad — all files stay open until the loop finishes\nfor _, name := range names {\n    f, err := os.Open(name)\n    if err != nil {\n        return err\n    }\n    defer f.Close()\n    process(f)\n}\n\n\u002F\u002F ✅ Good — a function scope per iteration\nfor _, name := range names {\n    if err := func() error {\n        f, err := os.Open(name)\n        if err != nil {\n            return err\n        }\n        defer f.Close()\n        return process(f)\n    }(); err != nil {\n        return err\n    }\n}\n```\n\nThe same rule applies to `resp.Body.Close`, `rows.Close`, `mu.Unlock`, and\n`tx.Rollback` inside loops or long-lived functions.\n\nCheck the error from a deferred `Close` on anything you wrote to — a failed\nflush on close is a silent data loss otherwise:\n\n```go\ndefer func() {\n    if cerr := f.Close(); cerr != nil && err == nil {\n        err = fmt.Errorf(\"close %s: %w\", name, cerr)\n    }\n}()\n```\n\n## 7. Zero-Value and Initialisation Safety\n\nDesign types so the zero value works, then no constructor can be forgotten.\n\n```go\n\u002F\u002F ✅ Usable zero value — sync.Mutex and the nil map read are both fine\ntype Counter struct {\n    mu sync.Mutex\n    n  map[string]int\n}\n\nfunc (c *Counter) Inc(k string) {\n    c.mu.Lock()\n    defer c.mu.Unlock()\n    if c.n == nil { \u002F\u002F lazily initialise on first write\n        c.n = make(map[string]int)\n    }\n    c.n[k]++\n}\n```\n\nWhen lazy init must happen exactly once and may race, use `sync.Once`.\n\nAvoid `init()`. It runs before `main`, cannot fail cleanly, cannot be tested\nin isolation, and its cross-file order depends on filenames. Use an explicit\n`New...` constructor that returns an error.\n\n## Enforce with Tooling\n\nRun these; do not rely on reading alone. Skip and note any tool that is not\ninstalled.\n\n```bash\ngo vet .\u002F...                                  # includes the nilness analyzer\ngolangci-lint run                             # errcheck, bodyclose, makezero, sqlclosecheck\ngosec -include=G115,G104,G601 .\u002F...           # integer overflow, unhandled errors\ngo test -race .\u002F...                           # aliasing bugs often surface as races\n```\n\nRelevant golangci-lint linters: `errcheck`, `bodyclose`, `sqlclosecheck`,\n`rowserrcheck`, `makezero`, `nilerr`, `exhaustive`, and `govet` with the\n`nilness` analyzer enabled.\n\nGo 1.22 and later give each loop iteration its own variable. Do not add the\nold `v := v` shadow line; do not remove one from a module still on `go 1.21`.\n\n## Verification Checklist\n\n1. No function returns a concrete pointer type as an interface on a success path\n2. Every map is initialised before its first write\n3. Subslices handed across a package boundary use a full slice expression `a[:n:n]`\n4. Slices and maps stored in or returned from a struct are cloned\n5. No type holding a mutex or atomic is passed or received by value\n6. Every narrowing numeric conversion is range-checked, or documented as bounded\n7. No `==` on floats or on `time.Time`\n8. Divisors derived from input are checked against zero\n9. No `defer` inside a loop body without an enclosing function scope\n10. Deferred `Close` on written resources reports its error\n11. `go vet`, `golangci-lint` and `go test -race` are clean\n","# Go Defensive Coding\n\nGo has no exceptions and no null-safety in the type system. Every trap below\ncompiles cleanly, passes review, and fails in production.\n\nDetailed reference material, loaded on demand:\n\n- `references\u002Fnil-and-aliasing.md` — the full typed-nil rules, slice\n  aliasing scenarios, and memory retention.\n- `references\u002Fnumeric-safety.md` — conversion range checks, overflow\n  detection, float and time comparison.\n\nRead a reference file only when the section below is not enough.\n\n## Operating Modes\n\n- **Harden** — you are writing or changing code. Apply every rule as you go.\n- **Review** — you are auditing existing code. Report findings with severity\n  (🔴 panic or corruption, 🟡 latent bug, 🟢 style) and cite file:line.\n\n## 1. The Typed-Nil Interface Trap\n\nA non-nil interface can hold a nil pointer. This is the single most common\nsource of \"impossible\" nil checks in Go.\n\n```go\ntype NotFoundError struct{ ID string }\n\nfunc (e *NotFoundError) Error() string { return \"not found: \" + e.ID }\n\n\u002F\u002F ❌ Bad — returns a non-nil error even on success\nfunc find(id string) error {\n    var err *NotFoundError \u002F\u002F typed nil\n    if id == \"\" {\n        err = &NotFoundError{ID: id}\n    }\n    return err \u002F\u002F interface is (type=*NotFoundError, value=nil) — NOT nil\n}\n\n\u002F\u002F ✅ Good — return the untyped nil literal\nfunc find(id string) error {\n    if id == \"\" {\n        return &NotFoundError{ID: id}\n    }\n    return nil\n}\n```\n\nRules:\n\n- Never declare a concrete error\u002Fpointer variable and return it as an\n  interface. Return `nil` explicitly on the success path.\n- Never store a possibly-nil concrete pointer in an `error`, `io.Reader`, or\n  any interface-typed struct field.\n- `go vet`'s `nilness` analyzer catches some of these. It does not catch all.\n\n## 2. Nil Map, Slice, and Channel Behaviour\n\nMemorise this table — half of these are safe and half panic or hang.\n\n| Operation | nil map | nil slice | nil channel |\n|---|---|---|---|\n| Read \u002F receive | zero value | index panics | blocks forever |\n| Write \u002F send | **panics** | `append` works | blocks forever |\n| `len` \u002F `cap` | `0` | `0` | `0` |\n| `range` | zero iterations | zero iterations | blocks forever |\n| `close` | n\u002Fa | n\u002Fa | **panics** |\n\n```go\n\u002F\u002F ✅ A nil slice is a valid empty slice — do not guard append\nvar out []string\nout = append(out, \"a\")\n\n\u002F\u002F ❌ A nil map is read-only\nvar m map[string]int\nm[\"k\"] = 1 \u002F\u002F panic: assignment to entry in nil map\n\n\u002F\u002F ✅ Initialise every map before writing\nm := make(map[string]int)\n```\n\nReturn nil slices, not `[]T{}`. They marshal identically in JSON for\n`encoding\u002Fjson` when the field is `omitempty`, and cost no allocation.\nReturn an empty non-nil map only when the caller is documented to write to it.\n\n## 3. Slice Aliasing\n\nA slice is a view. `append` writes through that view whenever capacity\nallows, mutating data the caller still owns.\n\n```go\na := []int{1, 2, 3, 4}\nb := a[:2]\nb = append(b, 99) \u002F\u002F ❌ overwrites a[2]; a is now [1 2 99 4]\n```\n\n```go\n\u002F\u002F ✅ Full slice expression caps the view — append must reallocate\nb := a[:2:2]\nb = append(b, 99) \u002F\u002F a is untouched\n```\n\nApply this whenever you hand a subslice to code you do not control, and\nwhenever a struct field holds a subslice of a larger buffer.\n\nA subslice also keeps the entire backing array alive. To release a large\nbuffer, copy what you need: `head := slices.Clone(buf[:64])`.\n\n## 4. Defensive Copying at Boundaries\n\nSlices and maps are reference types. Storing or returning one without a copy\nhands out a mutable handle to your internals.\n\n```go\ntype Config struct{ hosts []string }\n\n\u002F\u002F ❌ Bad — caller can mutate our state, both ways\nfunc NewConfig(hosts []string) *Config { return &Config{hosts: hosts} }\nfunc (c *Config) Hosts() []string      { return c.hosts }\n\n\u002F\u002F ✅ Good — copy in, copy out\nfunc NewConfig(hosts []string) *Config {\n    return &Config{hosts: slices.Clone(hosts)}\n}\nfunc (c *Config) Hosts() []string { return slices.Clone(c.hosts) }\n```\n\nUse `maps.Clone` for maps. Both are shallow — a `[]*User` clone still shares\nthe pointed-to users.\n\nCopy when the value is retained past the call or exposed to a caller. Do not\ncopy a slice you only read inside the function; that is wasted allocation.\n\n### Preventing accidental copies\n\nA struct containing a `sync.Mutex`, `sync.WaitGroup`, or `atomic.Int64` must\nnever be copied — the copy gets its own independent lock, and both halves\nbelieve they are synchronised.\n\n```go\n\u002F\u002F ❌ Bad — the receiver is a copy, so the mutex protects nothing\nfunc (c Counter) Value() int { ... }\n\n\u002F\u002F ❌ Bad — passing by value copies the mutex\nfunc report(c Counter) { ... }\n```\n\n`go vet`'s `copylocks` analyzer catches these. For types that must not be\ncopied but hold no lock, embed a `noCopy` marker so `vet` catches them too:\n\n```go\ntype noCopy struct{}\n\nfunc (*noCopy) Lock()   {}\nfunc (*noCopy) Unlock() {}\n\ntype Tracker struct {\n    noCopy noCopy\n    \u002F\u002F ...\n}\n```\n\n## 5. Numeric Conversion and Comparison\n\nGo never panics on numeric conversion. It truncates.\n\n```go\n\u002F\u002F ❌ Silent corruption when the value does not fit\ncount := int32(int64Total)\n\n\u002F\u002F ✅ Range-check before narrowing\nif int64Total > math.MaxInt32 || int64Total \u003C math.MinInt32 {\n    return fmt.Errorf(\"total %d out of int32 range\", int64Total)\n}\ncount := int32(int64Total)\n```\n\nThe same applies to `int` → `uint` (negatives wrap to huge values) and to\n`len()` results assigned to sized types. `gosec` reports these as G115.\n\nNever compare floats with `==`; never compare `time.Time` with `==`.\n\n```go\n\u002F\u002F ✅ Floats: compare against a tolerance\nif math.Abs(got-want) \u003C 1e-9 { ... }\n\n\u002F\u002F ✅ Times: Equal compares the instant, == also compares wall clock and location\nif t1.Equal(t2) { ... }\n```\n\nInteger division by zero panics; float division by zero yields `±Inf` or\n`NaN`, and `NaN != NaN`. Guard divisors that come from input.\n\n## 6. Resource Lifecycle\n\n`defer` runs at **function** return, not at the end of the block.\n\n```go\n\u002F\u002F ❌ Bad — all files stay open until the loop finishes\nfor _, name := range names {\n    f, err := os.Open(name)\n    if err != nil {\n        return err\n    }\n    defer f.Close()\n    process(f)\n}\n\n\u002F\u002F ✅ Good — a function scope per iteration\nfor _, name := range names {\n    if err := func() error {\n        f, err := os.Open(name)\n        if err != nil {\n            return err\n        }\n        defer f.Close()\n        return process(f)\n    }(); err != nil {\n        return err\n    }\n}\n```\n\nThe same rule applies to `resp.Body.Close`, `rows.Close`, `mu.Unlock`, and\n`tx.Rollback` inside loops or long-lived functions.\n\nCheck the error from a deferred `Close` on anything you wrote to — a failed\nflush on close is a silent data loss otherwise:\n\n```go\ndefer func() {\n    if cerr := f.Close(); cerr != nil && err == nil {\n        err = fmt.Errorf(\"close %s: %w\", name, cerr)\n    }\n}()\n```\n\n## 7. Zero-Value and Initialisation Safety\n\nDesign types so the zero value works, then no constructor can be forgotten.\n\n```go\n\u002F\u002F ✅ Usable zero value — sync.Mutex and the nil map read are both fine\ntype Counter struct {\n    mu sync.Mutex\n    n  map[string]int\n}\n\nfunc (c *Counter) Inc(k string) {\n    c.mu.Lock()\n    defer c.mu.Unlock()\n    if c.n == nil { \u002F\u002F lazily initialise on first write\n        c.n = make(map[string]int)\n    }\n    c.n[k]++\n}\n```\n\nWhen lazy init must happen exactly once and may race, use `sync.Once`.\n\nAvoid `init()`. It runs before `main`, cannot fail cleanly, cannot be tested\nin isolation, and its cross-file order depends on filenames. Use an explicit\n`New...` constructor that returns an error.\n\n## Enforce with Tooling\n\nRun these; do not rely on reading alone. Skip and note any tool that is not\ninstalled.\n\n```bash\ngo vet .\u002F...                                  # includes the nilness analyzer\ngolangci-lint run                             # errcheck, bodyclose, makezero, sqlclosecheck\ngosec -include=G115,G104,G601 .\u002F...           # integer overflow, unhandled errors\ngo test -race .\u002F...                           # aliasing bugs often surface as races\n```\n\nRelevant golangci-lint linters: `errcheck`, `bodyclose`, `sqlclosecheck`,\n`rowserrcheck`, `makezero`, `nilerr`, `exhaustive`, and `govet` with the\n`nilness` analyzer enabled.\n\nGo 1.22 and later give each loop iteration its own variable. Do not add the\nold `v := v` shadow line; do not remove one from a module still on `go 1.21`.\n\n## Verification Checklist\n\n1. No function returns a concrete pointer type as an interface on a success path\n2. Every map is initialised before its first write\n3. Subslices handed across a package boundary use a full slice expression `a[:n:n]`\n4. Slices and maps stored in or returned from a struct are cloned\n5. No type holding a mutex or atomic is passed or received by value\n6. Every narrowing numeric conversion is range-checked, or documented as bounded\n7. No `==` on floats or on `time.Time`\n8. Divisors derived from input are checked against zero\n9. No `defer` inside a loop body without an enclosing function scope\n10. Deferred `Close` on written resources reports its error\n11. `go vet`, `golangci-lint` and `go test -race` are clean\n",{"name":5,"license":15,"metadata":24,"description":27,"allowed-tools":28,"compatibility":29,"user-invocable":30},{"author":25,"version":26},"eduardo-sl","1.1.1","Prevent panics, silent corruption, and subtle runtime bugs in Go: typed-nil interfaces, slice aliasing, integer overflow on conversion, float comparison, defer in loops, defensive copying at API boundaries, and zero-value design. Use when hardening code against crashes, reviewing for nil-safety, converting between numeric types, or deciding what to copy at a package boundary. Trigger examples: \"nil pointer panic\", \"why is my error not nil\", \"slice aliasing\", \"integer overflow\", \"compare floats\", \"defer in a loop\", \"defensive copy\", \"make this crash-proof\". Not for: data races and goroutine lifecycle (go-concurrency-review), injection and auth (go-security-audit), a panic that already happened (go-troubleshooting).\n","Read Edit Write Glob Grep Bash(go:*) Bash(gofmt:*) Bash(golangci-lint:*) Bash(gosec:*)","Designed for Claude Code or similar AI coding agents working on Go projects. Requires the Go toolchain. golangci-lint and gosec are optional, for enforcing the rules below.",true,"main","19f4d52a98d557f3a645a2cfbbeb5bd54f28831d",".github\u002Fskills\u002Fgo-agent-skills\u002Fskills\u002F(safety)\u002Fgo-defensive-coding","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-defensive-coding",{"tool":45,"command":46},"bunx","bunx skills add kongnakornna\u002Fgolangapi --skill go-defensive-coding",{"tool":48,"command":49},"pnpm","pnpm dlx skills add kongnakornna\u002Fgolangapi --skill go-defensive-coding","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgo-agent-skills\u002Fskills\u002F(safety)\u002Fgo-defensive-coding\u002FSKILL.md",[52,58],{"path":53,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":56,"sourceHtmlUrl":57},"references\u002Fnil-and-aliasing.md","REFERENCE","参考文档",5144,"https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgo-agent-skills\u002Fskills\u002F(safety)\u002Fgo-defensive-coding\u002Freferences\u002Fnil-and-aliasing.md",{"path":59,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":60,"sourceHtmlUrl":61},"references\u002Fnumeric-safety.md",5378,"https:\u002F\u002Fgithub.com\u002Fkongnakornna\u002Fgolangapi\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fgo-agent-skills\u002Fskills\u002F(safety)\u002Fgo-defensive-coding\u002Freferences\u002Fnumeric-safety.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",[],[]]