Cursor — Configuration & Rules
Configure Cursor IDE for optimal AI coding. .cursor/rules/*.mdc setup, Cursor settings, model selection, .cursor/ directory conventions, and integration with cursor rules templates.
Cursor — Configuration & Rules
Cursor's AI behavior is controlled by project rules in .cursor/rules/*.mdc (or AGENTS.md), Cursor Settings, and model configuration. The rules system is the most important — it's Cursor's equivalent of a system prompt.
Project Rules — The System Prompt
Project rules live in .cursor/rules/*.mdc and are version-controlled. AGENTS.md is the plain-markdown alternative for simpler projects. The legacy .cursorrules file is not part of the current rules system.
Basic AGENTS.md
You are a senior TypeScript developer working on a Next.js project.
## Commands
- `npm run dev` — Start development server
- `npm run build` — Production build
- `npx vitest run` — Run tests
## Code Style
- Use TypeScript strict mode
- Prefer server components unless interactivity is needed
- Use `@/` path alias for internal imports
- Error boundaries wrap every route segment
## Constraints
- Never modify next.config.ts without asking
- Never install packages without asking
- Always run type check after code changes
.cursor/rules/ — Multiple Rule Files
For larger projects, split rules by concern:

.cursor/rules/
├── typescript.mdc # "alwaysApply: true"
├── react.mdc # "alwaysApply: false, description: React rules"
├── testing.mdc # "alwaysApply: false, globs: **/*.test.*"
├── api-design.mdc # "alwaysApply: false, description: API design"
└── database.mdc # "alwaysApply: false, globs: prisma/**"
Rule file format:
---
alwaysApply: true
---
# TypeScript Conventions
- No `any` types. Use `unknown` and type guards
- Prefer `interface` for object shapes, `type` for unions
- Use `satisfies` operator for config objects
---
alwaysApply: false
description: React component patterns
globs: **/*.tsx
---
# React Conventions
- Server components by default
- `'use client'` directive only for interactivity
- Extract data fetching from component body
| Frontmatter Field | Description |
|---|---|
alwaysApply | Apply to every request (true) or only matched (false) |
description | Shown in rule picker (required when alwaysApply is false) |
globs | File patterns to match (required when alwaysApply is false) |
Conditional Rules
---
alwaysApply: false
globs: **/*.{test,spec}.{ts,tsx}
---
# Testing Rules
- Name tests: `should <expected behavior> when <condition>`
- Use `test()` not `it()` for consistency
- No business logic in tests — test behavior, not implementation
Cursor Settings
Access via Cursor → Settings → Cursor Settings (JSON):
{
"cursor.cpp.disabledLanguages": ["plaintext"],
"cursor.general.enableFreeTrial": true,
"cursor.tabCompletion": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}
Key Settings
| Setting | What it does |
|---|---|
cursor.tabCompletion | Enable/disable tab predictions |
cursor.composer.model | Model for Composer and Agent mode |
cursor.chat.model | Model for chat sidebar |
cursor.cpp.disabledLanguages | File types to exclude from AI |
Model Selection
Cursor supports multiple models:
| Model | Best For |
|---|---|
| Claude Sonnet 5.5 | Best overall — complex code, reasoning |
| Claude Opus 5.5 | Most capable — architecture, deep analysis |
| GPT-5.6 Sol | Good general coding, faster responses |
| Gemini 3.8 Flash | Fast, large context for big projects |
Codebase Indexing
Cursor indexes your entire codebase for context. Configure what's indexed:
# .cursorignore — files to exclude from indexing
node_modules
dist
.next
build
*.min.js
*.generated.*
Integrating with Cursor Rules Template Library
Prompt Genius's Cursor Rules section contains 50+ legacy .cursorrules templates. Each template includes:
- Framework-specific conventions
- Common commands and scripts
- Best practices and anti-patterns
- Testing guidance
To use a template with current Cursor, paste the relevant sections into .cursor/rules/<name>.mdc with frontmatter, or into AGENTS.md.
Related Pages
- MCP Setup in Cursor — connect external tools via MCP
- Prompt Engineering in Cursor — Agent mode, composer, inline edits
- Cursor Rules Section — 50+ legacy .cursorrules templates by framework
- Cursor Rules Configuration Guide — Advanced legacy .cursorrules patterns
- Tool Comparison — Cursor vs other AI coding tools
Sources
Related Articles & Guides
Antigravity CLI — Configuration Reference
Complete configuration reference for Antigravity CLI. Settings.json, environment variables, MCP servers, plugins, trusted folders, and project context files.
Cursor — AI-Powered IDE
Complete guide to Cursor, the AI-powered code editor. Covers prompt engineering, project rules, agent mode, composer, and best practices for AI-assisted development.
Claude Code — Configuration Reference
Complete Claude Code configuration reference. Covers settings.json files, MCP server setup, hook configuration, .claude/ directory conventions, and environment variable overrides.