
Go Defensive
Hardening patterns for Go API boundaries covering copies, defer cleanup, crypto rand, and robustness review.
- skills.sh installs
- 1.3K
- GitHub stars
- 196
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers boundary copying of slices and maps, defer-based cleanup, enum zero values, and avoiding mutable package globals
- Includes reference guides for boundary copying, global state,
Mustfunctions, panic and recover, and time, enum, and tag rules - Enforces
crypto/randfor key generation overmath/rand, and flags missing cleanup or unsafe crypto during reviews - Designed for reviewing Go API code for robustness; error handling strategy is delegated to go-error-handling and interface checks to go-interfaces
Install
$ npx -y skills add cxuu/golang-skills --skill go-defensive -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Go Defensive Programming Patterns
Compatibility: Crypto examples may use
crypto/rand.Text, which requires Go 1.24+.
Resource Routing
references/BOUNDARY-COPYING.md- Read when copying slices/maps across API boundaries.references/GLOBAL-STATE.md- Read when introducing or removing package globals.references/MUST-FUNCTIONS.md- Read when deciding whether a panic-on-error helper is acceptable.references/PANIC-RECOVER.md- Read when evaluating panic, recover, or crash containment.references/TIME-ENUMS-TAGS.md- Read when handling time types, enum zero values, or struct tags.
Defensive Checklist Priority
When hardening code at API boundaries, check in this order:
Details
- Repository
- github.com/cxuu/golang-skills
- Categories
- Go, Security
- First seen
- May 16, 2026
More from cxuu/golang-skills
All 20- Go Packages1.3K
- Go Functional Options1.3K
- Go Data Structures1.3K
- Go Control Flow1.3K
- Go Logging1.1K
- Go Functions1.1K
- Go Generics1.1K
- Go Declarations1.1K
- Go Code Review1.8K
- Go Testing1.4K
- Go Error Handling1.4K
- Go Concurrency1.4K
- Go Linting1.4K
- Go Interfaces1.4K
- Go Documentation1.3K
- Go Style Core1.3K
- Go Performance1.3K
- Go Context1.3K
- Go Naming1.3K
Similar to Go Defensive
More Go
golang-safetysamber/cc-skills-golang42.7K installsDefensive Go coding guidance against nil panics, append aliasing, silent truncation, and defer-in-loop leaks.
go-code-reviewcxuu/golang-skills1.8K installsGo code review checklist covering formatting, errors, naming, concurrency, interfaces, and security checks with tooling.
golang-design-patternssamber/cc-skills-golang44.3K installsIdiomatic Go design patterns covering constructors, error flow, lifecycle, and architecture choices for production code.
go-concurrencycxuu/golang-skills1.4K installsGo concurrency guidance covering goroutine lifetimes, channel-versus-mutex choice, and safe shared state.
golang-projeffallan/claude-skills19.8K installsSenior Go specialist for concurrent systems, microservices, and performance work with pprof-verified optimizations.