Cursor AI Mastery
Architecture
AI-native code editor (VS Code fork). Agent-first since Cursor 2.0+. Ships with custom Composer model (4x faster, RL-trained).
Models: Composer model, Claude Sonnet, GPT-4o, o1, o3-mini, Gemini, custom via OpenAI-compatible API.
Core Features
| Feature | Description |
|---|---|
| Tab | Multi-line autocomplete, cross-file aware, cursor jumps |
| Chat | Side panel Q&A with codebase context |
| Composer | Multi-file generation from natural language |
| Agent | Autonomous planning + execution + iteration |
| Subagents | Child agents for parallel work |
Rules System
Project Rules (.cursor/rules/*.mdc)
MDC format with YAML frontmatter:
---
description: "TypeScript coding standards"
globs: "**/*.{ts,tsx}"
alwaysApply: false
---
# TypeScript Rules
- Use strict TypeScript with no `any` types
- Prefer `interface` over `type` for object shapes
- All functions must have explicit return types
- Use barrel exports (index.ts) for public APIs
Rule Activation Modes
| Mode | Frontmatter | Behavior |
|---|---|---|
| Always Apply | alwaysApply: true |
Every prompt |
| Auto Attached | globs: "*.py" |
When matching files in context |
| Agent Requested | description: "..." |
Agent decides relevance |
| Manual | (all empty) | Only via @rulename |
Legacy: .cursorrules at project root (deprecated → migrate to .cursor/rules/).
@-Mentions System
| Mention | Purpose |
|---|---|
@file |
Attach specific file |
@folder |
Attach folder contents |
@codebase |
Semantic search across project |
@web |
Web search for context |
@docs |
Indexed documentation |
@git |
Git history and diffs |
@definitions |
Symbol definitions |
@rulename |
Manually attach a rule |
Context Assembly
- Workspace semantic index (built on first open)
.cursor/rules/matching active files- @-mentions (explicit context)
- Open tabs (weighted by relevance)
- Recent edits (session history)
MCP Configuration
.cursor/mcp.json:
{
"mcpServers": {
"browser-tools": {
"command": "npx",
"args": ["@anthropic/mcp-browser"],
"autoApprove": ["screenshot", "navigate"]
}
}
}
Best Practices
- Banned patterns in rules have highest ROI — prevents correction loops
- Keep rules declarative and terse; constraints > explanations
- Architecture rules matter most for Agent mode (it plans before writing)
- Use
@codebasefor discovery;@filefor targeted edits - Open related files in tabs to improve Tab context
- Use globs for language-specific conventions