Guide

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.

By AI Coding Tools Directory2026-02-2810 min read
Last reviewed: 2026-02-28
ACTD
AI Coding Tools Directory

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

Get the Weekly AI Tools Digest

New tools, comparisons, and insights delivered regularly. Join developers staying current with AI coding tools.

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?
Cursor Rules are instructions in .cursorrules (or Rules for AI in Settings) that tell Cursor how to behave: style, conventions, constraints. They apply per project or globally.
Where do I put Cursor Rules?
Project-level: .cursorrules in the project root. Global: Settings > Rules for AI. Project rules override global when both apply.
Can Cursor Rules improve code quality?
Yes. Rules for style, testing, and architecture help the AI match your conventions. Be specific—vague rules produce vague results.
Do Cursor Rules work with all models?
Yes. Rules are part of the system/context sent to whichever model Cursor uses. Behavior may vary slightly by model.