# Contracts Package AI Agent Instructions (`packages/contracts`) > **Package:** `@keluargamart/contracts` > **Role:** Canonical API Route Registry & Shared DTO Types derived from OpenAPI --- ## 1. Responsibilities - Holds the exact list of 368 verified backend routes (`src/routes.txt` & `src/routes.js`). - Provides TypeScript declaration (`src/routes.d.ts`) for IDE autocompletion. - Exports `BACKEND_ROUTES`, `BACKEND_ROUTE_SET`, `hasBackendRoute(method, path)`, and `isValidRoute(path)`. --- ## 2. Modification Rules 1. **Source of Truth**: When an endpoint is added, removed, or changed, it MUST first be reflected in `apps/backend/docs/openapi.yaml`. 2. **Synchronize Package**: Add the new canonical route to `src/routes.txt` and `src/routes.js`. 3. **Verify Zero Drift**: Run `pnpm drift:check` from root. 4. **Run Package Tests**: `pnpm --filter @keluargamart/contracts test`.