golang-safety
Skill5 starsChanged 48 days agoMITView on GitHub
use this when writing or reviewing Go for nil panics, typed-nil interfaces, append backing-array aliasing, silent integer truncation, float ==, defer-in-loops, defensive copies, or zero-value design — not concurrency primitives, not attacker vulns, not debugging an already-failing program.
14 other projects use a version of this.
Adopted by
Most recently taken up by
- aiproxer/aiproxertheir own version, first seen Nov 8, 2026
- TeddyAlbina/skillstheir own version, first seen Nov 1, 2026
- samber/cc-skills-golangtheir own version, first seen Nov 1, 2026
- poizoncoded/skillstheir own version, first seen Nov 1, 2026
- klawisha012/agentsynctheir own version, first seen Oct 25, 2026
- rockcookies/skillstheir own version, first seen Oct 13, 2026
Used with
Projects with it also use golang-continuous-integration, golang-pkg-go-dev and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
guynhsichngeodiecSkillgolang-continuous-integration
Provides CI/CD pipeline configuration using GitHub Actions for Golang projects. Covers testing, linting, SAST, security scanning, code coverage, Dependabot, Renovate, GoReleaser, code review automation, and release pipelines. Use this whenever setting up CI for a Go project, configuring workflows, adding linters or security scanners, setting up Dependabot or Renovate, automating releases, or improving an existing CI pipeline. Also use when the user wants to add quality gates to their Go project.
Also in 12 projects that use this
rockcookiesSkillgolang-pkg-go-dev
Golang package and module documentation and exploration via `godig`, a pkg.go.dev API client (CLI + MCP server) — package docs, API references, symbols, code examples, available versions, importers (who imports a package), licenses, and known vulnerabilities. Read-only, no auth. Use for looking up any Go/Golang library's documentation, API signatures, usage examples, which versions exist, whether a dependency has CVEs, or who imports a package — prefer this over Context7 for any Go package or module. Triggers on: how to use a Go library, Go API docs, import usage, code examples, pkg.go.dev. Not for upgrading dependencies (→ See `golang-dependency-management` skill) or choosing a library (→ See `golang-popular-libraries` skill). Not for local symbols, or for navigating an already-used dependency's resolved source, call sites, or generic instantiations — → See `golang-gopls` skill for those.
Also in 6 projects that use this
guynhsichngeodiecSkillgolang-samber-ro
Reactive streams and event-driven programming in Golang using samber/ro — ReactiveX implementation with 150+ type-safe operators, cold/hot observables, 5 subject types (Publish, Behavior, Replay, Async, Unicast), declarative pipelines via Pipe, 40+ plugins (HTTP, cron, fsnotify, JSON, logging), automatic backpressure, error propagation, and Go context integration. Apply when using or adopting samber/ro, when the codebase imports github.com/samber/ro, or when building asynchronous event-driven pipelines, real-time data processing, streams, or reactive architectures in Go. Not for finite slice transforms (-> See golang-samber-lo skill).
Also in 10 projects that use this
- +9 more from guynhsichngeodiec
Other versions14 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 14
- samber/cc-skills-golang★ 3.8ksame name
- aiproxer/aiproxer★ 22same name
- klawisha012/agentsync★ 18same name
- alexastrum/skl★ 11same name
- tstapler/dotfiles★ 8same name
- tquangkhai98/browser-profiles-manager★ 5same name
- poizoncoded/skills★ 2same name
- TeddyAlbina/skills★ 2same name
- rockcookies/skills★ 1same name
- VerifiedOrganic/onboard★ 1same name
4 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- maintainers/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- buying-researcherSkill
- cursor-cloud-agents-whenSkill
- debug-anthropicSkill
- debug-pocockSkill
- debugSkill
- discover-the-ideaSkill
- docs-google-styleSkill
- golang-securitySkill
- golang-testingSkill
- grok-acpSkill
- host-config-pyinfraSkill
- lang-cppSkill
- lang-csharpSkill
- lang-cSkill
- lang-dartSkill
- lang-dockerSkill
- lang-goSkill
- lang-javaSkill
- lang-js-tsSkill
- lang-kotlinSkill
- lang-luaSkill
- lang-makefileSkill
- lang-phpSkill
- lang-powershellSkill
- lang-protobufSkill
- lang-pythonSkill
- lang-rubySkill
- lang-rustSkill
- lang-shellSkill
- lang-sqlSkill
- lang-swiftSkill
- lang-terraformSkill
- language-routerSkill
- lang-web-markupSkill
- modern-pythonSkill
- pr-reviewSkill
- sdlc-artifactsSkill
- sdlc-onboardingSkill
- security-hardeningSkill
- shell-safetySkill
- tddSkill
- tracker-sdlcSkill
- ui-craftSkill
- ux-designSkill
- verify-before-doneSkill
- yagniSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 14 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 26
Do not merge golang-testing, golang-security and golang-safety into one body.
- Distinctive: line 58
Do not self-except. Record the decision.
- Distinctive: line 168
Stop. Initialize, bound-check, or copy.
“Common” is measured: kept by at least 6 in 10 of the 14 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Go safety
Rewrite of samber/cc-skills-golang golang-safety @ 22c58a55. Not a vendor paste. Not an npx / marketplace pack. SKILL.md only — no evals/, no scripts/, no references/. Id: golang-safety.
security CLEAR (conditional): SKILL only. Safety is our bugs.
Iron law
No untested assumption about nil, capacity, or numeric range ships.
Did not initialize it, bound-check it, or copy it? Treat it as a latent panic or a silent wrap.
Scope
| This skill | Not this skill |
| Panics and silent corruption in ordinary Go | Concurrent maps, channels, goroutine leaks |
| Nil, slices/maps, numbers, defer, zero values | Injection, crypto, secrets, path traversal → golang-security / security-hardening |
| Stopping the next crash | Debugging a crash already in hand |
Do not merge golang-testing, golang-security and golang-safety into one body. Which Go skill loads, and what loads with it: language-router.
Always
| Rule | Why |
Comma-ok assert: v, ok := x.(T) | Bare x.(T) panics on mismatch |
Return untyped nil for a nil interface | A typed-nil pointer inside an interface is != nil |
make (or lazy-init) maps before write | Nil map read is fine; write panics |
Full-slice or slices.Clone before append when the original must stay intact | append reuses leftover cap and aliases the array |
| Return copies of exported slices/maps | Callers otherwise mutate internals |
Extract the loop body so defer runs per item | defer fires at function exit, not at the iteration |
| Bound-check before narrowing ints | int64→int32 wraps with no error |
Epsilon (or math/big) for floats | 0.1+0.2 == 0.3 is false |
| Guard integer division by zero | Integer / 0 panics; float / 0 is Inf/NaN |
Usable zero value; sync.Once if lazy-init can race | var x T must not panic on first use |
Prefer generics over any when the set is known | Compiler, not a runtime panic |
errcheck, forcetypeassert, nilerr, govet, staticcheck | tester static catch |
Go 1.25+ reflection: reflect.TypeAssert[T](v) — not v.Interface().(T).
Ask first
| Topic | Why it is a stop |
| Skipping a bounds check because "the value is small" | Small today; wrap tomorrow |
| Returning an internal slice/map "just this once" | Alias is a contract leak |
| Concurrent map read/write | Wrong skill; needs sync, not a comment |
init() order across files | Unspecified; use a constructor |
| Integer overflow an attacker can drive | golang-security, not a safety nit |
| "Linters will catch it" without a fresh run | tester evidence, not vibes |
Do not self-except. Record the decision.
Never
| Never | Why |
Bare v := x.(T) on a production path | Crash on mismatch |
| Write to a map you did not initialize | Panic |
defer f.Close() inside a loop in the same function | FDs pile up until return |
== on computed floats | Silent wrong branch |
npx skills add / marketplace install of the samber pack | INTAKE: clone, do not install |
Copy evals/, scripts/, or references/ into this skill dir | Conditional CLEAR is SKILL only |
| Treat this skill as a vuln audit | Attackers are golang-security + security |
Traps (compressed)
Typed nil
An interface is nil only when type and value are both nil.
func handler(ok bool) http.Handler {
if !ok {
return nil // return plain nil; a nil *MyHandler in an interface is != nil
}
return &MyHandler{}
}Nil containers
| Index | Write | Len/cap | Range | |
| Map | zero | panic | len 0; no cap | 0 |
| Slice | panic | panic | 0 | 0 |
| Chan | block | block | 0 | block |
func (r *Reg) Put(k string, v int) {
if r.items == nil {
r.items = make(map[string]int)
}
r.items[k] = v
}Append alias
// may share a's array — writes to out can mutate a
out := append(a, x)
// keep a stable: cap==len forces a new array
out := append(a[:len(a):len(a)], x)Narrowing
if n < math.MinInt32 || n > math.MaxInt32 {
return 0, fmt.Errorf("int32 overflow: %d", n)
}Defer per item
for _, path := range paths {
if err := one(path); err != nil {
return err
}
}
func one(path string) error {
f, err := os.Open(path)
if err != nil {
return err
}
defer f.Close()
return use(f)
}Zero value
sync.Mutex and bytes.Buffer work at zero. A struct whose first write is m[k]=v on a nil map field does not. Lazy-init the map. If two goroutines can hit that init, sync.Once — do not invent a concurrency protocol in this skill.
Exported accessors that hand back []T or map[K]V return slices.Clone / maps.Clone, not the live field.
Roles
| Role | Owns | Does not own |
| builder | Applying this gate when writing or reviewing Go | Installing the samber pack beside these ids |
| security | Intake CLEAR; overflow-as-vuln → security skills | Day-to-day nil coaching |
| tester | gofmt / staticcheck / errcheck hooks | Claiming DoD from fmt-only green |
| manager | After-act | Blessing a panic class that skipped the gate |
Workers do not bypass intake. A green gofmt is not a security clear.
Red flags
- "It's never nil in practice"
- "append always copies"
- "I'll close everything at function exit"
- "int conversion is fine, the number is small"
- "npx the samber golang pack"
- "Safety and security are the same skill"
- "Copy the evals so we can score it"
Stop. Initialize, bound-check, or copy. Or ask.
Upstream pin
Intent: samber/cc-skills-golang golang-safety @ 22c58a55a0a799b901aa251172923180bad9e010. Body is a rewrite. See SOURCES.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

