- Keep files small (≤500 LOC) and organized in clear hierarchies. Smaller files improve AI navigation and reliability.
- Prefer functional components and typed interfaces. Reuse utilities instead of duplicating logic.
- Always update top-of-file docs after edits to maintain lightweight context for future agents.
- After all changes, always run
npm run build. Ignore warnings, fix errors.
- Components:
src/components/, PascalCase, functional only. Use"use client"where required. - Styling: Tailwind only. Extend tokens in
tailwind.config.ts. Use Framer Motion for animations. Never use Radix or shadcn. - Icons: Prefer
lucide-react, PascalCase names. Custom icons insrc/components/icons. - Notifications:
react-toastifyin client components (toast.success(),toast.error()). - Routing: App Router in
app/, kebab-case filenames. Server components by default.
- Prisma: schema in
prisma/schema.prisma, DB client insrc/lib/db.ts. Tables snake_case → fields camelCase. No raw SQL. Usenpx prisma migrate dev. NEVER useprisma db push, force a migration or any other commands that risk resetting the database. - tRPC: Routers in
src/lib/api/routers/, composed insrc/lib/api/root.ts. UsepublicProcedure/protectedProcedurewith Zod. Access from React via@/lib/trpc/react. - Inngest: Config in
inngest.config.ts, API route insrc/app/api/inngest/route.ts. Update UI via polling when events complete, not via tRPC responses.
- Strict mode, no
any. Use optional chaining and union types (no enums). - Shared types in
src/lib/types.ts. Reusable logic insrc/lib/utils/shared.ts(client) orsrc/lib/utils/server.ts(server). - Sort imports: external → internal → sibling → styles. Semantic commits only.
- Use
tsxscripts for migrations.
- AI calls go through
generateChatCompletioninsrc/lib/aiClient.ts. Default toGPT-5. - Store reusable tools and instructions in
agent-helpers/. Start fromagent-helpers/README.md.
- Stories in
src/stories/,.stories.tsxextension. One per component, name matched. - Use autodocs, include variants and sizes, test interactivity with actions. Use relative imports from component directory.