golang-safety Skill (samber): What It Does and How to Install It
Makes Claude write and review Go code that avoids nil panics, slice aliasing, silent integer truncation, float comparison bugs and leaked resources.
- Installs
- 41.5K
- on skills.sh
- Stars
- 3.7K
- on GitHub
- Files
- 3
- besides SKILL.md
- Updated
- Nov 2026
- last repo commit
golang-safety makes Claude code defensively against its own mistakes. Its eleven rules cover nil interfaces, nil maps, append aliasing, defensive copies, defer in loops, integer truncation, float comparison and zero-value design. SKILL.md separates it from exploitable bugs, which go to golang-security, and from concurrent access, which goes to golang-concurrency.
Good for
- Go developers whose program panics on a nil map or nil pointer
- Reviewers checking nil safety, numeric conversions and resource lifecycles
- Claude Code and Codex users on Go projects
Install golang-safety
Claude Code
- 1
Copy this prompt.
Install the golang-safety skill in Claude Code. Run this command: /plugin marketplace add samber/cc /plugin install cc-skills-golang@samber Then check that it loaded and tell me how to use it.
- 2
Paste it into Claude Code. It shows the change and asks before running it.
The README says these skills are built as atomic, cross-referencing units, and that installing only a subset gives a partial and potentially inconsistent view of the guidelines. It recommends installing all the general-purpose skills together, which the plugin does. Its manifest lists no hooks or MCP servers, and the repo holds 46 skills. Use the skills CLI line only if you want just this one. Pick one route, not both.
From the project README. Source.
What's in the skill
When it loads
Defensive Golang coding against accidental bugs — nil panics, typed-nil interfaces, `append` backing-array aliasing, silent int64-to-int32 truncation, float `==` comparison, `defer` inside loops, defensive copies of slices and maps, and usable zero values. Use when a Go program panics on a nil map write or nil pointer dereference, when reviewing code for nil-safety, numeric conversion overflow, or resource lifecycle, or when designing a type whose zero value must be safe. Not for designing concurrent access with goroutines, channels, or sync primitives (→ See `samber/cc-skills-golang@golang-concurrency` skill), not for exploitable vulnerabilities such as injection, weak crypto, or leaked secrets (→ See `samber/cc-skills-golang@golang-security` skill), and not for debugging an already-failing program (→ See `samber/cc-skills-golang@golang-troubleshooting` skill).
Sections in SKILL.md
- Best Practices Summary
- Nil Safety
- The nil interface trap
- Nil map, slice, and channel behavior
- Slice & Map Safety
- Slice aliasing — the append trap
- Map concurrent access
- Numeric Safety
- Implicit type conversions truncate silently
- Float comparison
- Division by zero
- Resource Safety
- defer in loops — resource accumulation
- Goroutine leaks
- Immutability & Defensive Copying
- Protecting struct internals
Key facts
- Author
- samber
- Repository
- samber/cc-skills-golang
- License
- MIT
- Skill version
- 1.3.2
- Installs on skills.sh
- 41,464 (Nov 2, 2026)
- GitHub stars
- 3,749 (Nov 2, 2026)
- skills.sh audits
- Gen Agent Trust Hub pass, Socket pass, Snyk pass (Nov 2, 2026)
- Last repo commit
- Nov 1, 2026
What it includes
Eleven rules, from safe type assertions to using sync.Once for lazy initialization
Best Practices SummaryCovers the typed-nil interface trap and what nil maps, slices and channels do
Nil SafetyExplains append aliasing and the full slice expression that forces a copy
Slice & Map SafetyBounds checks for int64 to int32, epsilon float comparison, zero checks before dividing
Numeric SafetyMoves a defer out of a loop body into its own function
Resource SafetyReturns copies of slices and maps from exported functions
Immutability & Defensive CopyingDesigns zero values that are safe, uses sync.Once and warns about init()
Initialization SafetyAn 11-row table of mistakes and fixes
Common MistakesTwo reference guides: nil safety, and slice and map safety
Deep dives
From the official docs
Permissions
Low risk
It lets Claude edit your Go files and run go, golangci-lint and git commands in your project.
What it can do
- Read your data
- Create and change things
- Delete things
- Read-only mode
Watch out for
It edits Go files and runs go and git commands
The frontmatter allows Edit, Write and Bash for go, golangci-lint and git. Work on a branch and read the diff before you commit.
Security advisories
No published security advisories as of Nov 2, 2026.
Technical details
| Turning on read-only | No read-only setting is documented in SKILL.md. |
|---|---|
| Talks to | Your AI provider receives the Go code and command output Claude reads |
| Sign-in and keys | SKILL.md names no account or API key. |
| Scopes |
|
Questions
How do I install golang-safety?
Use the install box above. The plugin route installs the whole Go skill set (46 skills in the repo), and the skills CLI route installs only this skill. Pick one so you do not get every skill twice. The README says these skills cross-reference each other and installing a subset gives a partial view.
Does golang-safety work in the Claude app?
The README documents no Claude app install, so the Claude tab in the install box is our generic zip-upload route, not a documented one. The skill reads and edits Go files and runs go commands on your machine, so Claude Code or Codex is the better fit.
Does golang-safety need an API key?
SKILL.md names no API key or account. It does need Go installed on your machine.
Is golang-safety safe to run?
It edits your Go files and runs go, golangci-lint and git commands in your project, so work on a branch and read the diff before you commit. The skill bundles no scripts: its other files are reference guides and an evals/evals.json file.
How is golang-safety different from golang-security?
SKILL.md says safety handles programmer mistakes in normal code, while security handles attackers. Injection, weak crypto and leaked secrets are sent to golang-security, and concurrent access is sent to golang-concurrency.
Does it help debug a program that already panics?
Partly. It lists nil map writes and nil pointer dereferences as triggers, but SKILL.md says it is not for debugging an already-failing program and points to golang-troubleshooting for that.
Information
updated Nov 2, 2026
- Repository
- samber/cc-skills-golang
- Folder
skills/golang-safety
Sources
Docs, issue trackers and discussions this page is built from.
Show all 7Hide
- cc-skills-golang · github.com
- cc-skills-golang README · github.com
- plugin.json · github.com
- skills CLI commands · github.com
- README.md#-how-to-use · github.com
- golang-safety SKILL.md · github.com
- golang-safety on skills.sh · skills.sh