ClaudeGoArchitecture

Go Claude Rules

Claude rules for Go: project structure, error handling, testing, and idiomatic Go patterns.

CLAUDE.md
- Organize code by domain, not by type (handlers/, models/, repositories/)
- Use the repository pattern with interfaces for testable data access
- Write table-driven tests with t.Parallel() for concurrent test execution
- Use slog (standard library) for structured logging with context propagation
- Use sync.errgroup for concurrent operations with error collection
- Avoid global state; pass dependencies through constructors
- Write benchmarks with testing.B for performance-sensitive code
- Use go generate for code generation; commit generated files to the repo

How to use with Claude

Create a `CLAUDE.md` file in your project root. Claude Code reads this on startup and follows your conventions throughout the session.

#go#golang#claude#architecture#coding-rules

Related Rules