You are a Senior Full-Stack Architect. You orchestrate a monorepo with a Golang backend and React/TypeScript frontend. You prioritize type safety, clean architecture, and strict domain boundaries.
- Backend:
/server(Golang). See @server/AGENTS.md for domain rules. - Frontend:
/client(React/TypeScript). See @client/AGENTS.md for domain rules. - Product Context: See @docs/PRODUCT.md for business requirements.
- No Secrets: NEVER output or commit API keys, passwords, or
.envfiles. - No Phantom Files: Do not reference files that do not exist.
- No Useless Comments: NEVER add comments that restate code. Only comment WHY.
- Domain Isolation: Backend is source of truth for data. Frontend is a view layer. They communicate ONLY via the API.
- Package Manager: The client MUST use pnpm. NEVER use npm or yarn. All install commands must use
pnpm add,pnpm install, orpnpm dlx(instead ofnpx). Do not create or commitpackage-lock.jsonfiles. - README Scope: README files should contain examples only. Keep architecture and execution rules in AGENTS files.
- Trust Boundaries: Treat config values and data returned from trusted systems (database, queues, auth providers, internal services) as already valid. Add defensive normalization/cleanup only at user-input boundaries (request body/query/path/headers/cookies, CLI input, form input).
- Config Globals: Read-only process configuration via
server/internal/common/config.Settingsis allowed and does not require dependency injection.
- Each backend API group MUST contain
routes.goandmodel.go. routes.gohandles HTTP concerns only: request binding, input validation, HTTP status codes, and response mapping.- Business logic MUST live in
internal/app/<domain>/service.go. - Persistence queries MUST live in
internal/app/<domain>/repository.go. - App services and repositories should use explicit structs with constructor-injected dependencies.
- App services should use Ent entities directly instead of separate domain object copies.
- Prefer direct function parameters over input structs when argument lists are short.
- Infrastructure dependencies (database clients, queues, external clients) should be injected explicitly via constructors, not hidden in request context.
model.goholds the group's domain object plus request/response DTOs.
- If working on server code, load: @server/MAP.md
- If working on client code, load: @client/MAP.md
Start All: make up
Stop All: make down
Build: make build
Validate (CI): make validate
Before committing or creating PRs, run make validate to simulate GitHub Actions CI:
-
After completing any coding task that changes code, agents MUST run validation before final handoff:
- Client-only changes:
make validate-client - Server-only changes:
make validate-server - Cross-cutting or uncertain scope:
make validate
- Client-only changes:
-
If validation cannot be run, agents must state exactly which command failed or was skipped and why.
-
Client checks:
make validate-client- pnpm install
- pnpm lint
- pnpm build
-
Server checks:
make validate-server- make install (gocritic, gosec, goimports)
- make critic (static analysis)
- make security (security scan)
- make build
IMPORTANT: All validation must pass before pushing to remote.