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.

October 20, 2026
cursorconfigurationcursorrulesidesettings

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 Directory Structure
.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 FieldDescription
alwaysApplyApply to every request (true) or only matched (false)
descriptionShown in rule picker (required when alwaysApply is false)
globsFile 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

SettingWhat it does
cursor.tabCompletionEnable/disable tab predictions
cursor.composer.modelModel for Composer and Agent mode
cursor.chat.modelModel for chat sidebar
cursor.cpp.disabledLanguagesFile types to exclude from AI

Model Selection

Cursor supports multiple models:

ModelBest For
Claude Sonnet 5.5Best overall — complex code, reasoning
Claude Opus 5.5Most capable — architecture, deep analysis
GPT-5.6 SolGood general coding, faster responses
Gemini 3.8 FlashFast, 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.

Sources