golang-safety

Detect Go runtime panics and silent data corruption risks.

1|Updated Apr 4, 2026
One-click install
npx skills add https://github.com/Jylhis/claude-marketplace --skill golang-safety-jylhis
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-safety
Source: https://github.com/Jylhis/claude-marketplace/tree/main/plugins/golang-dev/skills/golang-safety
Command: npx skills add https://github.com/Jylhis/claude-marketplace --skill golang-safety-jylhis

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Go programs frequently encounter runtime panics and silent bugs caused by nil pointers, uninitialized maps or slices, slice aliasing, concurrent map access, unchecked numeric conversions, and improper use of defer. These issues lead to crashes, data loss, and hard‑to‑debug behavior.

Core Features & Use Cases

  • Provides guidelines to avoid nil pointer dereferences and initialize maps and slices safely.
  • Shows how to prevent slice aliasing and map concurrent access by copying or synchronizing.
  • Explains safe numeric conversions and proper float comparisons with epsilon.
  • Offers patterns for resource management such as correct defer usage and goroutine leak prevention.
  • Ideal for code reviews, static analysis, and writing robust Go libraries.

Quick Start

Ask the golang-safety skill to review your Go code for nil and slice safety issues.

Frequently Asked Questions about golang-safety

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent nil pointer dereferences and runtime panics in Go?

To prevent nil pointer dereferences in Go, apply defensive coding patterns by checking pointers before access and safely initializing maps and slices. This prevents common runtime panics and silent data corruption.

What's the best way to avoid slice aliasing and concurrent map access bugs?

Avoid slice aliasing and concurrent map access bugs by copying slices when necessary and synchronizing map access. These defensive patterns prevent silent data corruption during concurrent operations.

How do I handle numeric conversions and float comparisons safely in Go?

Handle numeric conversions safely by checking bounds before casting, and perform float comparisons using an epsilon value. This prevents overflow and silent equality errors in calculations.

How do I use defer correctly to prevent resource leaks and goroutine leaks?

Use defer correctly for resource management by ensuring proper cleanup execution and implementing patterns to prevent goroutine leaks. This avoids exhausting connections and memory during execution.

Can I use this to review existing Go code for safety issues?

Yes, you can review existing Go code for safety issues by applying these defensive guidelines during code reviews and static analysis. It is ideal for auditing libraries for nil, slice, and map safety.