Software Development

Go Defensive Coding

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).

Publisher / source
eduardo-sl/go-agent-skills (found on the CSV list)
Upstream record
eduardo-sl/go-agent-skills
Version
Version 2
Published
Publication review
Approved for publication · recorded passed scan 2026-11-02
Content fingerprint
2538375d835d015231ce669b2fc6da8bcff7d79764e72f7cd769fd6c43ecf1ce