title: ".cursorrules & Cursor Rules — Complete Setup Guide" description: "Master .cursorrules files and Cursor Rules for Cursor IDE." slug: "cursorrules-cursor-ide" category: "skills" updatedAt: "2026-03-05T00:00:00.000Z" faqs:
- q: "Should I use .cursorrules or .cursor/rules/?" a: ".cursor/rules/ with .mdc files is the recommended approach in 2026. .cursorrules is legacy but still supported."
- q: "Do rules apply to all files?" a: "No. Each .mdc rule file has glob patterns in frontmatter that control which files it applies to."
.cursorrules & Cursor Rules
Overview
Cursor Rules are persistent instructions that tell Cursor's AI how to write code according to your project's conventions. They're analogous to Claude Code's SKILL.md but specific to the Cursor IDE.
Rule Locations
| Location | Format | Scope |
|----------|--------|-------|
| .cursor/rules/*.mdc | MDC with frontmatter | Project (recommended) |
| .cursorrules | Plain text | Project (legacy) |
| Cursor Settings → Rules | Plain text | Global (all projects) |
MDC Format (Recommended)
---
description: React and TypeScript standards
globs: ["**/*.tsx", "**/*.ts"]
---
# React + TypeScript Rules
## Components
- Use functional components with TypeScript interfaces
- Name components PascalCase, files kebab-case
- Use 'use client' only when needed
## State Management
- useState for local state
- Zustand for global state
- Never useEffect for data fetching
## TypeScript
- No 'any' — use 'unknown' + type guards
- Explicit return types on exported functions
- Prefer 'satisfies' over type assertions
Directory Structure
project-root/
├── .cursor/
│ ├── mcp.json # MCP server config
│ └── rules/
│ ├── architecture.mdc
│ ├── testing.mdc
│ ├── security.mdc
│ └── styling.mdc
Best Practices
- Be specific: Say "Use Zustand for global state" not "Use appropriate state management"
- Focus on architecture: Cursor knows syntax; tell it your patterns
- Keep rules concise: 1-3 sentences per rule
- Include examples: Show good and bad code snippets
- Organize by concern: Separate files for architecture, testing, styling
- Version-control rules: Commit
.cursor/rules/to git for team consistency
Rules vs Skills
| Feature | Cursor Rules | Claude Code SKILL.md | |---------|-------------|---------------------| | Format | .mdc with frontmatter | SKILL.md with YAML | | When applied | Always (glob-based) | Agent decides when relevant | | Location | .cursor/rules/ | .claude/skills/ | | Portability | Cursor only | Cross-tool compatible |
Related Guides
Was this guide helpful?
Last updated: March 5, 2026