golang-safety

Analyze Go files for common errors and safety issues.

Updated May 19, 2026
One-click install
npx skills add https://github.com/monforje/.opencode --skill golang-safety-monforje
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-safety
Source: https://github.com/monforje/.opencode/tree/main/skills/cc-skills-golang/skills/golang-safety
Command: npx skills add https://github.com/monforje/.opencode --skill golang-safety-monforje

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill helps identify and mitigate common Go programming errors, ensuring your code is robust and free from common pitfalls.

Core Features & Use Cases

  • Nil Safety: Prevents panics related to nil pointers and interfaces.
  • Slice and Map Safety: Mitigates issues with slice aliasing, map concurrent access, and improper type conversions.
  • Numeric Safety: Ensures correct handling of integer and float operations.
  • Resource Safety: Proper management of resources like goroutines and defer.
  • Immutability & Defensive Copying: Promotes best practices for protecting data integrity.
  • Initialization Safety: Guides proper initialization of types and lazy initialization.
  • Use Case: Use this Skill during code reviews or as part of your development workflow to identify and fix potential issues in Go code.

Quick Start

Run the skill with the command 'golang-safety analyze <your-go-file.go>'.

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 panics in Go code?

To prevent nil pointer panics in Go code, apply nil safety best practices that ensure proper nil handling for pointers and interfaces before access. This Skill identifies potential nil-related panics and provides defensive coding patterns to mitigate them during development.

What is the best way to avoid concurrent map access issues in Go?

The best way to avoid concurrent map access issues in Go is to implement map safety techniques that mitigate concurrent access risks. This Skill identifies improper map usage and slice aliasing, ensuring proper synchronization and type conversions to prevent runtime crashes.

How do I check my Go project for resource management leaks with goroutines?

To check for resource management leaks with goroutines, analyze your Go files to ensure proper synchronization and defer usage. This Skill evaluates resource safety by identifying orphaned goroutines and unclosed resources, guiding you toward robust cleanup patterns.

Does this Go safety analysis require golangci-lint to run?

Yes, this Go safety analysis requires both the Go runtime and golangci-lint to function properly. The Skill leverages these dependencies to identify common programming errors and enforce defensive coding standards across your application codebase.

How do I analyze a Go file for numeric and slice safety errors?

To analyze a Go file for numeric and slice safety errors, run the analysis command targeting your specific source file. The Skill scans for improper integer and float operations alongside slice aliasing, providing best practices to correct them.

Why does my Go code panic when initializing slices and maps?

Your Go code panics when initializing slices and maps due to improper initialization techniques or nil dereferencing. This Skill addresses initialization safety by guiding proper type setup and lazy initialization to prevent runtime panics and protect data integrity.