CURSOR RULES

How to Test Cursor Rules: Check Each One Actually Works

You added a rule that says "always use the App Router", Cursor still generated a pages/ file, and now you do not know whether the rule is broken, badly worded, or never loaded at all. Without a test, you will keep stacking rules on top of each other and hoping. That costs you context budget on every request and leaves you with rules nobody can justify.

To test Cursor rules is to run the same prompt with and without a rule and compare the output against a pass/fail check you wrote beforehand. This guide walks through that method, a table for diagnosing the usual failures, and the point where doing it by hand stops being worth your time. BuyCoded sells rule packs, so we have had to answer the question of whether any given rule earns its place.

What does it mean to test a Cursor rule?

Testing a rule means proving it changes the model's output in the direction you intended. A rule that cannot be shown to flip a failing result into a passing one is a guess, not a rule.

That sounds heavy, but each test is small: one assertion, one probe prompt, one comparison. The key idea is that you test the behavior the rule is meant to cause, not the rule text. "Prefer server components" is not testable. "The generated file contains no use client directive when it has no event handlers" is.

Treat the rule file the way you treat code. If you would not merge a function without a way to check it, you should not keep a rule without one either.

How do you test a Cursor rule step by step?

Use the same seven steps for every rule, in this order. The whole loop takes a few minutes per rule once you have a probe prompt saved.

  1. Write the assertion. State the failure in one sentence that a command can check, such as "no file under pages/ is created" or "imports use the @/ alias, never ../../".
  2. Save a probe prompt. Write a short, fixed request that tends to trigger the failure, for example "add a settings page with a form that saves the user's display name". Keep it identical across every run.
  3. Run a baseline with the rule disabled. Move the rule file out of the rules folder or turn it off, open a fresh chat, run the probe, and record whether the assertion passes. If it already passes, the rule is redundant and you can delete it.
  4. Enable the rule and run three times. Use a fresh chat each time so earlier answers do not carry over. Three runs is enough to catch a rule that only works some of the time.
  5. Check with a command, not your eyes. Use grep, a type check, or a linter on the generated files. Reading the output yourself makes you see what you hoped to see.
  6. Run a scope check. Open a file that should not match the rule and confirm the rule is not attached there. A rule that loads everywhere costs tokens on every request.
  7. Record the result. Keep a one-line note per rule: assertion, baseline result, with-rule result. That note is what lets you delete rules later without fear.

The baseline in step three is the part most people skip, and it is the most useful. Modern models already follow many common conventions without being told, so a surprising share of rules in a typical set change nothing.

Why does a Cursor rule fail the test?

A rule that fails the test almost always fails for one of four reasons: it never loaded, it loaded but is vague, it conflicts with another rule, or the probe prompt overrides it. The table below maps each symptom to a cause and to the check that confirms it.

SymptomLikely causeHow to confirm
Output is identical with and without the ruleRule did not load, or the glob does not match the file you are editingCheck the rule's frontmatter globs against the real file path, and see whether the chat lists the rule as attached
Rule works in one run but not the nextWording is advisory, such as "try to" or "prefer"Rewrite as a plain imperative with a concrete example and rerun three times
Rule works alone but fails in your projectAnother rule says the oppositeDisable rules one at a time until the assertion passes, then compare the two texts
Rule is followed until you ask for something specificThe prompt contradicts the rule and the prompt winsAdd the constraint to the probe prompt and see whether the rule still holds
Rule never seems to matterBaseline already passesRun step three; if the baseline passes, delete the rule

The first row catches the most cases. In the .mdc format, a rule is attached automatically only if it is marked always-apply or its globs match, or if its description lets the agent pull it in. A rule with no description, no globs and always-apply off is effectively dead weight until you mention it by name.

Which Cursor rules should you test first?

Test the rules that guard against expensive mistakes first: wrong framework patterns, wrong import style, unsafe data handling and anything that breaks the build. Leave cosmetic preferences for last, because a missed formatting rule is cheap to fix by hand.

A practical order is: rules that are always-apply, then rules scoped to your most-edited folders, then everything else. Always-apply rules are first because they are the ones that spend context on every single request, so each one has to justify itself. If you are unsure how many to keep loaded, the posts in our blog archive on rule budgets are a good companion to this method.

One original rule of thumb we use: if a rule fails its baseline test by passing already, delete it, and if it fails its with-rule test after one rewrite, delete it too. A rule you have rewritten twice and still cannot make pass is usually trying to enforce something that belongs in a linter or a type check, not in a prompt.

Can you test a whole rule pack instead of one rule at a time?

Yes, but only by sampling. Testing every rule individually works for the ten or twenty rules you wrote yourself; it does not scale to a pack with hundreds of them.

For a large set, test at the stack level. Pick the three or four rules that matter most for your stack, run the seven-step loop on those, and treat the rest as scoped reference that only loads for matching files. That is where the manual method becomes tedious: writing, scoping and wording hundreds of rules across stacks is a project of its own. BuyCoded's Cursor Rules Mega-Pack ships 1,057 rules across 20 stacks in both Cursor formats, so you can start from a ready-made set and spend your testing time on the rules specific to your codebase rather than on drafting the generic ones.

What is the main objection to testing rules this way?

The common objection is that this is too much process for a text file. It is a fair point if you keep five rules; at that size, just read the output.

The process pays off once rules are shared across a team or you start to see inconsistent output you cannot explain. Each test is a few minutes, and a single deleted dead rule saves context on every future request. The alternative is the debugging session you are probably having now, where you cannot tell whether the rule or the prompt is at fault.

What should you do next?

Pick the one rule you most wish Cursor would follow, write its assertion, and run the baseline today. If you would rather start from a ready-made stack-by-stack set than from an empty rules folder, browse the BuyCoded product catalog, pick the pack for your tools, and download it after checkout to run the same seven steps on the rules that matter to you.

Frequently asked questions

How do I know if a Cursor rule is being applied?

Check the rule's frontmatter first. A rule loads automatically only when it is marked always-apply or its globs match the file you are editing, or when its description lets the agent pull it in. Then compare output with the rule on and off in fresh chats. If both runs are identical, the rule is not affecting the result.

How many times should I run a Cursor rule test?

Run it three times with the rule enabled, each in a fresh chat, plus one baseline run with the rule disabled. A single run can pass by luck. Three consistent passes show that the wording is firm enough to hold, while one pass followed by a failure tells you the rule needs a clearer imperative.

Why does Cursor ignore my rules sometimes?

The most common causes are a glob that does not match the file, advisory wording like try to or prefer, a conflicting rule, or a prompt that asks for the opposite. Disable rules one at a time to find a conflict, and add the contradicting constraint to your probe prompt to see whether the prompt is overriding the rule.

Should I delete a Cursor rule that passes without being enabled?

Yes. If the baseline run already passes your assertion with the rule disabled, the rule adds no behavior and only costs context. Delete it, record that in your notes, and spend the saved context budget on rules that actually flip a failing result into a passing one.

Can a linter replace a Cursor rule?

For many conventions, yes. Import order, unused variables and formatting are better enforced by a linter or type check that fails the build than by a prompt. Keep Cursor rules for guidance a tool cannot check, such as which framework pattern to choose or how to structure a new feature.