DEV Community

Zac
Zac

Posted on

Cursor keeps ignoring your project's naming conventions. Here's why.

You've told Cursor your project uses camelCase. It uses snake_case anyway. You've explained that components go in src/components. It puts them in components/. You've said no inline styles. There they are.

This isn't random. It's a specific problem with how rules get loaded and how LLMs weight context.

Why Cursor forgets

Cursor loads .cursorrules at the start of a session. Those rules compete with everything else in context: the code it's looking at, the conversation history, and its own training on patterns from millions of GitHub repos.

The more code in context, the less weight your rules get. A long conversation has the same effect. Your naming conventions are technically in there — they're just getting outweighed by statistical patterns from codebases that do things differently.

What actually works

State rules in the negative, not just the positive

Instead of:

Use camelCase for variable names.
Enter fullscreen mode Exit fullscreen mode

Use:

Use camelCase for variable names. Never use snake_case or PascalCase for variables.
Enter fullscreen mode Exit fullscreen mode

The prohibition matters. Claude (which Cursor uses) is trained to hedge between options. "Never X" removes X from consideration in a way that "prefer Y" doesn't.

Put violated rules first

LLMs weight rules near the top more heavily than ones buried in the middle. If you're always fighting about one specific thing — imports, file structure, naming — put it in the first 5 lines of your .cursorrules.

Reference actual file paths

Vague: Put components in the components folder.

Specific: New components go in src/components/. Never in the project root or in src/ directly.

Paths are concrete. They're less likely to be overridden by spatial reasoning about where things usually live.

Add a when-in-doubt rule

When uncertain about file location or naming, ask before creating. Do not guess.
Enter fullscreen mode Exit fullscreen mode

This catches edge cases your rules don't explicitly cover. Instead of Cursor making a plausible-but-wrong decision, it asks.

The one rule that cuts most of it

If you're only going to add one line:

Before adding a new file, check for an existing file that does the same thing. Only create files that don't already exist.
Enter fullscreen mode Exit fullscreen mode

Duplicated files — a second Button component, a second auth helper, a second utils file — cause more naming and structure drift than almost anything else.


I compiled 30 of these rules — sorted by how often they get violated and what they prevent — in a Cursor Rules Starter Pack at builtbyzac.com/cursor-rules.html. $19, includes .cursorrules files for React, Next.js, and plain TypeScript.

Top comments (0)