Agent skill · software engineering · affaan-m

golang-patterns

Idiomatic Go patterns, best practices, and conventions for building robust, efficient, and maintainable Go applications. Use when writing or reviewing Go code and idiomatic structure or conventions are in question.

Why this skill is useful

Provides idiomatic Go patterns and best practices that enhance the AI's ability to generate robust Go code beyond generic knowledge.

What it needs

About 8k tokens when loaded. Last updated 2026-08-06. 238,342 stars on the source repository.

What this skill does

Go Development Patterns Idiomatic Go patterns and best practices for building robust, efficient, and maintainable applications. When to Activate Writing new Go code Reviewing Go code Refactoring existing Go code Designing Go packages/modules Core Principles 1. Simplicity and Clarity Go favors simplicity over cleverness. Code should be obvious and easy to read. 2. Make the Zero Value Useful Design types so their zero value is immediately usable without initialization. 3. Accept Interfaces, Return Structs Functions should accept interface parameters and return concrete types. Error Handling Patterns Error Wrapping with Context Custom Error Types Error Checking with errors.Is and errors.As Never Ignore Errors Concurrency Patterns Worker Pool Context for Cancellation and Timeouts Graceful Shutdown errgroup for Coordinated Goroutines Avoiding Goroutine Leaks Interface Design Small, Focused Interfaces Define Interfaces Where They're Used Optional Behavior with Type Assertions Package Organization Standard Project Layout Package Naming Avoid Package-Level State Struct Design Functional Options Pattern Embedding for Composition Memory and Performance Preallocate Slices When Size is Known Use sync.Pool for Frequent Allocations Never return or retain buf.Bytes() from a pooled buffer past Put: copy it, or let the caller pass in an io.Writer so no copy is needed. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills affaan-m/golang-patterns--9376c7

View the source on GitHub

Browse the @skills marketplace