open-source-ssd / template
AGENTS.md1 starsChanged 52 days agoMITView on GitHub
This file provides guidance to Code Agents (Codex, Cursor, etc.) when working with code in this repository. No automated test suite exists. Validate changes with pnpm build, pnpm lint, and manual QA.
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 repository5 other files it gives its agents.
- template/CLAUDE.mdCLAUDE.md
- blindspot-auditSkill
- loop-prompt-generatorSkill
- requirements-matrix-generatorSkill
- spec-devSkill
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is 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.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
No automated test suite exists.
- Distinctive: line 50
All actions use Zod schemas for input validation
- Distinctive: line 67
All external integrations follow a pluggable provider pattern with factory functions:
≈ “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
This file provides guidance to Code Agents (Codex, Cursor, etc.) when working with code in this repository.
Development Commands
pnpm dev- Start Next.js dev serverpnpm build- Production buildpnpm lint- Biome linter (auto-fixes with--write)pnpm format- Biome formatterpnpm db:generate- Generate Drizzle migration files from schema changespnpm db:migrate- Apply pending migrationspnpm db:push- Push schema directly to DB (dev only)pnpm db:studio- Open Drizzle Studio GUIpnpm email- Email template preview server on port 3333pnpm content- Rebuild fumadocs MDX content collectionspnpm knip- Find unused exports, dependencies, and filespnpm auth:schema:generate- Regenerate Better Auth schema tosrc/db/auth.schema.ts
No automated test suite exists. Validate changes with pnpm build, pnpm lint, and manual QA.
Architecture Overview
Routing & i18n
- App Router with
[locale]dynamic segment usingnext-intl(as-needed prefix strategy — default locale omitted from URL) - Route groups inside
[locale]:(marketing)for public pages,(protected)for authenticated pages,authfor login/signup,docsfor documentation - API routes at
src/app/api/(outside locale segment) - Translation files:
messages/en.json,messages/zh.json - i18n routing config:
src/i18n/routing.ts; middleware:src/middleware.ts
Authentication (Better Auth)
- Server config:
src/lib/auth.ts; client:src/lib/auth-client.ts - PostgreSQL adapter via Drizzle, session cached 60s, 7-day expiry, fresh age disabled
- Plugins: admin, apiKey, emailHarmony (verification/password reset)
- OAuth: GitHub + Google with account linking
- Auth hooks auto-subscribe new users to newsletter and distribute registration credits
- Auth tables in
src/db/schema.ts:user,session,account,verification,apikey
Database (Drizzle ORM + PostgreSQL)
- Connection:
src/db/index.tsusingpostgresdriver (notpg), singleton pattern - Schema:
src/db/schema.ts— auth tables +payment,userCredit,creditTransaction - Payment records track
type(subscription/one-time),scene(lifetime/credit/subscription),status; unique constraint oninvoiceId - Config:
drizzle.config.tsreadsDATABASE_URLfrom env
Server Actions (next-safe-action)
- Three-tier action clients in
src/lib/safe-action.ts:actionClient— base, no auth requireduserActionClient— requires authenticated session, ctx includes user/sessionadminActionClient— requires admin role
- All actions use Zod schemas for input validation
- Actions organized by feature in
src/actions/
Payment System (Stripe)
- Provider pattern in
src/payment/with Stripe as implementation - Plans defined in
src/config/website.tsx: Free (50 credits), Pro ($9.90/mo or $99/yr, 1000 credits), Lifetime ($199 one-time, 1000 credits) - Credit packages: Basic (100), Standard (200), Premium (500)
- Webhook handler validates signature and distributes credits on payment completion
- Checkout flow: server action → create Stripe customer if needed → record payment → redirect to Stripe → webhook updates record
Credits System
- Core logic in
src/credits/ - 7 transaction types:
MONTHLY_REFRESH,REGISTER_GIFT,PURCHASE_PACKAGE,SUBSCRIPTION_RENEWAL,LIFETIME_MONTHLY,USAGE,EXPIRE - Credits tracked in
userCredittable with history increditTransaction - Monthly distribution via
pnpm distribute-creditsscript
Provider Pattern (used throughout)
All external integrations follow a pluggable provider pattern with factory functions:
- Payment:
src/payment/(Stripe) - Mail:
src/mail/(Resend, React Email templates — all localized) - Notifications:
src/notification/(Discord, Feishu) - Storage:
src/storage/(S3 vias3mini) - AI:
src/ai/(multiple image generation providers)
State & Data Flow
- Server components fetch data directly; mutations via server actions
- Zustand stores in
src/stores/for client-side state - React Query for async data on client
- Forms use React Hook Form + Zod validation
Content
- Fumadocs for documentation (
content/docs/), MDX blog (content/blog/) - Source config:
source.config.ts; rebuild withpnpm content
Configuration
- Centralized app config with feature flags:
src/config/website.tsx - Demo mode:
NEXT_PUBLIC_DEMO_WEBSITEenv var (enables Crisp chat, Turnstile CAPTCHA, looser admin checks) - Environment template:
env.example
Code Style
- Biome enforces: 2-space indentation, 80-char line width, single quotes, ES5 trailing commas, semicolons required
- Filenames: kebab-case (
dashboard-sidebar.tsx); hooks prefixeduse-(use-session.ts) - Named exports preferred; default exports only for pages/layouts
- Server-only code marked with
"use server"directive - Tailwind CSS v4 with tokens in
src/styles/ - UI primitives from Radix UI; icons from
lucide-react - Conventional Commits:
feat:,fix:,chore:
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.

