Copy this file into the root of your project as AGENTS.md.
AGENTS.md
Project
A client-side admin dashboard. Vite + React 19 + TypeScript. Talks to a REST API. State server-side via TanStack Query, client state via Zustand for cross-cutting concerns (sidebar collapsed, theme). Routing via React Router v6.
Commands
pnpm dev— Vite dev server on http://localhost:5173pnpm build— production build todist/pnpm preview— preview the production build locallypnpm typecheck—tsc --noEmitpnpm lint— ESLintpnpm test— Vitest
Code style
- TypeScript strict. No
any, no non-null assertions outside of test setup. - Components: function declarations, not arrow functions, for top-level component exports.
- File layout: one component per file. Filename matches export.
- Use
cn()fromsrc/lib/utils.tsfor class merging. - Forms via
react-hook-form+zod. No uncontrolled form state.
Stack rules
Data fetching
- All server data through TanStack Query. Never
fetchinside a component directly. - Query keys live in
src/lib/queries/keys.ts— one source of truth. - Mutations invalidate the relevant query keys. Do not refetch manually with
refetch(). - Stale time defaults to 60s. Increase for slow-changing data, never decrease below 10s.
UI
- All primitives (Button, Input, Dialog, Select…) come from
src/components/ui/(shadcn). - Customize via the existing tokens in
tailwind.config.ts. Never hard-code colors. - Tables use
@tanstack/react-tablewith the wrapper insrc/components/table/. - Charts use
recharts. Wrap with<ChartContainer>from shadcn for theming.
Routing
- Routes are declared centrally in
src/routes.tsx. - Use loaders for data that must exist before the route renders.
- Protected routes wrap children in
<RequireAuth />.
Before editing
- Check
src/components/ui/for an existing primitive before building one. - Look at sibling routes in
src/pages/for the project's conventions. - Read the API spec in
openapi.yamlbefore adding a new query.
Constraints
- No Redux, no MobX. Zustand for client-only state.
- No CSS-in-JS. Tailwind only.
- No new icon libraries — use
lucide-react. - No new routing libraries — React Router v6 is fixed.
- Bundle size matters: avoid adding deps over 30 KB gzipped without flagging it.