How to use Cursor Rules in Version 0.45
![Written by [object Object]](https://a.storyblok.com/f/316774/320x320/e07f300c40/kevinkernegger.jpg)
By Kevin Kern
![](https://a.storyblok.com/f/316774/1600x900/2bc3b522f8/cursor-rules-cover.jpeg)
Step #1: Understand Cursor Rules
A lot of my teammates, including myself, always forget to do certain things before leaving the office. So, we set up our own rules and routines to make sure we do these things every time we leave. This is basically how rules in Cursor AI work.In comparison a rules file in Cursor is like a guidebook for your AI coding helper. It tells the AI how to write code for your project, including what tools you're using and how everything is organized. This helps the AI create better and more accurate code.
Step #2: How to define Rules in Cursor
The Rules files in Cursor are special files in Cursor with the .mdc
extension. Basically its markdown. And Cursor reads this file first when the AI is working – it’s the first piece of context it loads.
Add your "main" entry rule file
Open Cursor
Hit
CMD + SHIFT + P
to open the command palette.Now search for
File: New Cursor Rule
and call it
instructions
and hitEnter
Describe the rule
In the
description
field give it a useful nameFor
Globs
, you can leave it blank or add a*
, which acts as a wildcard and will be added to each chat.Now you can add your custom global instructions to your file. As an simple example I assigned the role a typescript and nodejs expert.
For example, you might use rules to tell the AI things like “use TypeScript”, “follow ESLint standards”, “prefer functional components over class components in React”, or even project-specific rules like “we’re using Tailwind CSS for styling” or “don’t use any deprecated API”. Essentially, it’s context that applies globally to your project.
Step #3: Keep Rules Separated
Now, let’s go back to our real-world office example. What if we had rules for the kitchen too? In that case, we wouldn’t write them on the same note as the office rules. Instead, we’d put them on a separate piece of paper and stick it to the kitchen door. So, each space has its own rules.
Step #4: The .cursor/rules
directory
As projects get more complex, you might want specific rules for, say, .ts files, .js files, .md files, or even entire subfolders. With a recent update (0.45), Cursorrules got an upgrade, making this kind of separation possible.
This means you can not only write global rules and guidelines like we did before in instructions.mdc
as before, but also create separate instructions for individual file extensions and directories.
Note: The .cursorrule file is deprecated
In older cursor versions all the rules were defined in the .cursorrule file. From Version 0.45 the .cursorrule
is still working but it will be removed in future version.
Before, we had to put all rules in a single .cursorrules file. Typescript, Database rules, UI everything in one place. But that wasn’t ideal. Sometimes, the Agent didn’t know which rules to apply, and you couldn’t be specific. Technically, it just filled up your context window with unnecessary information.
Step #5: Guide the Agent
Best of all, you can use this approach to build a fully autonomous agent. To do this, you need to enable agent mode in Cursor and describe in your rule files which script or document should be processed.
It's understandable that the Cursor team removed the ".cursorrules" extension, as it understates the powerful capabilities of the agent. Not only can you define rules and policies, you can even control the Agent with these rules. If you're using it in "Agent Mode", you're telling the agent how to act, not just listing rules.
Step #6: Example
A simple example .cursorrules
file (Just that you get the idea)
![](https://a.storyblok.com/f/316774/3224x3160/60d5508558/cursorrules-example.jpeg)
Step #7: Referencing Files with @
You can do to file referencing with the @ symbol
Want to learn more? Ultimate Cursor Course available
Want to build and ship faster with Cursor AI? Get instant access to my Ultimate Cursor Course – Early bird discount available (only in february)!
New update coming soon: Agent Mode, new cursorrules and example lessons!
Click here: Ultimate Cursor Course
Other interesting posts:
Have a look at the rest of my Cursor guides:
- How to use Cursor with a large codebase
- 5 Cursor pro tips for rapid MVP development
- How to add custom documentation in Cursor AI
- How to generate your own Cursorrules
- How to sync Cursor AI with Xcode Projects
Happy coding!🚀
Table of Contents