lovable-boilerplate / rules
Cursor rule65 starsChanged 16 months agoMITView on GitHub
Core architecture and quality rules for React + Vite + shadcn/ui template
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,533 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 repository8 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .cursor/rules/components.mdcCursor rule
- .cursor/rules/design.mdcCursor rule
- .cursor/rules/forms.mdcCursor rule
- .cursor/rules/hooks.mdcCursor rule
- .cursor/rules/quality.mdcCursor rule
- .cursor/rules/services.mdcCursor rule
- .cursor/rules/typescript.mdcCursor rule
The file
We split this core.mdc 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
- Distinctive: line 12
NEVER: create components over 300 lines
- Very specific: line 69
BEFORE SHIPPING: Run npm run lint and fix all issues
- Distinctive: line 72
RESPONSIVE: Test on mobile and desktop
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule 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
---
description: Core architecture and quality rules for React + Vite + shadcn/ui template
globs: ["src/**/*.{tsx,ts}", "package.json", "vite.config.ts", "tailwind.config.ts"]
alwaysApply: true
---
# React + Vite + shadcn/ui Template - Core Rules
## CRITICAL ARCHITECTURE RULES
### Component Size & Organization
- **NEVER** create components over 300 lines
- **ALWAYS** break down complex components into smaller, focused pieces (20-100 lines)
- **EXTRACT** reusable logic to custom hooks, not copy-paste
- **USE** composition patterns - build complex UI from smaller components
### File Structure Requirements
```
src/
├── components/
│ ├── ui/ # shadcn/ui components (READ-ONLY)
│ ├── common/ # Reusable components
│ ├── forms/ # Form components
│ └── features/ # Feature-specific components
├── hooks/ # Custom React hooks
├── lib/
│ ├── utils.ts # Utilities (includes cn function)
│ ├── types.ts # Shared TypeScript types
│ ├── constants.ts # App constants
│ └── validations/ # Zod schemas
├── pages/ # Route components (composition only)
├── services/ # API calls
└── context/ # React context providers
```
### Import Organization
```tsx
// 1. React imports
import React, { useState, useEffect } from 'react'
// 2. Third-party libraries
import { useQuery } from '@tanstack/react-query'
import { zodResolver } from '@hookform/resolvers/zod'
// 3. UI components
import { Button } from '@/components/ui/button'
import { Card } from '@/components/ui/card'
// 4. Local components
import { UserCard } from '@/components/common/UserCard'
// 5. Hooks and utilities
import { useDisclosure } from '@/hooks/useDisclosure'
import { cn } from '@/lib/utils'
// 6. Types and constants
import type { User } from '@/lib/types'
import { API_ENDPOINTS } from '@/lib/constants'
```
### Essential Commands
```bash
npm run dev # Start development server (port 8080)
npm run build # Production build
npm run lint # Run ESLint - MUST pass before shipping
```
### Quality Gates
- **BEFORE SHIPPING**: Run `npm run lint` and fix all issues
- **ACCESSIBILITY**: Maintain WCAG 2.1 AA contrast (4.5:1 minimum)
- **NO CONSOLE ERRORS**: Zero warnings in browser console
- **RESPONSIVE**: Test on mobile and desktop
- **DESIGN QUALITY**: Industry-appropriate visual identity with purposeful color psychology
- **CUSTOM DESIGN**: Interfaces should feel premium and custom-crafted, not template-like
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.

