2025-11-19 13:07:09 +08:00
|
|
|
# Agent Guidelines for CAATSM
|
2025-11-17 16:25:23 +08:00
|
|
|
|
2025-11-19 13:07:09 +08:00
|
|
|
## Commands
|
|
|
|
|
- **Build**: `make build` (bin/receiver)
|
|
|
|
|
- **Run**: `make run-dev` (dev mode), `make run-prod` (prod mode)
|
|
|
|
|
- **Lint**: `make lint` (golangci-lint)
|
|
|
|
|
- **Test**: `make test` (Unit/Ginkgo), `make test-int` (Integration/Docker)
|
|
|
|
|
- **Single Test**: `ginkgo -r -v --focus "Test Description" ./path/to/package`
|
|
|
|
|
- **Coverage**: `make coverage` (>80% target)
|
2025-11-17 16:25:23 +08:00
|
|
|
|
2025-11-19 13:07:09 +08:00
|
|
|
## Code Style & Architecture
|
|
|
|
|
- **Structure**: Clean Architecture (`cmd/`, `internal/{domain,app,adapter,infra}`, `pkg/`).
|
|
|
|
|
- **Formatting**: Run `go fmt ./...` and `goimports` before committing.
|
|
|
|
|
- **Naming**: `CamelCase` (exported), `camelCase` (private). Package names match dirs.
|
|
|
|
|
- **Errors**: Wrap with context (`fmt.Errorf("...: %w", err)`). Use `errors.Is`.
|
|
|
|
|
- **Types**: Interface-driven development. Avoid `any`.
|
|
|
|
|
- **Testing**: Ginkgo BDD style (`Describe`, `It`). Table-driven. Mock interfaces.
|
|
|
|
|
- **Observability**: Propagate `context.Context`. Use OpenTelemetry (traces/metrics).
|
|
|
|
|
- **Generated**: NEVER edit `wire_gen.go` or `*_gen.go`.
|
2025-11-18 11:47:35 +08:00
|
|
|
|
|
|
|
|
## Cursor Rules (.cursor/rules/do.mdc)
|
2025-11-19 13:07:09 +08:00
|
|
|
- **Expertise**: Go, Microservices, Clean Arch, TDD.
|
|
|
|
|
- **Security**: Input validation, secure defaults, retries/backoff.
|
|
|
|
|
- **Perf**: Benchmarks, minimize allocations.
|