Skip to content

Latest commit

 

History

History
71 lines (53 loc) · 3.47 KB

File metadata and controls

71 lines (53 loc) · 3.47 KB

AGENTS.md

Identity

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.

Architecture Map

  • 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.

Global Boundaries

  • No Secrets: NEVER output or commit API keys, passwords, or .env files.
  • 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, or pnpm dlx (instead of npx). Do not create or commit package-lock.json files.
  • 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.Settings is allowed and does not require dependency injection.

API Group Convention

  • Each backend API group MUST contain routes.go and model.go.
  • routes.go handles 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.go holds the group's domain object plus request/response DTOs.

Dynamic Context Loading

  • If working on server code, load: @server/MAP.md
  • If working on client code, load: @client/MAP.md

Project Commands

Start All:        make up
Stop All:         make down
Build:            make build
Validate (CI):    make validate

Validation Rules

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
  • 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.