AgentStack
AGENTS.md1 starsChanged 5 months agoMITView on GitHub
This file orients AI coding agents (Claude Code, Cursor, etc.) working in this repo. Read it before making non-trivial changes. For step-by-step generators, see .claude/skills/ — most "add X" requests should go through one of them instead of being improvised. Next.js 15 (App Router) · TypeScript (strict) · Tailwind CSS v4 · Shadcn UI · Drizzle ORM · PostgreSQL (Neon-compatible) · Better Auth · Stripe · React Email + Resend. users / sessions / accounts / verifications — owned by…
- 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,439 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 repository3 other files it gives its agents.
- add-crud-featureSkill
- add-dashboard-pageSkill
- add-email-templateSkill
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 42
Mutations: prefer Server Actions ("use server", colocated in actions.ts next to the page that uses them) over API routes.
- Distinctive: line 43
Validation: every Server Action and API route validates its input with Zod before touching the database.
- Very specific: line 45
Auth/data access: use requireUser() / requireOrganization() from src/lib/session.ts in every server component or action that touches …
- Distinctive: line 47
Scope discipline: don't add abstractions, pagination, soft-deletes, or audit logs unless explicitly requested.
≈ “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 — AgentStack architecture map
This file orients AI coding agents (Claude Code, Cursor, etc.) working in this repo. Read it before making non-trivial changes. For step-by-step generators, see .claude/skills/ — most "add X" requests should go through one of them instead of being improvised.
Stack
Next.js 15 (App Router) · TypeScript (strict) · Tailwind CSS v4 · Shadcn UI · Drizzle ORM · PostgreSQL (Neon-compatible) · Better Auth · Stripe · React Email + Resend.
Where things live
| Concern | Location |
| DB tables | src/db/schema/*.ts (one file per domain, re-exported from index.ts) |
| DB client | src/db/index.ts |
| Auth config (server) | src/lib/auth.ts |
| Auth client (React hooks) | src/lib/auth-client.ts |
| Session/org helpers | src/lib/session.ts (getCurrentUser, requireUser, requireOrganization) |
| Stripe client | src/lib/stripe.ts |
| Email sending | src/lib/email.ts (one send<X>Email() per template) |
| Email templates | src/emails/*.tsx (React Email) |
| Marketing pages | src/app/page.tsx, src/app/(marketing)/ |
| Auth pages | src/app/(auth)/login, src/app/(auth)/signup |
| Dashboard pages | src/app/(dashboard)/** (auth-gated by (dashboard)/layout.tsx) |
| API routes | src/app/api/** (auth handler, Stripe checkout/portal/webhook) |
| Shadcn primitives | src/components/ui/* (do not hand-roll a new primitive if one exists here) |
| Shared dashboard chrome | src/components/dashboard/* (sidebar, topbar, nav registry) |
| Config | src/config/site.ts, src/config/pricing.ts |
Data model
users / sessions / accounts / verifications — owned by Better Auth, defined in src/db/schema/auth.ts. Don't hand-edit rows in these tables outside of Better Auth's own APIs.
organizations / organization_members — every user gets a personal organization automatically on signup (see databaseHooks.user.create.after in src/lib/auth.ts). This is a lightweight multi-tenant model: one user can belong to multiple orgs via organization_members, but the UI currently assumes "first org" (getCurrentOrganization() in src/lib/session.ts). If you add an org switcher, update that helper.
subscriptions — one-to-one with organizations, synced from Stripe via src/app/api/stripe/webhook/route.ts. Never write subscription status from anywhere else; the webhook is the single source of truth.
Every business resource you add must include an organizationId column and be scoped through requireOrganization(). There is no global/unscoped data in this app.
Conventions (enforced, not optional)
- Files: kebab-case. Components/types: PascalCase. DB tables/columns: snake_case (Drizzle maps
camelCaseJS fields to snake_case columns automatically — keep JS-side fields camelCase). - Mutations: prefer Server Actions (
"use server", colocated inactions.tsnext to the page that uses them) over API routes. API routes are reserved for things that need a stable HTTP contract: the Better Auth catch-all, Stripe endpoints, and webhooks. - Validation: every Server Action and API route validates its input with Zod before touching the database. No exceptions.
- Types: no
any. Derive row types from Drizzle withtypeof table.$inferSelect. - Auth/data access: use
requireUser()/requireOrganization()fromsrc/lib/session.tsin every server component or action that touches user/org data — never query the DB with a client-supplied ID without checking it belongs to the current session. - UI: reuse
src/components/ui/*before adding a new Shadcn primitive; reusesrc/components/shared/data-table.tsxfor any tabular resource listing. - Scope discipline: don't add abstractions, pagination, soft-deletes, or audit logs unless explicitly requested. Three similar lines beat a premature helper.
Common commands
pnpm install
pnpm db:generate # generate a migration from schema changes
pnpm db:push # push schema directly (fast local iteration)
pnpm db:studio # browse the DB
pnpm dev
pnpm test
pnpm typecheckSkill routing — use these instead of improvising
| If the user asks to... | Use |
| Add a new business resource/entity (model + API + UI) | .claude/skills/add-crud-feature |
| Add a new page inside the dashboard | .claude/skills/add-dashboard-page |
| Add or trigger a transactional email | .claude/skills/add-email-template |
Each skill's SKILL.md names the exact reference files to read before generating code, so output stays consistent with the rest of the codebase.
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.

