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 shape how the AI behaves in your codebase. This guide explains how to write and use them effectively.
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.
Get the Weekly AI Tools Digest
New tools, comparisons, and insights delivered regularly. Join developers staying current with AI coding tools.
Tools Mentioned in This Article
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.
Skill
Change risk triage
A systematic method for categorizing AI-generated code changes by blast radius and required verification depth, preventing high-risk changes from shipping without adequate review.
Skill
Configuring MCP servers
A cross-tool guide to setting up Model Context Protocol servers in Cursor, Claude Code, Codex, and VS Code, including server types, authentication, and common patterns.
Skill
Local model quality loop
Improve code output quality when using local AI models by combining rules files, iterative retries with error feedback, and test-backed validation gates.
Skill
Plan-implement-verify loop
A structured execution pattern for safe AI-assisted coding changes that prevents scope creep and ensures every edit is backed by test evidence.
MCP Server
AWS MCP Server
Open source MCP servers from AWS Labs that give AI coding agents access to AWS documentation, best practices, and contextual guidance for building on AWS.
MCP Server
Docker MCP Server
Docker MCP Gateway orchestrates MCP servers in isolated containers, providing secure discovery and execution of Model Context Protocol servers across AI coding tools.
MCP Server
Figma MCP Server
Official Figma MCP server that brings design context, variables, components, and Code Connect data into AI coding sessions for design-to-code workflows.
MCP Server
Firebase MCP Server
Experimental Firebase MCP server that gives AI coding agents access to Firestore, Auth, security rules, Cloud Messaging, and project management through the Firebase CLI.
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 →