golang-patterns

Provide idiomatic Go patterns for error handling, concurrency, and package design.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/Maelwalser/claude-config --skill golang-patterns-maelwalser
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-patterns
Source: https://github.com/Maelwalser/claude-config/tree/main/skills/golang-patterns
Command: npx skills add https://github.com/Maelwalser/claude-config --skill golang-patterns-maelwalser

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides concise, idiomatic Go patterns and conventions to reduce bugs, improve readability, and make Go projects easier to maintain by standardizing error handling, concurrency, and package organization.

Core Features & Use Cases

  • Error handling & wrapping: clear examples for wrapping, custom error types, and usage of errors.Is / errors.As to make failures observable and debuggable.
  • Concurrency and resource safety: worker pools, context cancellation, errgroup patterns, and guidance to avoid goroutine leaks.
  • Package design & performance: advice on small focused interfaces, zero-value friendly types, embedding, slice preallocation, and integration with Go tooling for consistent builds and linting.
  • Use Cases: review code for idiomatic errors and concurrency, design package boundaries for a new service, or refactor hot paths for performance and clarity.

Quick Start

Ask the skill to review a Go function or package for idiomatic patterns, error handling, concurrency safety, and recommended tooling steps.

Frequently Asked Questions about golang-patterns

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

FAQPage Schema
How do I handle errors in Go using wrapping and errors.Is?

Go error handling uses wrapping to add context to failures while preserving the original error. You can check specific errors using errors.Is and errors.As to make failures observable and debuggable in your Go projects.

What's the best way to prevent goroutine leaks in Go concurrency?

Preventing goroutine leaks in Go concurrency requires using context cancellation and errgroup patterns. Proper worker pool implementation ensures safe resource management and stops goroutines when operations complete or fail.

How do I design small focused interfaces for a Go package?

Designing small focused interfaces in Go involves defining minimal method sets tailored to consumers. This approach improves package design, simplifies testing, and keeps your Go services maintainable and idiomatic.

How do I refactor Go code to be compatible with golangci-lint?

Refactoring Go code for golangci-lint compatibility involves applying idiomatic patterns like zero-value friendly types and slice preallocation. Standardizing package structure and error handling ensures consistent builds and linting.

Can I use this to review Go code for idiomatic patterns and performance?

Yes, you can review Go code for idiomatic patterns and performance. It analyzes functions and packages for safe concurrency, clear error wrapping, and optimized hot paths to improve readability and maintainability.