Cursor — Configuration & Rules
Configure Cursor IDE for optimal AI coding. .cursorrules setup, Cursor settings, model selection, .cursor/ directory conventions, and integration with cursor rules templates.
Cursor — Configuration & Rules
Cursor's AI behavior is controlled by .cursorrules files, Cursor Settings, and model configuration. The rules system is the most important — it's Cursor's equivalent of a system prompt.
.cursorrules — The System Prompt
.cursorrules at project root is read by Cursor for every AI interaction. It's the most impactful configuration you can make.
Basic .cursorrules
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,
"cursor.composer.model": "claude-sonnet-4",
"cursor.chat.model": "claude-sonnet-4",
"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-4 | Best overall — complex code, reasoning |
claude-opus-4 | Most capable — architecture, deep analysis |
gpt-5 | Good general coding, faster responses |
gemini-2.5-pro | 1M context for large projects |
cursor-small | Fast, free — simple completions |
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 has 50+ framework-specific .cursorrules templates in the Cursor Rules section. Each template includes:
- Framework-specific conventions
- Common commands and scripts
- Best practices and anti-patterns
- Testing guidance
Combine the templates:
# Use the Next.js rules as base
cp .cursorrules .cursorrules.backup
cat templates/nextjs.cursorrules >> .cursorrules
cat templates/typescript.cursorrules >> .cursorrules
Related Pages
- Prompt Engineering in Cursor — Agent mode, composer, inline edits
- Cursor Rules Section — 50+ .cursorrules templates by framework
- Cursor Rules Configuration Guide — Advanced .cursorrules patterns
- Tool Comparison — Cursor vs other AI coding tools
Related Articles
AI Coding Tools — Prompt Engineering & Configuration
Complete guides for Claude Code, OpenCode, Gemini CLI, Cursor, GitHub Copilot, and more. Tool-specific prompt patterns, configuration files, and setup guides for every major AI coding assistant.
AI Coding Tool Comparison — Which One Should You Use?
Detailed comparison of Claude Code, OpenCode, Gemini CLI, Cursor, and GitHub Copilot. Pricing, context windows, MCP support, prompt patterns, and decision guide for every stack.
Claude Driving Gemini CLI with Ralph Loop Verification
Claude designs the approach, Gemini CLI executes with iterative self-verification via the Ralph loop. Split reasoning from execution across tools.