golang-safety

Analyze Go code for nil safety, concurrency, and resource management issues.

Updated May 30, 2026
One-click install
npx skills add https://github.com/ozan-fn/mqtt-capture --skill golang-safety-ozan-fn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-safety
Source: https://github.com/ozan-fn/mqtt-capture/tree/main/.agents/skills/golang-safety
Command: npx skills add https://github.com/ozan-fn/mqtt-capture --skill golang-safety-ozan-fn

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires go-lint, golangci-lint, git, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps prevent common Go programming pitfalls such as nil panics, silent data corruption, and subtle runtime bugs, ensuring robust and secure code.

Core Features & Use Cases

  • Nil Safety: Identifies and prevents nil-related panics.
  • Slice & Map Safety: Mitigates aliasing and concurrent access issues.
  • Numeric Safety: Ensures correct handling of type conversions and floating-point arithmetic.
  • Resource Safety: Manages resource lifecycle and prevents leaks.
  • Immutability & Defensive Copying: Promotes safe design patterns for struct internals.
  • Initialization Safety: Ensures types are usable at zero value and initializes resources correctly.
  • Use Case: When reviewing or developing Go code, use this Skill to detect and correct common mistakes, enhancing code reliability and maintainability.

Quick Start

Use the golang-safety skill to check your Go code for common pitfalls, such as nil checks, slice aliasing, and map concurrency 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 panics and silent data corruption in Golang?

To prevent nil panics and silent data corruption in Golang, apply defensive coding patterns using static analysis to identify and mitigate nil dereferences before runtime execution.

What's the best way to detect concurrent map access and slice aliasing issues in Go?

The best way to detect concurrent map access and slice aliasing issues in Go is using static analysis tools to review slice and map safety, mitigating subtle runtime bugs during development.

How do I check my Go code for resource leaks and numeric type conversion errors?

Check Go code for resource leaks and numeric type conversion errors by running static analysis that targets resource lifecycle management and validates floating-point arithmetic and type conversions.

Do I need golangci-lint and go-lint installed to analyze Go code for defensive programming?

Yes, you need golangci-lint and go-lint installed to analyze Go code for defensive programming, as the static analysis requires these dependencies to identify common programming mistakes.

When should I use defensive copying and immutability patterns in Go structs?

Use defensive copying and immutability patterns in Go structs when static analysis identifies shared state risks, ensuring safe design patterns for struct internals and preventing silent data corruption.