Go defensive coding
Hardens Go code against typed nils, slice aliasing and overflow, so it stops panicking or corrupting data.
Claude's review
8/10 Accurate Go hardening rules with typed nil, aliasing, numeric and defer traps plus tooling and a checklist.
We asked Claude the question you would ask: would I be glad I installed this? We only sell skills it rates 7 or higher.
In detail
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).
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: go-defensive-coding
description: >
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).
user-invocable: true
license: MIT
compatibility: 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.
allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(gofmt:*) Bash(golangci-lint:*) Bash(gosec:*)
metadata:
author: eduardo-sl
version: "1.1.3"
---
# Go Defensive Coding
Go has no exceptions and no null-safety in the type system. Every trap below
compiles cleanly, passes review, and fails in production.
Detailed reference material, loaded on demand:
- `references/nil-and-aliasing.md` — the full typed-nil rules, slice
aliasing scenarios, and memory retention.
- `references/numeric-safety.md` — conversion range checks, overflow
detection, float and time comparison.
- `references/copies-and-lifecycle.md` — `copylocks`/`noCopy`, `defer` in
loops, checking deferred `Close` errors, usable zero values.
Read a reference file only when the section below is not enough.
## Operating Modes
...From eduardo-sl's repository, MIT licence.
Related skills
-
Checked
Kotlin Toolchain CLI
Builds, tests and packages Kotlin projects with the new JetBrains Kotlin Toolchain CLI, formerly called Amper.
7/101 credit -
Checked
Rust best practices
Writes and reviews idiomatic, maintainable Rust code and runs a checklist before handing it back to you.
7/101 credit -
Checked
Port code to Rust
Ports C, C++, Python, Go or JavaScript code into idiomatic Rust, with tests that prove it behaves the same.
9/101 credit -
Checked
Rust code review
Reviews Rust code for idiom, errors, safety and API design, with a ranked report and a fix for every finding.
8/101 credit -
Checked
Java Debugging Guide
Finds the cause of Java bugs and failing tests, and attaches a debugger safely in Maven, Gradle, Spring or Docker.
7/101 credit -
Checked
Multi axis code review
Reviews a diff for correctness, design, tests and security with severity labels, so only solid code merges.
8/101 credit