golang-patterns

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

Updated Feb 21, 2026
One-click install
npx skills add https://github.com/AndyHsuTW/everything-llm-workspace --skill golang-patterns-andyhsutw
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-patterns
Source: https://github.com/AndyHsuTW/everything-llm-workspace/tree/main/.agents/skills/golang-patterns
Command: npx skills add https://github.com/AndyHsuTW/everything-llm-workspace --skill golang-patterns-andyhsutw

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides comprehensive guidance on idiomatic Go patterns and best practices, helping developers write more robust, efficient, and maintainable Go applications.

Core Features & Use Cases

  • Idiomatic Go Patterns: Covers essential principles like simplicity, zero values, and interface design.
  • Error Handling: Demonstrates best practices for error wrapping, custom errors, and using errors.Is/errors.As.
  • Concurrency: Explains worker pools, context for cancellation, graceful shutdown, and errgroup.
  • Interface Design: Guides on creating small, focused interfaces and defining them where used.
  • Package Organization & Struct Design: Offers best practices for project structure, naming, and the functional options pattern.
  • Memory & Performance: Tips on preallocating slices, using sync.Pool, and avoiding string concatenation in loops.
  • Tooling Integration: Lists essential Go commands and provides a sample linter configuration.
  • Use Case: A developer starting a new Go project can use this Skill to establish a solid foundation for code quality and best practices from the outset.

Quick Start

Review the idiomatic Go patterns for error handling and concurrency.

Frequently Asked Questions about golang-patterns

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

FAQPage Schema
What are the best practices for error handling in Go?

Idiomatic Go error handling involves wrapping errors with context using fmt.Errorf, creating custom error types, and inspecting errors with errors.Is and errors.As to build robust applications.

How do I implement concurrency patterns like worker pools in Go?

Go concurrency patterns utilize worker pools, context for cancellation, graceful shutdown, and errgroup to manage concurrent tasks efficiently and safely without goroutine leaks.

When should I use functional options for struct design in Go?

Functional options are used in Go struct design to provide a clean, flexible API for configuring complex objects with default values without needing to pass zero values explicitly.

Does this Skill cover memory optimization techniques for Go applications?

Yes, the Skill covers memory optimization in Go by preallocating slices, utilizing sync.Pool for object reuse, and avoiding string concatenation inside loops to reduce allocations.

How do I organize packages and design interfaces in Go?

Idiomatic Go package organization involves structuring projects logically, while interface design focuses on defining small, focused interfaces where they are consumed rather than where they are implemented.

What Go tooling and linter configurations are recommended for best practices?

The Skill provides essential Go commands and sample linter configurations to integrate tooling into your workflow, ensuring code quality and adherence to idiomatic patterns automatically.