Audit Cursor Rules Files for Conflicts and Context Bloat

Get a line-by-line audit of your .cursor/rules files that flags overlapping globs, contradictory instructions, and token waste, plus a consolidation diff.

Agent prompt for Claude and Gemini

You get: Executive Summary, conflict & Overlap Matrix and context Bloat Audit

Prompt

Prompt
You are a staff developer-experience engineer who maintains Cursor rule sets for large production repositories. I will paste the filenames and contents of my .cursor/rules files right after this prompt.

Audit the rule set for conflicting directives, overlapping glob patterns, and context bloat, then produce a prioritized consolidation plan.

Rules:
1. Check every YAML frontmatter block for overlapping globs, unnecessary alwaysApply flags, and missing descriptions that break auto-attachment.
2. Flag every contradictory instruction across files, citing exact filenames and quoting the conflicting lines.
3. Identify token bloat where rules repeat language defaults, duplicate linter configs, or exceed 120 lines without domain splitting.
4. Provide a consolidation diff for the highest-impact files, keeping each resulting rule focused on one domain and under 80 lines.
5. Never invent project conventions not present in the pasted files.

Output format:
- Executive Summary (3 bullets: files audited, critical conflicts, estimated token reduction)
- Conflict & Overlap Matrix (table: Issue Type, Files Involved, Conflict or Overlap, Fix)
- Context Bloat Audit (bulleted list of redundant or overly broad rules to cut)
- Prioritized Consolidation Diff (Markdown diff block for the top 2 files)
- Verification Checklist (3 steps to test the updated rules in Cursor Composer)

End with one line noting any assumptions or missing files, such as ESLint configs or legacy .cursorrules files, needed to complete the audit.

Example output

Cursor rules audit at a glanceFindings across 6 rule files in a Next.js 15 monorepo
Lines audited
610 lines
6 rule files
Direct contradictions
2
Instruction conflicts between files
Overlapping globs
3
Patterns matching the same files
Always-loaded token reduction
42%
Scope global rules, remove Biome duplicates

Example for: a Next.js 15 TypeScript monorepo with six .cursor/rules/.mdc files where Cursor Composer kept mixing Pages Router and App Router patterns.*

Executive Summary
  • Files audited: 6 rule files totaling 610 lines across core, frontend, and API domains.
  • Critical conflicts found: 2 direct instruction contradictions and 3 overlapping glob patterns.
  • Estimated token reduction: 42% fewer always-loaded tokens by scoping global rules and removing Biome duplicates.
Conflict & Overlap Matrix
Issue TypeFiles InvolvedConflict or OverlapFix
Contradictionapi-routes.mdc, global.mdcglobal.mdc mandates try/catch in every handler, while api-routes.mdc forbids try/catch in favor of withErrorHandler.Remove error-handling rule from global.mdc and defer to api-routes.mdc.
Contradictionnextjs.mdc, legacy-ui.mdcnextjs.mdc requires App Router Server Components; legacy-ui.mdc enforces getServerSideProps on all *.tsx files.Scope legacy-ui.mdc glob strictly to apps/web/pages/**/*.tsx.
Glob Overlapglobal.mdc, typescript.mdcBoth set alwaysApply: true and match **/*.ts, injecting duplicate strict-mode rules into every prompt.Merge TypeScript rules into typescript.mdc with alwaysApply: false and glob **/*.ts,**/*.tsx.
Context Bloat Audit
  • global.mdc (185 lines): 74 lines restate rules already enforced by biome.json (semicolons, import sorting, quote style). Delete them and reference biome check.
  • testing.mdc (140 lines): Includes three full 30-line Vitest boilerplate files. Replace with a 6-line pointer to packages/test-utils/example.test.ts.
  • legacy-ui.mdc: Missing a description field in frontmatter, preventing Cursor from auto-selecting it when editing legacy routes.
Prioritized Consolidation Diff
--- a/.cursor/rules/legacy-ui.mdc
+++ b/.cursor/rules/legacy-ui.mdc
@@ -1,6 +1,7 @@
 ---
-globs: "**/*.tsx"
+description: Legacy Pages Router rules for maintenance only
+globs: "apps/web/pages/**/*.tsx"
 alwaysApply: false
 ---
-Always use getServerSideProps for data fetching in React pages.
+Use getServerSideProps only inside apps/web/pages. For new features, use App Router in apps/web/app.
Verification Checklist
  1. Open apps/web/app/billing/page.tsx and confirm in Cursor Composer context pills that legacy-ui.mdc is no longer attached.
  2. Ask Composer to scaffold a new API route under apps/web/app/api/invoices/route.ts and verify it uses withErrorHandler without raw try/catch.
  3. Check the remaining .mdc files to confirm always-applied rules stay under 1,000 tokens.

Assumptions: Biome handles formatting via CI, and no root .cursorrules file remains in the repository.

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Audits YAML frontmatter globs and alwaysApply flags first, catching the silent auto-attachment overlaps that cause most agent drift.
  • Forces exact file citations and quoted lines for contradictions so you can resolve conflicts without guessing which rule won.
  • Caps consolidated rule files at 80 lines and flags linter duplicates to cut wasted context tokens on every Composer turn.

Paste all your .cursor/rules/*.mdc files (including YAML frontmatter) right after this prompt in Cursor Chat, Claude, or Gemini whenever agent edits start drifting or ignoring conventions.

Common edits

  • Paste your eslint.config.js or biome.json alongside the rule files so the model can strip out every duplicated style rule automatically.
  • Change the 80-line cap to 50 lines if you work in a large monorepo where three or more domain rule files attach simultaneously.

Reuse it: Use in a workflowAdapt in the builder

Prompt details

By
Prompts-GPT editors
Published
How prompts are written and checked

Did this prompt work?

More in Cursor

Create a Deterministic Code Review System Prompt for Cursor

Generates a strict, rule-based system prompt for Cursor that rejects subjective nitpicks and only reports verified regressions and broken contracts.

Audit a Pull Request Diff for Breaking API Changes

Separates wire-breaking schema, status code, and migration changes from safe additions, returning a consumer impact table and deprecation plan.

Audit a TypeScript API Route for Race Conditions, Auth, and N+1 Bugs

Get a severity-ranked security and performance audit of your TypeScript API route with exact line numbers, concrete exploit or failure scenarios, and minimal targeted fix diffs.

Compare Three Feature Architectures Against Module Boundaries

Get a scored trade-off matrix comparing three feature architectures by file touchpoints, coupling risks, and rollback cost before running Cursor Composer.

AI Coding AgentsClaude Code

Audit AI Code Diffs for Performance Regressions

This prompt scans code changes for silent performance killers like N+1 queries, unindexed filters, and memory leaks before you merge them.