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.

cursorconfigurationcursorrulesidesettings

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 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,
  "cursor.composer.model": "claude-sonnet-4",
  "cursor.chat.model": "claude-sonnet-4",
  "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-4Best overall — complex code, reasoning
claude-opus-4Most capable — architecture, deep analysis
gpt-5Good general coding, faster responses
gemini-2.5-pro1M context for large projects
cursor-smallFast, 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