CLAUDE.md — Go + Chi Router + PostgreSQL
CLAUDE.md template for Go APIs using Chi, pgx, and idiomatic Go project structure.
claude-mdgochipostgresqlai-config
Prompt
# CLAUDE.md ## Project Overview {{project_name}} — {{one-line description}} ## Tech Stack - Language: Go 1.22+ - Router: chi v5 - Database: PostgreSQL via pgx - Migrations: goose - Testing: standard library + testify - Config: envconfig ## Commands ```bash go run ./cmd/server # Start server go test ./... # Run all tests goose -dir migrations up # Apply migrations golangci-lint run # Lint ``` ## Directory Structure ``` cmd/ └── server/main.go # Entrypoint internal/ ├── api/ # HTTP handlers │ ├── middleware/ # Auth, logging, CORS │ └── handlers/ # Route handlers ├── domain/ # Business logic + types ├── repository/ # Database queries └── config/ # Environment config pkg/ # Shared/exported packages migrations/ # SQL migration files ``` ## Conventions - Follow standard Go project layout - Errors are values — return them, don't panic - Use context.Context for cancellation and timeouts - Interfaces defined by consumers, not providers - Table-driven tests with clear subtest names - No init() functions — explicit initialization in main - Use pgx directly, not GORM
Variables to customize
{{project_name}}{{one-line description}}
Why this prompt works
'Use pgx directly, not GORM' is the kind of specific instruction that prevents Claude from defaulting to the most popular library. Opinionated rules produce consistent code.
Save this prompt to your library
Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.
Related prompts
CLAUDE.md — Next.js + TypeScript + Tailwind
Production CLAUDE.md template for Next.js App Router projects with TypeScript strict mode and Tailwind CSS.
CLAUDE.md — Python + FastAPI + SQLAlchemyCLAUDE.md template for async FastAPI projects with SQLAlchemy 2.0, Alembic migrations, and pytest.
CLAUDE.md — React Native + ExpoCLAUDE.md template for React Native Expo projects with file-based routing, NativeWind, and Zustand.
CLAUDE.md — Django + DRF + CeleryCLAUDE.md template for Django REST Framework projects with Celery task queues and split settings.