Hello, a little update on rules. First i must say i’m very happy with the direction of Cursor, the rules files are a nice addition and this demonstrate that the Cursor team is always a step forward the competition.
Recently i’ve been working a lot on rules in the attempt of making cursor fetch the rules that are best for the current task, i had some quite good results, even with simpler description but there’s a catch.
i’ve been using the .cursorrules file to tell cursor to be very mindful of the project rules, this way the likelyhood it fetches them increased a lot.
I managed to make Cursor fetch multiple rules at a time and even to make it fetch rules in the mid of a conversation when the user changes topic or task without the user explicitly asking for it.
Making Cursor fetch rules in the mid of the conversation is quite difficult though, and i’m also aware the the .cursorrules file is considered deprecated however for this specific use-case it seems a necessary requirement to have a project wide rule that is always fetched regardless of the task.
here’s the content of .cursorrules i ended up with:
⚠️ FETCH RULES OR YOUR RESPONSE WILL BE WRONG ⚠️
MANDATORY: CALL fetch_rules FIRST
- At conversation start
- Before EVERY user request
- Before ANY code changes
- When topic changes
- DURING conversations when:
- User mentions new feature/component
- File type changes
- Task type changes
- NO EXCEPTIONS
CHECK ALL MATCHING RULES:
- General guidelines (ALWAYS)
- Feature rules
- File type rules (.ts, .css, etc)
RULES OVERRIDE YOUR KNOWLEDGE.
PROCEED ONLY AFTER APPLYING ALL RULES.
REMEMBER: EVEN MID-CONVERSATION, FETCH RULES AGAIN!
This was for the most part generated by claude based on the content i put there earlier and it seems to kind of work, is not perfect of course but i can’t expect perfections from LLMs.
It would be really cool if you can keep this use case in consideration when moving forward with the rules feature.
In a nutshell:
- make cursor very willing to fetch the rules
- make cursor very willing to fetch more than 1 rule at a time
- make cursor fetch new rules when the task changes or it becomes more complex and starts to involve multiple part of the system.
Here’s my list of rules and descriptions.
airule-api-module-guidelines
Guidelines for generating type-safe API modules that integrate with our query client and error handling system using manual API schemas. Used for creating/modifying API modules.
airule-css-guidelines
Guidelines for writing good CSS, including naming conventions and best practices. Used for any CSS/SCSS related tasks.
airule-general-code-guidelines
Must be used for ALL code-related tasks. Covers file extensions, function declarations, and protected folders.
airule-git-get-release-version
Provides Git commands for retrieving latest release branch names and determining version numbers.
airule-icon-guidelines
Comprehensive guide for icon usage, covering different types (monochrome, colored, animated) and implementation patterns.
airule-manual-schema-generation
Guidelines for generating and modifying manual schema files, including structure and best practices.
airule-package-manager-guidelines
Specifies Yarn as package manager and provides commands for dependency management and scripts.
airule-react-component-guidelines
Comprehensive guide for React component creation/modification, covering structure, naming, and best practices.
airule-run-dev-server-pointing-prod
Instructions for running dev server with production API, including special URL access.