Rules Configuration in AI

From the Cursor cheat sheet ยท Context Management ยท verified Jul 2026

Rules Configuration

Set persistent coding rules and patterns

yaml
# Rule file locations
.cursor/rules/         # Project-specific rules
AGENTS.md             # Simple project rules
User Settings > Rules  # Global user rules

# Rule file format (.cursor/rules/*.mdc)
---
description: API Standards
globs: ["**/*.api.ts"]
alwaysApply: false
---
- Use REST conventions
- Include error handling
- Add JSDoc comments

# Legacy: root .cursorrules still loads but is
# ignored in Agent mode - migrate to .cursor/rules/*.mdc

# Rule behaviors
Always         # Always included in context
Auto Attached  # Included with matching files
Agent Requested # AI decides inclusion
Manual         # Only when mentioned
yaml
// EXAMPLE: Project rules in .cursor/rules/style.md
---
description: Code style guide
alwaysApply: true
---
- Use TypeScript strict mode
- Prefer const over let
- Use async/await over callbacks
- Add error boundaries to components
๐Ÿ’ก Rules persist across all conversations
โšก Project rules override user rules
๐Ÿ” Globs target specific file patterns
๐Ÿ“Œ AGENTS.md for simple rule lists
rulesconfigurationcontext

Continue with Cursor

Save the full cheat sheet or work through every related task.

More AI tasks

Back to the full Cursor cheat sheet