You can add custom instructions to Cursor in several ways:

Global Rules

Global rules can be added by modifying the Rules for AI section under Cursor Settings > General > Rules for AI.

This custom instruction will be included for features such as Cursor Chat and Ctrl/⌘ K.

Cursor offers a powerful and flexible rules system with folder-specific configurations. Project rules are stored in the .cursor/rules directory and provide granular control over AI behavior in different parts of your project.

Key features of Project Rules:

  • Semantic Descriptions: Each rule can include a description of when it should be applied
  • File Pattern Matching: Use glob patterns to specify which files/folders the rule applies to
  • Automatic Attachment: Rules can be automatically included when matching files are referenced
  • Folder-Specific: Different rules can apply to different parts of your project

You can create a new rule using the command palette with Cmd + Shift + P > New Cursor Rule.

Example use cases:

  • Framework-specific rules for certain file types (e.g., SolidJS preferences for .tsx files)
  • Special handling for auto-generated files (e.g., .proto files)
  • Custom UI development patterns
  • Code style and architecture preferences for specific folders

.cursorrules

For backward compatibility, you can still use a .cursorrules file in the root of your project. However, this method is deprecated and will be removed in the future. We recommend migrating to the new Project Rules system for better flexibility and control.

The instructions in the .cursorrules file will still be included for features such as Cursor Chat and Ctrl/⌘ K, but consider using Project Rules for more granular control over your AI interactions.