Control how the Agent model behaves with reusable, scoped instructions.
.cursor/rules
, version-controlled and scoped to your codebase..cursor/rules
. Each rule is a file and version-controlled. They can be scoped using path patterns, invoked manually, or included based on relevance. Subdirectories can include their own .cursor/rules
directory scoped to that folder.
Use project rules to:
.mdc
), a format supporting metadata and content. Control how rules are applied from the type dropdown which changes properties description
, globs
, alwaysApply
.
Rule Type | Description |
---|---|
Always | Always included in model context |
Auto Attached | Included when files matching a glob pattern are referenced |
Agent Requested | Available to AI, which decides whether to include it. Must provide a description |
Manual | Only included when explicitly mentioned using @ruleName |
@service-template.ts
are included as additional context when the rule triggers.
.cursor/rules
directories throughout your project. Nested rules automatically attach when files in their directory are referenced.
New Cursor Rule
command or going to Cursor Settings > Rules
. This creates a new rule file in .cursor/rules
. From settings you can see all rules and their status.
/Generate Cursor Rules
command. Useful when you’ve made decisions about agent behavior and want to reuse them.
Standards for frontend components and API validation
Templates for Express services and React components
Automating development workflows and documentation generation
npm run dev
Adding a new setting in Cursor
@reactiveStorageTypes.ts
.Add default value in INIT_APPLICATION_USER_PERSISTENT_STORAGE
in @reactiveStorageService.tsx
.For beta features, add toggle in @settingsBetaTab.tsx
, otherwise add in @settingsGeneralTab.tsx
. Toggles can be added as <SettingsSubSection>
for general checkboxes. Look at the rest of the file for examples..cursorrules
(Legacy).cursorrules
file in your project root is still supported but will be deprecated. We recommend migrating to Project Rules for more control, flexibility, and visibility.
Why isn't my rule being applied?
Agent Requested
, ensure a description is defined. For Auto Attached
, ensure the file pattern matches referenced files.Can rules reference other rules or files?
@filename.ts
to include files in your rule’s context.Can I create a rule from chat?
/Generate Cursor Rules
command. If Memories are enabled, memories are generated automatically.Do rules impact Cursor Tab or other AI features?