Cursor: Teach AI Your Codebase Style (2026)
๐ Quick start
- Create a .cursorrules file at your project root to define coding standards.
- Add sections for project overview, coding standards, and architecture constraints.
- Use AI prompts to auto-generate or update rules based on your codebase.
- Avoid generic rules and keep the file updated as your project evolves.
๐ก Why use Cursor for this
Cursor's .cursorrules file is a plain text configuration that guides the AI to follow your project's conventions. By writing specific rules about indentation, naming, libraries, and forbidden patterns, you can reduce off-style suggestions. This guide walks you through creating and maintaining the file. Note: Cursor's pricing and features as of October 2026: Free tier includes limited AI completions; Pro at $20/month offers unlimited completions and advanced models. Check the official pricing page for current details.
๐ ๏ธ How to Teach AI Your Codebase Style (5 steps)
Step 1
Open Cursor and ensure your project is loaded. Press Cmd+Shift+P (Ctrl+Shift+P on Windows) to open the Command Palette, type 'File: New File', and create a file named .cursorrules at the root of your project.
Step 2
Start the file with a 'Project Overview' section. Write a short paragraph describing your project: what it does, the tech stack (e.g., React 18, TypeScript 5, Tailwind CSS), and high-level architecture (e.g., feature-based folders).
Step 3
Add a 'Coding Standards' section. List specific rules: indentation (tabs vs spaces), naming conventions (camelCase for functions, PascalCase for components), preferred imports (named exports, avoid default exports), and critical linter rules (e.g., enforce strict equality).
Step 4
Add an 'Architecture Constraints' section. Declare decisions like 'State management: Zustand only, no Redux or MobX', 'Error handling: use custom AppError class', 'API calls: use React Query with shared fetcher'. Include patterns you never want the AI to suggest.
Step 5
Optionally, create a .cursorignore file at the root to exclude large folders (e.g., node_modules, dist, .next) from AI indexing, improving performance.
๐ฆ What you'll get
After completing these steps, you will have a .cursorrules file (and optionally a .cursorignore) that Cursor's AI uses to tailor suggestions. The file is plain text and can be version-controlled.
๐ฐ Pricing (checked 2026-10-15)
| Plan | Price | What you get for this workflow | Official link |
|---|---|---|---|
| Free | $0 |
Limited AI completions, basic models | pricing โ |
| Pro | $20/month |
Unlimited completions, advanced models, priority support | pricing โ |
| Business | $40/user/month |
Team management, SSO, centralized billing | pricing โ |
๐ Copy-paste prompts
"Analyze the code in this workspace. Generate a .cursorrules file that captures coding conventions, architecture patterns, and banned practices. Output only the file content."
"I have a .cursorrules file in this project. Review it for completeness. Are there important conventions missing? Suggest three additions based on the codebase."
"Update .cursorrules to ban the use of Axios directly. Instead, all HTTP requests must go through the api.ts wrapper."
โ ๏ธ Common mistakes
โ๏ธ Cursor vs Alternatives
| Tool | Price | Best For | Verdict |
|---|---|---|---|
Individual $10/month, Business $19/user/month (checked 2026-10-15) |
|||
Pro $12/month, Enterprise $39/user/month (checked 2026-10-15) |
โ Frequently Asked Questions
Q: What is a .cursorrules file?
A plain text file at the root of your project that contains instructions for Cursor's AI to follow your coding conventions and architecture.
Q: Do I need a paid Cursor plan to use .cursorrules?
No, the .cursorrules file works on all plans, including Free, but advanced AI features may require Pro.
Q: How do I update .cursorrules?
Edit the file directly or use AI prompts to suggest updates based on code changes.
Q: What is .cursorignore?
A file that tells Cursor which files and folders to exclude from AI indexing, improving performance.
Q: Can I use .cursorrules with other AI coding tools?
No, .cursorrules is specific to Cursor. Other tools have their own configuration methods.
๐ Level up your AI toolkit
Understand AI in 5 minutes a day. No jargon. No hype. Unsubscribe anytime.