Imported from emorenkov/scorehub (
AGENTS.md). Install upstream withnpx skills add emorenkov/scorehub. Copyright stays with the author.
Repository Guidelines
Project Structure & Module Organization
cmd/<service>contains binaries for the user, event, notification, and email services; keep service-specific wiring here.- Domain logic lives in
pkg/<domain>(e.g.,pkg/user,pkg/common). Reuse shared helpers instead of duplicating code insidecmd. - Infrastructure manifests are in
deploy/(docker-compose.yml,k8s/specs). Database artifacts reside indb/; docs and diagrams live indocs/. - Keep generated protobuf code colocated with their definitions under
pkg/*/proto; re-run generators whenever.protofiles change.
Build, Test, and Development Commands
make buildcompiles all services intobin/; run it before opening a PR.make protoregenerates gRPC stubs viaprotocand the Go plugins—required after editing any proto files.go test ./...executes the full go test suite; pair withGOFLAGS="-count=1"when chasing flaky behavior.docker compose -f deploy/docker-compose.yml up --buildbrings up PostgreSQL, Kafka, and all services locally; stop withdown -v.kubectl apply -k deploy/k8sdeploys to a cluster; keep manifests in sync with Compose to avoid drift.
Coding Style & Naming Conventions
- Target Go 1.25+ and run
go fmt ./...plusgo vet ./...before committing; keep imports organized viagofmt. - Follow idiomatic Go: PascalCase for exported types/functions, camelCase for internals, ALL_CAPS only for actual constants.
- Keep packages single-purpose; prefer
NewXconstructors that accept interfaces where possible. - Configuration structs should live in
pkg/common/config(or closest peer) and load fromlocal.envviacleanenv.
Testing Guidelines
- Place tests alongside code as
*_test.go; use table-driven cases with descriptive names such asTestNotificationBuilder_Congrats. - Aim for meaningful coverage on core flows (event enrichment, Kafka producers/consumers). Validate both happy-path and failure retries.
- Run
go test ./pkg/... ./cmd/...before pushing; attach-racewhen touching concurrency. ¸
Commit & Pull Request Guidelines
- Keep commits focused, with imperative summaries similar to the existing
first commitstyle (“Add notification fan-out”). Reference issues in the body. - Each PR should include: concise description, testing evidence (
make build,go test ./...), and screenshots/log excerpts if the change affects output. - Link related tickets, call out config changes, and request reviews from owners of the touched service directory.
Configuration & Security Tips
- Never commit secrets; load overrides via
local.envand document new variables inREADME.MD. - When adding brokers or databases, update both
deploy/docker-compose.ymlanddeploy/k8s/*.yamlplus any seeding files indb/to keep environments consistent.