ClaudeOrNot

The Cursor rules file (.cursorrules)

Last updated: June 2026

Cursor is an AI-powered code editor built on VS Code. Like GitHub Copilot, it generates code suggestions. Unlike Copilot, it also has a chat interface and an agent mode that can make multi-file changes.

The .cursorrulesfile is how you configure Cursor's behavior. It's a plain text file in your project root that tells Cursor your coding standards, conventions, and preferences.

How to create it

touch .cursorrules

Place it in your project root. Cursor reads it automatically when you open the project. No special format needed — just write plain text instructions.

Example .cursorrules

# Project Context
This is a React + TypeScript monorepo using pnpm workspaces.
Apps: web (Next.js), mobile (React Native), api (Hono)
Shared packages: ui, utils, types

# Code Style
- Use TypeScript strict mode
- Functional components only, no class components
- Use Tailwind CSS for styling
- Prefer early returns over nested conditions
- Maximum function length: 40 lines

# Naming
- Files: kebab-case (user-profile.tsx)
- Components: PascalCase (UserProfile)
- Hooks: camelCase with "use" prefix (useAuth)
- Types/Interfaces: PascalCase with "I" prefix only for interfaces

# Testing
- Write tests with Vitest
- Use @testing-library/react for component tests
- Aim for 80%+ coverage on utils and hooks
- Place tests in __tests__/ directories

# Git
- Conventional commits (feat:, fix:, chore:)
- Reference issue numbers in commits
- Keep PRs under 400 lines of changes

# Things to Avoid
- Do not use any or @ts-ignore
- Do not install new dependencies without asking
- Do not modify files outside the current scope

.cursorrules vs skill.md vs copilot-instructions.md

Each AI coding tool has its own configuration approach:

ToolConfig fileOn-demand skillsScope
Cursor.cursorrulesNoSingle file
GitHub Copilot.github/copilot-instructions.mdNoSingle file
Claude CodeCLAUDE.md / agents.mdskill.mdMulti-layer

Cursor and Copilot use a single config file. Claude Code has a two-layer system: persistent instructions (agents.md) and on-demand skills (skill.md). The skill.md layer is unique to Claude Code — it lets you keep task-specific instructions separate so they don't bloat your main config.

If you're using Claude Code and want to know whether your instructions belong in agents.md or skill.md, try our free tool.

Best practices for .cursorrules

  • Start with project context. What stack, what architecture, what patterns. Cursor generates better code when it knows the constraints.
  • Include negative instructions. "Do not use any" and "Do not modify X" are often more effective than positive rules.
  • Keep it under 100 lines. Cursor has a context window for rules, and shorter, focused instructions work better.
  • Commit it. Your team should share the same Cursor rules, just like they share the same ESLint config.

Using Claude Code? Get your config right.

Claude Code's multi-layer config (agents.md + skill.md) is more powerful but also more complex. Describe your functionality and get an instant placement recommendation.

Try ClaudeOrNot →