-
Notifications
You must be signed in to change notification settings - Fork 146
/
Copy path.cursorrules
90 lines (60 loc) · 3.19 KB
/
.cursorrules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# .cursorrules
Components & Naming
- Use functional components with `"use client"` if needed.
- Name in PascalCase under `src/components/`.
- Keep them small, typed with interfaces.
- Use Tailwind for common UI components like textarea, button, etc. Never use radix or shadcn.
Prisma
- Manage DB logic with Prisma in `prisma/schema.prisma`, `src/lib/db.ts`.
- snake_case table → camelCase fields.
- No raw SQL; run `npx prisma migrate dev`, never use `npx prisma db push`.
Icons
- Prefer `lucide-react`; name icons in PascalCase.
- Custom icons in `src/components/icons`.
Toast Notifications
- Use `react-toastify` in client components.
- `toast.success()`, `toast.error()`, etc.
Next.js Structure
- Use App Router in `app/`. Server components by default, `"use client"` for client logic.
- NextAuth + Prisma for auth. `.env` for secrets.
tRPC Routers
- Routers in `src/lib/api/routers`, compose in `src/lib/api/root.ts`.
- `publicProcedure` or `protectedProcedure` with Zod.
- Access from React via `@/lib/trpc/react`.
TypeScript & Syntax
- Strict mode. Avoid `any`.
- Use optional chaining, union types (no enums).
File & Folder Names
- Next.js routes in kebab-case (e.g. `app/dashboard/page.tsx`).
- Shared types in `src/lib/types.ts`.
- Sort imports (external → internal → sibling → styles).
Tailwind Usage
- Use Tailwind (mobile-first, dark mode with dark:(class)). Extend brand tokens in `tailwind.config.ts`.
- For animations, prefer Framer Motion.
Inngest / Background Jobs
- Use `inngest.config.ts` for Inngest configuration.
- Use `src/app/api/inngest/route.ts` for Inngest API route.
- Use polling to update the UI when Inngest events are received, not trpc success response.
AI
- Use `generateChatCompletion` in `src/lib/aiClient.ts` for all AI calls.
- Prefer `O1` model with high reasoning effort for all AI calls.
Storybook
- Place stories in `src/stories` with `.stories.tsx` extension.
- One story file per component, matching component name.
- Use autodocs for automatic documentation.
- Include multiple variants and sizes in stories.
- Test interactive features with actions.
- Use relative imports from component directory.
Tools
- When you make a change to the UI, use the `screenshot` tool to show the changes.
- If the user asks for a complex task to be performed, find any relevant files and call the `architect` tool to get a plan and show it to the user. Use this plan as guidance for the changes you make, but maintain the existing patterns and structure of the codebase.
- After a complex task is performed, use the `codeReview` tool create a diff and use the diff to conduct a code review of the changes.
Additional
- Keep code short; commits semantic.
- Reusable logic in `src/lib/utils/shared.ts` or `src/lib/utils/server.ts`.
- Use `tsx` scripts for migrations.
IMPORTANT:
- After all changes are made, ALWAYS build the project with `npm run build`. Ignore warnings, fix errors.
- Always add a one-sentence summary of changes to `.cursor-updates` file in markdown format at the end of every agent interaction.
- If you forget, the user can type the command "finish" and you will run the build and update `.cursor-updates`.
- Finally, update git with `git add . && git commit -m "..."`. Don't push.