agentleFS
tadoEngtadoEng/web-starter/AGENTS.md

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.

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
  1. Distinctive:

    Every protected mutation ships with authorization tests for: no token (401), wrong role (403), wrong owner (403/404), correct (2xx).

    line 69
  2. Distinctive:

    Responsive is a requirement, not a finish: Every screen must work at 375px and at desktop width.

    line 86
  3. Very specific:

    ./scripts/verify.sh must be green: before a PR, including the API-client drift check.

    line 94
  4. Distinctive:

    Do not mix a toolchain or dependency bump into a feature commit.

    line 169
  5. Distinctive:

    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 …

    line 192

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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 FastAPI

Repository 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 to

Where code belongs

ConcernHome
UI, routing, client state, formsfrontend/
Server state / cachingfrontend/src/api/ via TanStack Query
Request/response shapesbackend/app/schemas/ (Pydantic) → generated TS
Business logicbackend/app/services/
Authorizationbackend/ — every protected route
Database accessbackend/ only
Filesbackend/ issues signed URLs; bytes go browser ↔ GCS
Secretsbackend/ env only

Rules

  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 routes, no business logic in React.
  2. 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).
  3. Schema changes follow this repo's persistence profile (docs/PERSISTENCE.md; the choice is recorded in docs/DECISIONS.md). Postgres: Alembic only — never alter a database by hand; destructive migrations need a rollback note in docs/OPERATIONS.md. Google Sheets: add the column and update the header resolver; still record renames in docs/OPERATIONS.md, because a renamed column is a breaking change even without a migration. Either way, only app/services/ knows which store is in use.
  4. Errors follow the contract in docs/ARCHITECTURE.md: machine-readable code + safe user message. Never leak an exception string to a user.
  5. 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.
  6. Every async surface owns five states: loading, empty, error, success, disabled. Keyboard navigable, labelled, visible focus, 4.5:1 contrast.
  7. 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.ts enforces 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.
  8. Preview never points at production data, bucket, or auth project.
  9. ./scripts/verify.sh must be green before a PR, including the API-client drift check.
  10. 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 in docs/DEPLOYMENT.md.
  11. 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 browsers

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

SkillFor
product-shapingVague request → bounded brief. Spec only, no code.
featureOrchestrates a whole capability across backend, contract and UI.
api-endpointOne endpoint, with its authorization tests and regenerated client.
db-migrationSchema change via Alembic.
frontend-pageOne screen wired to the generated client.
frontend-craftVisual quality — build / refactor / audit. Render before judging.
reviewPre-PR verification and boundary checks.
deployPreflight → 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 verify green 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.

DocumentRead it when
docs/PRODUCT.mdDeciding scope: who the user is, the primary transaction, what is out
docs/ARCHITECTURE.mdWhy the repo is shaped this way, and the error-envelope contract
docs/SECURITY.mdTrust boundaries, input limits, rate limits, the existence-leak policy
docs/PERSISTENCE.mdWhich store this repo uses and what that costs you
docs/SETUP.mdOne-time accounts, plugins and grants — what a human must do first
docs/DEPLOYMENT.mdEnv var names, origins, CORS policy, GCS IAM, smoke test
docs/OPERATIONS.mdMigrations, destructive-change log, rollback, backups, incidents
docs/DECISIONS.mdAppend-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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.