beta

Go API Development — Advanced CLAUDE.md

Rules

Comprehensive agent rules for Go API projects with error handling patterns, testing, and deployment.

2503/26/2026

Version 1

Published

Initial version

Created 3/26/2026

Initial version — no previous version to compare

CLAUDE.md
# CLAUDE.md

## Project Context
Go API service using chi router, sqlc for queries, and Docker for deployment.

## Architecture
- Clean architecture: handlers → services → repositories
- All errors wrap with fmt.Errorf and %w
- Context propagation required on all service methods

## Code Style
- Follow Effective Go and Go Proverbs
- Table-driven tests
- No init() functions
- Exported types need godoc comments

## Testing
- go test ./... before committing
- Integration tests use testcontainers
- Mock external services with interfaces

## Deployment
- Multi-stage Docker builds
- Health check at /healthz
- Graceful shutdown with signal handling