home / skills / linehaul-ai / linehaulai-claude-marketplace / effective-go
This skill helps you write idiomatic, clean Go code by applying Effective Go practices across writing, review, and refactoring.
npx playbooks add skill linehaul-ai/linehaulai-claude-marketplace --skill effective-goReview the files below or copy the command above to add this skill to your agents.
---
name: effective-go
description: "Apply Go best practices, idioms, and conventions from golang.org/doc/effective_go. Use when writing, reviewing, or refactoring Go code to ensure idiomatic, clean, and efficient implementations."
keywords: [go, best-practices, coding-standards, idioms]
disable-model-invocation: false
user-invocable: true
---
# Effective Go
Apply best practices and conventions from the official [Effective Go guide](https://go.dev/doc/effective_go) to write clean, idiomatic Go code.
## When to Apply
Use this skill automatically when:
- Writing new Go code
- Reviewing Go code
- Refactoring existing Go implementations
## Key Reminders
Follow the conventions and patterns documented at https://go.dev/doc/effective_go, with particular attention to:
- **Formatting**: Always use `gofmt` - this is non-negotiable
- **Naming**: No underscores, use MixedCaps for exported names, mixedCaps for unexported
- **Error handling**: Always check errors; return them, don't panic
- **Concurrency**: Share memory by communicating (use channels)
- **Interfaces**: Keep small (1-3 methods ideal); accept interfaces, return concrete types
- **Documentation**: Document all exported symbols, starting with the symbol name
## References
- Official Guide: https://go.dev/doc/effective_go
- Code Review Comments: https://go.dev/wiki/CodeReviewComments
- Standard Library: Use as reference for idiomatic patterns
- **Error Handling Reference**: See `references/error-handling.md` for comprehensive error handling patterns (wrapping, sentinel errors, custom types, testing)
This skill applies Go best practices, idioms, and conventions from the Effective Go guide to help you write, review, and refactor Go code. It focuses on idiomatic style, correct error handling, clear naming, and concurrency patterns to produce readable, maintainable code. Use it to enforce consistency with the Go ecosystem and standard library practices.
The skill inspects Go source for common issues: formatting, naming, exported symbol documentation, interface design, error handling, and concurrency patterns. It recommends fixes—e.g., run gofmt, rename identifiers to MixedCaps, document exported functions, simplify interfaces, and prefer channel-based coordination when appropriate. It also points to standard library examples and Effective Go guidance for subtle cases.
Should I always avoid panic in Go?
Prefer returning errors in library code. Use panic for unrecoverable situations or when writing tests. Document behavior clearly if a function may panic.
When should I introduce an interface?
Introduce an interface when multiple implementations are expected or to simplify testing. Keep interfaces small and focused; prefer defining them at call sites when practical.