In this categoryCursor ยท 26
- How to Install Cursor and Import VS Code Settings (6 Minutes)Start
- Cursor Setup Guide: From Install to Your First AI Edit
- How to Set Up Project Rules in the .cursor/rules Folder
- How to Set Up Codebase Indexing in Cursor
- How to Enforce Project Conventions with Cursor Rules
- How to Write a Team Rule That Applies Only to Certain Files
- How to Migrate a Legacy .cursorrules File to the New Rules Folder
- How to Use Cursor Rules to Guide AI Edits
- How to Set Project Rules in Cursor
- How to Add a .cursorrules File to Steer Cursor
- How to Customize Cursor Keyboard Shortcuts
- How to Edit Multiple Files at Once with Cursor Composer
- How to Use Cursor Tab Completion Effectively
- How to Edit Code Inline with Cmd+K in Cursor
- How to Add Context to Cursor Chat with @ Mentions
- How to Choose and Switch AI Models in Cursor
- How to Add Library Docs as Context with @Docs in Cursor
- How to Generate and Maintain Tests with Cursor Composer
- How to Undo a Composer Change with Checkpoints in Cursor
- How to Use Cursor Agent Mode to Build a Feature End to End
- How to Connect an MCP Server to Cursor
- How to Refactor Across Your Whole Codebase in Cursor
- How to Query Your Database from Cursor with a Postgres MCP Server
- How to Let Cursor Run Commands Automatically (and Keep It Safe)
- How to Build a Full Feature Across Frontend and Backend with Composer
- How to Debug an MCP Server That Will Not Connect in Cursor
How to Use Cursor Rules to Guide AI Edits
Add a project rules file so Cursor follows your conventions and stack on every AI edit without being told each time.
Cursor reads project rules and applies them to its AI edits, which is the difference between code that matches your codebase and code you have to rewrite. This guide adds a rules file and confirms the editor follows it.
What you need
- Cursor installed with a project open
- Knowledge of your stack and house style
- About 8 minutes
Step 1: Create the rules folder
Project rules live in a dedicated folder at the repo root. Create it so Cursor knows where to look.
Step 2: Write a rule
Each rule is a small file describing how to write code in this project. Keep the guidance specific and testable, the same way you would brief a new teammate.
# Project style
- TypeScript strict; never use `any`.
- Prefer named exports over default exports.
- Use the existing `apiClient` helper for all network calls.
- Co-locate tests next to the file they cover.Step 3: Reference the right files
Point a rule at the patterns it governs so Cursor applies it where it matters. Tie API rules to your network layer and UI rules to your components.
Step 4: Verify the rule is applied
Ask Cursor to add a small feature and check the result. If your rules are loaded, the generated code uses named exports and your helpers without a reminder.
Result: Cursor produces edits that fit your codebase from the start, cutting the cleanup you used to do on every AI suggestion.
Watch related tutorials
41:18
28:05
3:12
26:54
39:10
32:18New guides in your inbox
Fresh step-by-step how-to guides as we publish them. One email a week, no more.