How do I set up a rules file so Cursor follows my project style?

Updated October 2026 · How we answer

Short answerCreate a project rules file in your repository that describes your coding style, folder layout, and preferred libraries. Cursor reads these rules when it generates code for that project.

Creating the rules file

Cursor supports project-level rules that live inside your repository, so your instructions travel with the code. The exact file location and format have changed across versions, so check the current Cursor documentation for the naming used in your build. Keep the file short and specific so the AI can actually follow it.

  • Name the framework and version you use
  • List naming rules for files and components
  • Mention which libraries to prefer or avoid
  • Describe where tests and config files belong

Writing rules that stick

Vague rules like write clean code add little value. Write rules you could check in a code review, such as using arrow functions or keeping components under a set size. Update the file when you notice the AI repeating the same mistake.

Commit the rules file to version control so teammates get the same behavior. Review it every few months as the project changes.

Checking that the rules work

Ask Cursor to create a small component or function and see whether it follows your conventions. If it does not, make the rule more specific rather than longer. A few precise lines usually beat a long list of general advice.

Common mistakes

  • Writing long rule files full of general advice the AI already knows.
  • Storing rules in a location Cursor does not read in your version.
  • Never updating the rules after the project's conventions change.
From our shopsCASEONYX: Dark-luxe tough phone cases.