Cursor Rules: Complete Guide to Customizing Your AI IDE
A practical guide to Cursor Rules: how to write and use .cursorrules to shape how Cursor's AI behaves in your projects.
Editorial Team
The AI Coding Tools Directory editorial team researches and reviews AI-powered development tools to help developers find the best solutions for their workflows.
Cursor Rules are instructions stored in .cursorrules or Settings that customize how Cursor's AI behaves in your projects -- enforcing coding style, testing conventions, framework patterns, and constraints. They apply to Composer, Agent mode, and chat across all models. This guide explains how to write and use them effectively.
The AI-native code editor with $1B+ ARR, 25+ models, and background agents on dedicated VMs
TL;DR
- Place rules in
.cursorrulesat your project root for project-specific behavior, or in Settings > Rules for AI for global defaults.- Rules should specify concrete conventions: style, testing framework, tech stack, forbidden patterns, and file references.
- Project rules take precedence over global rules when both exist.
- Be specific ("Use 2-space indent. Prefer named exports.") rather than vague ("Write good code.").
- Keep rules concise and updated as your project evolves; stale rules that contradict actual code produce worse output.
Quick Answer
Cursor Rules = instructions that tell Cursor how to code for your project. Put them in .cursorrules (project root) or Settings > Rules for AI (global). Use them for style, conventions, and constraints. Cursor
Where Rules Live
| Location | Scope |
|---|---|
.cursorrules (project root) |
Project only |
~/.cursor/rules or Settings > Rules for AI |
Global (all projects) |
.cursor/rules/ (project) |
Project-specific rule files |
Project rules take precedence when both exist.
What to Put in Rules
| Category | Example |
|---|---|
| Style | "Use 2-space indent. Prefer named exports." |
| Testing | "Write Jest tests for every new function." |
| Stack | "This is a Next.js 15 app with App Router." |
| Constraints | "Never use eval. No inline styles." |
| Patterns | "Use our AuthContext for auth; do not add new auth libs." |
Example .cursorrules
# Project: MyApp
- Next.js 15, TypeScript, Tailwind
- Use server components by default; add "use client" only when needed
- Write tests in Vitest; colocate with src
- No console.log in production code
- Follow our existing API patterns in /lib/api
Best Practices
| Do | Avoid |
|---|---|
| Be specific | Vague "write good code" |
| Reference real paths and patterns | Abstract rules with no examples |
| Keep rules concise | Hundreds of lines of rules |
| Update as project evolves | Stale rules that contradict code |
Rules vs Other Context
- Rules: Persistent instructions; always in context.
- @-mentions: One-off context (files, docs, web).
- Chat history: Conversational context.
Rules set the baseline; @-mentions add task-specific context.
Common Patterns
- Language/framework: "TypeScript strict. React 19."
- Testing: "Jest/Vitest. Aim for 80% coverage on new code."
- Security: "No hardcoded secrets. Use env vars."
- Architecture: "Feature folders. No circular imports."
Next Steps
- How to use Cursor — Cursor basics.
- Cursor review 2026 — Full Cursor assessment.
- Cursor — Tool page.
Tools Mentioned in This Article
Free Resource
2026 AI Coding Tools Comparison Chart
Side-by-side comparison of features, pricing, and capabilities for every major AI coding tool.
No spam, unsubscribe anytime.
Workflow Resources
Cookbook
AI-Powered Code Review & Quality
Automate code review and enforce quality standards using AI-powered tools and agentic workflows.
Cookbook
Building AI-Powered Applications
Build applications powered by LLMs, RAG, and AI agents using Claude Code, Cursor, and modern AI frameworks.
Cookbook
Building APIs & Backends with AI Agents
Design and build robust APIs and backend services with AI coding agents, from REST to GraphQL.
Cookbook
Debugging with AI Agents
Systematically debug complex issues using AI coding agents with structured workflows and MCP integrations.
MCP Server
AWS MCP Server
Interact with AWS services including S3, Lambda, CloudWatch, and ECS from your AI coding assistant.
MCP Server
Context7 MCP Server
Fetch up-to-date library documentation and code examples directly into your AI coding assistant.
MCP Server
Docker MCP Server
Manage Docker containers, images, and builds directly from your AI coding assistant.
MCP Server
Figma MCP Server
Access Figma designs, extract design tokens, and generate code from your design files.
Frequently Asked Questions
What are Cursor Rules?
Where do I put Cursor Rules?
Can Cursor Rules improve code quality?
Do Cursor Rules work with all models?
Related Articles
What is Vibe Coding? The Complete Guide for 2026
Vibe coding is the practice of building software by describing intent in natural language and iterating with AI. This guide explains how it works, who it's for, and how to get started.
Read more →GuideWarp Oz: Cloud Agent Orchestration for DevOps
A practical guide to Warp's Oz cloud agent: what it does, how it fits into terminal and DevOps workflows.
Read more →GuideSWE-bench Wars: How AI Coding Benchmarks Hit 80%
A practical look at SWE-bench and AI coding benchmarks: what they measure, current results, and how to interpret claims.
Read more →