← All guides

How to fix Cursor rule conflicts

When two rules say different things, Cursor picks one silently.

What's a rule conflict?

You have typescript-style.mdc that says "always use semicolons" and prettier-config.mdc that says "no semicolons." Both have alwaysApply: true. Both match your TypeScript files.

Cursor doesn't warn you. It picks one, seemingly at random, and you spend 20 minutes wondering why your code style keeps flipping.

Where conflicts hide

Same-format conflicts are the obvious ones. Two .mdc files with contradictory instructions. These are easy to spot in small projects, impossible in large ones.

Cross-format conflicts are sneakier. Your .mdc rules say one thing, your CLAUDE.md says another, and your legacy .cursorrules file (that you forgot existed) says a third. Cursor loads all of them.

Glob overlap conflicts happen when two rules both match the same files but give different instructions. One rule targets *.ts and another targets src/**/*.ts. They both fire on the same file.

How to find them

Run cursor-doctor's scan to get a health check that flags potential conflicts:

npx cursor-doctor scan

For detailed conflict analysis across all formats, use the conflicts command:

npx cursor-doctor conflicts

This compares every rule pair, checks for glob overlaps, and reports contradictory directives like "always use X" vs "never use X."

As of v1.10.0, cursor-doctor also detects semantic conflicts automatically. It checks 48 contradiction patterns across 18 topics: tabs vs spaces, single vs double quotes, functional vs class components, async/await vs callbacks, and more. These fire during scan and lint with no extra flags needed.

How to fix them

  1. Pick one source of truth per topic. If you have style rules, put them in one file. Don't split "use semicolons" and "use single quotes" across three files.
  2. Use globs to narrow scope. Instead of two alwaysApply: true rules fighting, make one apply to src/**/*.ts and the other to tests/**/*.ts.
  3. Delete your .cursorrules file. If you have both .cursorrules and .cursor/rules/*.mdc, Cursor loads both and .mdc takes precedence on conflicts. Run npx cursor-doctor migrate to convert, then delete the legacy file to avoid contradictions.
  4. Check CLAUDE.md and AGENTS.md. If you use Claude Code alongside Cursor, make sure your context files don't contradict your Cursor rules.

Rule of thumb: If you can't explain which file controls a given behavior, you have a conflict. Every instruction should have exactly one home.

Prevent future conflicts

Run cursor-doctor scan as a pre-commit hook or in CI. Add it to your GitHub Actions workflow:

- uses: nedcodes-ok/cursor-doctor@v1

This catches conflicts before they merge into your main branch.

Related guides

Scan your project now

One command finds conflicts, broken frontmatter, token waste, and 100+ other issues.

npx cursor-doctor scan