# Cursor Mastery

> Cursor AI complete guide -- rules system (.cursor/rules/*.mdc), @-mentions, Tab completion, Composer, Agent mode, subagents, and MCP configuration.

- Skill: `leolin990405/cursor-mastery` (Agent Skill)
- Install (CLI): `npx get-skill add leolin990405/cursor-mastery`
- Raw SKILL.md: https://api.skillmd.com/api/skills/leolin990405/cursor-mastery/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: LeoLin990405 (https://skillmd.com/u/leolin990405)
- Updated: 2026-11-11
- Page: https://skillmd.com/skills/leolin990405/cursor-mastery

---


# 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:
```markdown
---
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

1. Workspace semantic index (built on first open)
2. `.cursor/rules/` matching active files
3. @-mentions (explicit context)
4. Open tabs (weighted by relevance)
5. Recent edits (session history)

## MCP Configuration

`.cursor/mcp.json`:
```json
{
  "mcpServers": {
    "browser-tools": {
      "command": "npx",
      "args": ["@anthropic/mcp-browser"],
      "autoApprove": ["screenshot", "navigate"]
    }
  }
}
```

## Best Practices

1. **Banned patterns** in rules have highest ROI — prevents correction loops
2. Keep rules declarative and terse; constraints > explanations
3. Architecture rules matter most for Agent mode (it plans before writing)
4. Use `@codebase` for discovery; `@file` for targeted edits
5. Open related files in tabs to improve Tab context
6. Use globs for language-specific conventions

## Sources

- [Cursor Rules Docs](https://docs.cursor.com/context/rules)
- [Cursor Tab](https://docs.cursor.com/tab/overview)
- [awesome-cursorrules](https://github.com/PatrickJS/awesome-cursorrules)

