golang

Guide idiomatic Go code with concurrency patterns and table-driven tests.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides idiomatic Go programming guidance, best practices, and architecture patterns to help engineers write clean, concurrent, and maintainable Go code.

Core Features & Use Cases

  • Go conventions & patterns: Emphasis on concurrency patterns, interface design, error handling, and modular architecture.
  • Code organization & style: Clear file structure and documentation standards for Go projects.
  • Practical examples: Table-driven tests, module setups, and public API design guidance.

Quick Start

Ask Claude to generate a small idiomatic Go module skeleton with a main package and a simple goroutine example.

Frequently Asked Questions about golang

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

FAQPage Schema
How do I write concurrent Go code with goroutines and channels?

Concurrent Go code uses goroutines (lightweight threads) launched with the `go` keyword and channels for safe communication between them. Channels synchronize goroutines, prevent race conditions, and enable idiomatic patterns like worker pools and fan-out/fan-in. This is Go's core concurrency model for building efficient, scalable applications.

What's the best way to handle errors in Go?

Go's idiomatic error handling returns errors as values, checked explicitly with `if err != nil`. This explicit approach differs from exceptions; it makes error paths visible and forces deliberate handling. Wrap errors with context for debugging, and design functions to fail fast and communicate failure clearly.

How do I organize and test Go code idiomatically?

Organize Go projects with clear package structure, table-driven tests (test cases as data slices), and comprehensive test coverage. Use `*testing.T` and subtests for maintainable test suites. Document exported types and functions with comment blocks starting with the name, following Go conventions for discoverability and API clarity.

How do I set up and manage Go modules and dependencies?

Go modules use `go.mod` and `go.sum` files to declare and lock dependencies. Run `go mod init` to create a module, `go get` to add packages, and `go mod tidy` to clean unused ones. Modules ensure reproducible builds and explicit versioning, eliminating dependency conflicts across Go projects.

How do I build HTTP servers and clients with proper context propagation?

Go HTTP servers and clients use `context.Context` to manage request deadlines, cancellation, and values across goroutines. Pass context through request handlers, database calls, and external API calls to enforce timeouts and enable graceful shutdown. Proper context propagation prevents resource leaks and hanging requests.

What makes Go interface design different from other languages?

Go interfaces are implicit and based on method sets, not explicit inheritance. Small, focused interfaces promote composition and loose coupling. Design interfaces around behavior (what a type does), not type hierarchy, enabling flexible, testable code and reducing package dependencies.