PlugWiki

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

  1. Best Practices Summary
  2. Nil Safety
  3. The nil interface trap
  4. Nil map, slice, and channel behavior
  5. Slice & Map Safety
  6. Slice aliasing — the append trap
  7. Map concurrent access
  8. Numeric Safety
  9. Implicit type conversions truncate silently
  10. Float comparison
  11. Division by zero
  12. Resource Safety
  13. defer in loops — resource accumulation
  14. Goroutine leaks
  15. Immutability & Defensive Copying
  16. Protecting struct internals

Key facts

Author
samber
License
MIT
Skill version
1.3.2
Installs on skills.sh
41,464 (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 Summary

  • Covers the typed-nil interface trap and what nil maps, slices and channels do

    Nil Safety

  • Explains append aliasing and the full slice expression that forces a copy

    Slice & Map Safety

  • Bounds checks for int64 to int32, epsilon float comparison, zero checks before dividing

    Numeric Safety

  • Moves a defer out of a loop body into its own function

    Resource Safety

  • Returns copies of slices and maps from exported functions

    Immutability & Defensive Copying

  • Designs zero values that are safe, uses sync.Once and warns about init()

    Initialization Safety

  • An 11-row table of mistakes and fixes

    Common Mistakes

  • Two 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-onlyNo read-only setting is documented in SKILL.md.
Talks toYour AI provider receives the Go code and command output Claude reads
Sign-in and keysSKILL.md names no account or API key.
Scopes
  • Claude edits Go files in your project

  • Claude runs go, golangci-lint and git commands

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

Folder
skills/golang-safety

samber/cc-skills-golangskills.sh

Sources

Docs, issue trackers and discussions this page is built from.

Show all 7
  1. cc-skills-golang · github.com
  2. cc-skills-golang README · github.com
  3. plugin.json · github.com
  4. skills CLI commands · github.com
  5. README.md#-how-to-use · github.com
  6. golang-safety SKILL.md · github.com
  7. golang-safety on skills.sh · skills.sh

Updated Nov 2, 2026.