Rules
Rules help you customize how Cursor's AI interacts with your codebase. By defining specific guidelines, coding standards, and project requirements, you ensure consistent and high-quality AI assistance.
Example Rule
Here's an example of a rule file that defines coding standards for a Next.js fullstack application:
Base Rules for Next.js App
View on GitHub💡 Pro Tip:You can use @file to reference multiple rule files, allowing you to chain multiple rules together
Project Rules
Configuration
Project rules are stored in the .cursor/rules
directory, providing granular control through path-specific configurations. These rules are version-controlled, making them easy to share and maintain across your team.
Key Features
- •Semantic Descriptions for rule application context
- •File Pattern Matching using glob patterns
- •Automatic Attachment for matching files
- •Reference files using @file in rules
Common Use Cases
- •Framework-specific rules for certain file types
- •Special handling for auto-generated files
- •Custom UI development patterns
- •Code style and architecture preferences
Global Rules
Global rules can be configured under Cursor Settings > General > Rules for AI, applying across all projects. These are ideal for consistent preferences like output language and response length.
Location:Cursor Settings > General > Rules for AI
Resources
On the following websites you can find curated lists of cursor rules or tools to generate them:
Awesome Cursor Rules
A curated list of awesome cursor rules files for enhancing your Cursor AI experience.
View RepositoryCursor Rules CLI
A command-line tool to find and install the right Cursor rules for your project.
View Documentation