web-starter
AGENTS.md2 starsChanged 4 months agoMITView on GitHub
Contract for any coding agent working in this repository. Read this before implementing. docs/ARCHITECTURE.md explains why; this file is what you must do. [One paragraph: who the user is, the primary transaction, what success looks like. Full version: docs/PRODUCT.md.] Out of scope right now: [list — this is as important as the scope] 1. The API contract is generated, never hand-written. Pydantic → OpenAPI → frontend/src/generated/api-client/. No hand-written TypeScript DTOs, no raw fetch() for our own API, no Vercel API…
- Reads credentials
- Deletes or force-pushes
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,736 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 repository9 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- api-endpointSkill
- db-migrationSkill
- deploySkill
- featureSkill
- frontend-craftSkill
- frontend-pageSkill
- product-shapingSkill
- reviewSkill
The file
We split this AGENTS.md into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 69
Every protected mutation ships with authorization tests for: no token (401), wrong role (403), wrong owner (403/404), correct (2xx).
- Distinctive: line 86
Responsive is a requirement, not a finish: Every screen must work at 375px and at desktop width.
- Very specific: line 94
./scripts/verify.shmust be green: before a PR, including the API-client drift check. - Distinctive: line 169
Do not mix a toolchain or dependency bump into a feature commit.
- Distinctive: line 192
If you find yourself choosing a value these documents already fix — an upload cap, a page size, a 403-vs-404 policy — you are inventing a …
≈ “Common” is an estimate: at least 1 in 5 of the 16,597 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 — [PRODUCT NAME]
Contract for any coding agent working in this repository. Read this before implementing.
docs/ARCHITECTURE.md explains why; this file is what you must do.
What this product is
[One paragraph: who the user is, the primary transaction, what success looks like.
Full version: docs/PRODUCT.md.]
Out of scope right now: [list — this is as important as the scope]
Architecture
Vercel (static SPA) ──HTTPS/JSON, generated client──▶ Cloud Run (FastAPI)
React + Vite + TS Python 3.13
Tailwind + shadcn/ui Pydantic
React Router SQLAlchemy 2 + Alembic
TanStack Query │
React Hook Form + Zod ┌──────────┴──────────┐
▼ ▼
Neon PostgreSQL Google Cloud Storage
Auth: Firebase (identity) → verified by FastAPIRepository layout
backend/app/api/ thin routes: parse, authorize, delegate, return
backend/app/services/ business logic — the testable seam
backend/app/schemas/ Pydantic; the API contract authority
backend/app/models/ SQLAlchemy (Postgres profile only)
backend/app/auth/ token verification, require_user / require_role
backend/app/errors.py the error envelope
backend/tests/ incl. conftest.py — the four-role clients
frontend/src/api/ query hooks over the generated client
frontend/src/routes/ screens
frontend/src/components/ composed UI; ui/ holds unmodified primitives
frontend/src/generated/ the API client — COMMITTED, never hand-edited
frontend/src/lib/design/ tokens.css — the eight design decisions
frontend/e2e/ Playwright: CORS + 375px gates
scripts/ verify.sh, generate-api-client, check_guardrails.py, seed-demo-data
profiles/sheets/ copied in only on the Sheets persistence profile
.claude/skills/ the procedures Claude follows
docs/ the decisions the rules refer toWhere code belongs
| Concern | Home |
| UI, routing, client state, forms | frontend/ |
| Server state / caching | frontend/src/api/ via TanStack Query |
| Request/response shapes | backend/app/schemas/ (Pydantic) → generated TS |
| Business logic | backend/app/services/ |
| Authorization | backend/ — every protected route |
| Database access | backend/ only |
| Files | backend/ issues signed URLs; bytes go browser ↔ GCS |
| Secrets | backend/ env only |
Rules
- The API contract is generated, never hand-written. Pydantic → OpenAPI →
frontend/src/generated/api-client/. No hand-written TypeScript DTOs, no rawfetch()for our own API, no Vercel API routes, no business logic in React. - Authentication ≠ authorization. Firebase says who; FastAPI decides what they may do. Every protected mutation ships with authorization tests for: no token (401), wrong role (403), wrong owner (403/404), correct (2xx).
- Schema changes follow this repo's persistence profile (
docs/PERSISTENCE.md; the choice is recorded indocs/DECISIONS.md). Postgres: Alembic only — never alter a database by hand; destructive migrations need a rollback note indocs/OPERATIONS.md. Google Sheets: add the column and update the header resolver; still record renames indocs/OPERATIONS.md, because a renamed column is a breaking change even without a migration. Either way, onlyapp/services/knows which store is in use. - Errors follow the contract in
docs/ARCHITECTURE.md: machine-readable code + safe user message. Never leak an exception string to a user. - Bound hostile input: request size, upload size and type, pagination caps, CORS
allowlist, bounded queries, no secrets in logs. The actual values are already decided in
docs/SECURITY.md— read them rather than inventing a limit, and update that table if a new one is needed. - Every async surface owns five states: loading, empty, error, success, disabled. Keyboard navigable, labelled, visible focus, 4.5:1 contrast.
- Responsive is a requirement, not a finish. Every screen must work at 375px and at
desktop width. The page body never scrolls horizontally — wide content (tables, charts, code)
scrolls inside its own container. Decide desktop → tablet → mobile per surface, especially
for navigation, tables, forms, toolbars, dialogs and charts; a six-column table becomes
compact record rows on mobile rather than a crushed table.
frontend/e2e/smoke.spec.tsenforces the 375px no-overflow rule mechanically — do not weaken that test to make a layout pass. Visual work ships with both a desktop and a mobile screenshot. - Preview never points at production data, bucket, or auth project.
./scripts/verify.shmust be green before a PR, including the API-client drift check.- Env vars are declared by name in
.env.example. Values never enter git or docs. A new variable lands in four places:.env.example, Vercel, Cloud Run, and the table indocs/DEPLOYMENT.md. - Backend tests with backend changes, frontend tests with frontend changes, in the same change. Not "after".
Stop conditions
Three kinds. In all three: stop, explain, propose the smallest sufficient option, wait.
1. Architectural boundary. Adding Redis, a queue, a second backend or database, GraphQL,
Next.js server functions, Terraform, Kubernetes, SSR, another auth provider, or moving logic
into the frontend. Record the outcome in docs/DECISIONS.md.
2. Destructive data operation. You may freely write the code. You may not execute anything that deletes or irreversibly transforms user data without explicit human approval:
DROP COLUMN·DROP TABLE· bulk delete · a production migration that rewrites data · storage-object purge · auth-user deletion · truncating or resetting any non-local database
Reversible, additive work — add a column, create a table, ordinary forward migration — proceeds without asking.
On the Google Sheets profile there is one extra: if an operation genuinely requires two writes to both land or neither, Sheets cannot provide it. Do not simulate a transaction in application code — propose moving to Postgres.
3. Real external side effect. Implement freely; do not execute against the real world without approval:
sending real email or notifications · charging a payment · creating or deleting cloud resources · publishing publicly · modifying production data
This is the same boundary the MCP permission rules encode — see .claude/PERMISSIONS.md. The
permission file catches the obvious cases mechanically; this rule covers the rest.
Inside all three boundaries, implement freely without asking.
Commands
just verify # the full ladder — must be green before a PR
just guard # architecture guardrails only (milliseconds)
just gen # regenerate the typed client after any schema change
just seed # deterministic demo rows; run before visual review
just dev-api # uvicorn --reload just dev-web # Vite
just browser # playwright, incl. the 375px overflow gate
just migrate NAME # alembic revision --autogenerate, then READ it
just install # uv sync + npm ci + playwright browsersTooling is Rust where it pays — uv, ruff, ty, oxlint, just. just works identically on
macOS, Linux and Windows; scripts/verify.sh is the implementation behind it.
Skills
.claude/skills/ — use these rather than improvising a workflow.
| Skill | For |
product-shaping | Vague request → bounded brief. Spec only, no code. |
feature | Orchestrates a whole capability across backend, contract and UI. |
api-endpoint | One endpoint, with its authorization tests and regenerated client. |
db-migration | Schema change via Alembic. |
frontend-page | One screen wired to the generated client. |
frontend-craft | Visual quality — build / refactor / audit. Render before judging. |
review | Pre-PR verification and boundary checks. |
deploy | Preflight → migrations → deploy → smoke test → rollback. |
Commits and pull requests
- One logical change per commit. Subject in the imperative, under ~72 chars.
- The body says why, not what — the diff already says what. If a change fixes something subtle, name the failure it prevents.
- Do not mix a toolchain or dependency bump into a feature commit. A green build must mean the feature is green, not that the bump happened to pass.
just verifygreen before opening a PR, and say so with the real output.- UI changes ship with a desktop and a 375px screenshot.
- Say explicitly what you did not cover. A PR that hides its gaps costs more than one that names them.
Reference material
AGENTS.md is the rules. These are the decisions those rules refer to — read the relevant one
before inventing an answer it already contains.
| Document | Read it when |
docs/PRODUCT.md | Deciding scope: who the user is, the primary transaction, what is out |
docs/ARCHITECTURE.md | Why the repo is shaped this way, and the error-envelope contract |
docs/SECURITY.md | Trust boundaries, input limits, rate limits, the existence-leak policy |
docs/PERSISTENCE.md | Which store this repo uses and what that costs you |
docs/SETUP.md | One-time accounts, plugins and grants — what a human must do first |
docs/DEPLOYMENT.md | Env var names, origins, CORS policy, GCS IAM, smoke test |
docs/OPERATIONS.md | Migrations, destructive-change log, rollback, backups, incidents |
docs/DECISIONS.md | Append-only ADR log — every stop-condition outcome lands here |
If you find yourself choosing a value these documents already fix — an upload cap, a page size, a 403-vs-404 policy — you are inventing a second source of truth. Read, then follow.
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.

