beta

Go API Development — Advanced CLAUDE.md

Rules

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

2103/26/2026
markdown1 file
CLAUDE.md652 B

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