agentic-react-express-ts
AGENTS.md0 starsChanged 6 months agoMITView on GitHub
Canonical guide for AI coding agents (Claude Code, Codex, Cursor, Aider, GitHub Copilot, Gemini CLI) working in this repo. CLAUDE.md, GEMINI.md, and .github/copilot-instructions.md all point here. agentic-react-express-ts is a production-ready full-stack TypeScript template designed for the agentic era. It's meant to be: Keep this template simple, clean, and well-documented. When in doubt: fewer features, clearer code. Boundary rules (enforced by ESLint no-restricted-imports): Why: this is how the template makes the server bundle small and prevents secrets/business-logic leaks into the client.
- Reads credentials
- Installs packages
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository7 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- add-resourceSkill
- deploy-checklistSkill
- onboard-an-agentSkill
- remove-demo-codeSkill
- self-correcting-loopSkill
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Keep this template simple, clean, and well-documented.
- Very specific: line 82
No
any: Use unknown and narrow. - Very specific: line 99
Never modify a test to make it pass: If a test fails, the code is wrong.
- Very specific: line 113
Never use
--no-verify: If pre-commit hooks fail, read the errors and fix them.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
Canonical guide for AI coding agents (Claude Code, Codex, Cursor, Aider, GitHub Copilot, Gemini CLI) working in this repo.
CLAUDE.md,GEMINI.md, and.github/copilot-instructions.mdall point here.
Mission
agentic-react-express-ts is a production-ready full-stack TypeScript template designed for the agentic era. It's meant to be:
- Type-safe end-to-end — tRPC carries types from server to client; nothing untyped crosses the wire.
- Guardrailed — every commit runs ESLint + TypeScript + Prettier + Knip + Vitest + Gitleaks + Commitlint in parallel (~3s). Failed commits are rejected. See
skills/self-correcting-loop/SKILL.md. - Skill-driven — common workflows (add a resource, remove the demo, deploy) live as
skills/<name>/SKILL.mdfiles you can read step-by-step.
Keep this template simple, clean, and well-documented. When in doubt: fewer features, clearer code.
Stack
| Layer | Tool |
| Language | TypeScript 5.x (strict: true, noUncheckedIndexedAccess) |
| Client | React 19 + Vite 7 + MUI 7 + React Router 7 |
| Server | Express 5 + tRPC 11 (Express adapter) |
| Data | Prisma 7 + PostgreSQL |
| Validation | Zod (via tRPC .input(…)) |
| Forms | React Hook Form + Zod resolver |
| Server state | TanStack Query (via @trpc/react-query) |
| Tests | Vitest 4 + React Testing Library + jsdom |
| Commits | Conventional Commits (commitlint) |
| Pre-commit | Lefthook (parallel) |
Architecture
src/
├── client/ React app (UI only, no business logic)
├── server/ Express + tRPC routers (all I/O and DB access)
└── shared/ Zod schemas + types reused by bothBoundary rules (enforced by ESLint no-restricted-imports):
src/server/**must NOT import fromsrc/client/**.src/client/**must NOT import values fromsrc/server/**. The only allowed cross-tier import isimport type { AppRouter } from '@/server/routers'for tRPC's type inference.src/shared/**is the safe shared zone — both sides may import from it freely.
Why: this is how the template makes the server bundle small and prevents secrets/business-logic leaks into the client.
Setup
nvm use # Node 22
npm install # installs deps + lefthook hooks
cp example.env .env # edit DATABASE_URL
npm run setup # generate Prisma client
npm run db:setup # apply migrations
npm run db:seed # load demo CRM data
npm run dev # client :3000 + server :3001Scripts
| Script | What it does |
npm run dev | Client + server in parallel (concurrently) |
npm run client | Vite dev server (:3000) |
npm run server | Express + tRPC via nodemon + tsx (:3001) |
npm run build | Build client (vite build) and server (tsc) |
npm run typecheck | tsc --noEmit for client and server configs |
npm run lint / lint:fix | ESLint |
npm run lint:unused | Knip — unused exports/deps |
npm run format / format:check | Prettier |
npm run test / test:run / test:coverage | Vitest |
npm run db:setup / db:migrate / db:seed / db:studio / db:reset | Prisma |
Conventions
- ESM only.
import/export, neverrequire. File extensions in imports (.js) — seeverbatimModuleSyntaxsemantics. - Functional components only.
- Custom hooks for data — never call fetch/axios directly in pages; use tRPC hooks (
trpc.contact.list.useQuery()). - MUI for UI —
@mui/materialcomponents,sxprop for one-off styling, theme tokens for everything else. - Server validation — never trust inputs. Every mutation must define
.input(zodSchema). - Errors — throw
TRPCError({ code, message }). Don't return ad-hoc{ success: false }shapes. - No
any. Useunknownand narrow. - Type-only imports.
import type { … }for types. ESLint enforces.
Adding a feature
- Always start by reading
skills/add-resource/SKILL.md— it has the exact, ordered steps for adding a new full-stack CRUD resource. - For one-off changes, mirror an existing resource. The
contactresource is the simplest reference (prisma/schema.prisma→src/shared/schemas/contact.ts→src/server/routers/contact.ts→src/client/pages/ContactsPage.tsx).
Testing
npm test # watch mode
npm run test:run # one-shot (CI)- Client tests use jsdom + RTL. Setup in
src/client/__tests__/setup.ts. - Server tests use tRPC
createCallerFactorywith a mocked Prisma client. - Never modify a test to make it pass. If a test fails, the code is wrong. See
skills/self-correcting-loop/SKILL.md.
Commit style
Conventional Commits. <type>(<scope>): <subject>.
feat(contact): add email validation
fix(server): handle empty body in tRPC mutations
chore(deps): bump prisma to 7.4.1Types: feat, fix, refactor, docs, test, chore, style, perf, ci.
Never use --no-verify. If pre-commit hooks fail, read the errors and fix them. The whole point of the guardrails is to catch bad commits before they land.
Skills (read these when relevant)
| Skill | When |
skills/onboard-an-agent/SKILL.md | First time opening this repo |
skills/add-resource/SKILL.md | Adding any new CRUD resource |
skills/self-correcting-loop/SKILL.md | Whenever a commit is rejected |
skills/remove-demo-code/SKILL.md | When stripping the demo for a real project |
skills/deploy-checklist/SKILL.md | Before pushing to a deployed env |
Key files (quick map)
| File | Purpose |
src/server/index.ts | Express boot, helmet, CORS, rate limit, tRPC mount, graceful shutdown |
src/server/routers/index.ts | appRouter — composes contact/task/project routers |
src/server/trpc.ts | initTRPC, publicProcedure, createCallerFactory |
src/server/context.ts | Per-request context (prisma, req, res) |
src/client/main.tsx | React entry — providers, router |
src/client/trpc.tsx | tRPC client + TanStack Query provider |
src/shared/schemas/* | Zod schemas reused on both sides |
prisma/schema.prisma | Database schema |
eslint.config.js | Flat config — strict TS, import order, boundary rules |
lefthook.yml | Pre-commit pipeline |
tsconfig.json / tsconfig.server.json | Client (bundler) vs server (NodeNext) TS configs |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

