Good examples of .cursorrules file?

Are there any references / best practices to get the most out of this new feature?

  • .cursorrules: You can write down repo-level rules for the AI by creating a .cursorrules file in the root of your repository. You might use this to give for context on what you’re building, style guidelines, or info on commonly-used methods.
3 Likes

.cursorrules is just a repo-specific “Rules for AI,” so this thread might serve as inspiration:

2 Likes

@truell20

Can you please let me know:

  1. Where is the .cursorrules file located?

  2. Is there just one .cursorrules file?

  3. In Cursor Settings > General, what is the relationship between:

  • The Rules for AI textarea field
  • The Include .cursorrules file toggle option
  1. Do rules added to the Rules for AI textarea automatically get added to a .cursorrules file?

I am having difficulty conceptualising what these two field settings do, how they relate to each other and what their scope is.

I added a ‘rule’ to the Rules for AI area:

Start your response with a pirate joke.

thinking that it might create a .cursorrules file in the folder where I was working, but it didn’t.

Thank You.

Edit:

Maybe this is related, but I’d love more clarification, thank you.

https://forum.cursor.com/t/split-rules-for-ai-into-global-and-workspace-project-scopes/1708/5?u=litecode

2 Likes

@litecode

  1. Create a .cursorrules in the root of your repo. It’s like a .gitignore.

  2. Yes.

  3. Rules for AI is global, if .cursorrules present in repo, will be appended (i guess? maybe prepended) to rules for AI.

  4. No. Rules for AI is like how you want your ai model to respond in any scenario/context, not just current repo.

1 Like

If you have a repo with multiple programming languages in it, can I just add a .cursorrules file in each root folder for each language?