What problem does it solve?
This skill prevents common defensive Go mistakes that lead to panics and subtle correctness failures by enforcing safe patterns around nil handling, slices/maps, numeric conversions, floating-point comparisons, and resource lifecycles.
Core Features & Use Cases
- Nil-safety for interfaces, errors, functions, and receivers: avoid typed-nil traps, nil func calls, and nil pointer receiver dereferences.
- Slice and map safety: prevent nil map writes, concurrent map access issues, append aliasing/caller slice corruption, and subslice backing-array retention.
- Numeric and float correctness: stop silent truncation during integer narrowing and use epsilon-based comparisons instead of float equality.
- Resource and immutability hygiene: ensure per-iteration defer semantics, close response bodies promptly, and return defensive copies from getters.
- Use cases: code review or agent-generated implementations for Go services, libraries, and integrations where correctness under edge cases matters (APIs, protocol packing, caching, parsing, and concurrent components).
Quick Start
Ask an AI agent to review the following Go function for nil-safety, slice/map aliasing risks, numeric conversion overflow, float comparison correctness, and proper defer/close behavior, then return concrete fixes with explanations.