Cursor Rules
Community-curated rules for the Cursor AI editor stored in .cursor/rules/. Configure your projects with coding standards, best practices, and AI behavior guidelines.
6 rules
typescript-strict-mode-standards.md
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
## TypeScript Configuration
Always use TypeScript strict mode in all projects.
### Required tsconfig.json settings
```json
{
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitReturns": true
}
}
```
### Type Safety Rules
Markdown
nextjs-api-route-standards.mdc
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
---
description: Standards for API route files
globs: app/api/**/*.ts, app/**/route.ts
---
## API Route Conventions
### Error Handling
Always wrap API handlers in try-catch and return proper HTTP status codes:
```typescript
export async function GET(request: Request) {
try {
const data = await fetchData();
return Response.json(data);
} catch (error) {
console.error("API Error:", error);
MDC (Frontmatter)
testing-best-practices.mdc
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
---
description: Testing patterns for test files
globs: **/*.test.ts, **/*.test.tsx...
---
## Testing Guidelines
### Test Structure
Use the Arrange-Act-Assert pattern:
```typescript
describe("calculateTotal", () => {
it("should sum items with tax", () => {
// Arrange
const items = [{ price: 100 }, { price: 50 }];
const taxRate = 0.1;
MDC (Frontmatter)
database-migration-guidelines.md
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
## Supabase Migration Standards
### Naming Convention
Migrations must follow the format: `YYYYMMDDHHMMSS_description.sql`
```
20260114100000_add_user_preferences.sql
20260114100001_create_notifications_table.sql
```
### Migration Structure
Always include:
1. Step comments explaining what each section does
2. IF EXISTS / IF NOT EXISTS guards
3. Rollback considerations in comments
Markdown
tailwind-css-conventions.mdc
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
---
description: Use when styling components with Tailwin...
autoApply: true
---
## Tailwind CSS Guidelines
### Class Organization
Order classes logically:
1. Layout (flex, grid, position)
2. Sizing (w, h, p, m)
3. Typography (text, font)
4. Colors (bg, text, border)
5. Effects (shadow, opacity)
6. Transitions
```tsx
MDC (Frontmatter)
react-component-patterns.mdc
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
---
description: Use when working with React components, ...
autoApply: true
---
## React Component Guidelines
### Functional Components Only
Always use functional components with hooks. Never use class components.
```tsx
// ✅ Good
export function UserProfile({ user }: UserProfileProps) {
const [isEditing, setIsEditing] = useState(false);
return <div>...</div>;
}
MDC (Frontmatter)