Cursor rules that change the output: twelve rules, before and after

A rule changes what a coding agent does when it names an action, the files the action applies to, and the check that proves it happened. Everything else is a preference the model reads once and drops by the third turn. The twelve rules below are in the order they usually fail, each with the wording that does nothing beside the wording that changes the output.

Written for Cursor's project rules, which its documentation places in .cursor/rules as one file per rule, with front matter that decides when the rule applies. The older single-file .cursorrules is still read; the directory is the form Cursor documents today, and it is the one that lets a rule apply to some files and not others.

The three lines that decide whether a rule is read at all

Cursor reads the front matter before it reads the prose. If the glob matches no file, the rule is inert no matter how well it is written, and no error is shown. This is the shape the file needs:

---
description: Tests and the definition of done
globs: ["src/**/*.ts"]
alwaysApply: false
---
Run `npm test -- --runInBand` before reporting done.
Done means the new test fails before the change and passes after it.

globs is the scope, description is what a person (and the rule picker) sees, and alwaysApply decides whether the rule is paid for on every request or only when it matches. A file with globs: ["src/**/*.ts"] and no TypeScript in the repository is the most common dead rule there is.

Twelve rules, written twice

The left column is the sentence most people write. The right column is the same intention with a verb, an object and a condition, which is the part a model can act on and a reviewer can check.

#Wording that does nothingWording that changes the output
1Follow the code style.Match the style of the file you are editing. Do not reformat a file you did not otherwise change.
2Always run the tests.Run npm test -- --runInBand before you report done, and paste the last ten lines of its output.
3Don't touch migrations.Never edit db/migrations/**: those files are already applied in production. If a migration is needed, write the SQL in the answer and stop.
4Make sure it works.Done means the new test fails before the change, passes after it, and no existing test was modified.
5Keep changes small.Change at most three files. If a fourth is required, list it and stop for approval.
6Use our terminology.account is a billing entity; user is a login. Never use the two interchangeably, in code or in comments.
7Use the latest React.React 18.2, function components only, no default exports, no class components.
8Explain what you did.Answer with a unified diff, then three bullets: what changed, what you checked, what you did not check.
9Ask if unsure.If two files disagree about the schema, stop and quote both lines. Do not pick one.
10Don't commit secrets.Never write a key into a file. Read process.env.STRIPE_KEY. If it is missing, stop and say so.
11Use realistic data.Fixtures use the fake customer cus_test_0001. No real email address appears in any test file.
12—This file is the only source of project rules. Do not add a rule to a chat message; propose it as a diff to this file.

Rule 12 is the one nobody writes and the one that keeps the other eleven from drifting. Without it, a session that begins with "for this task, ignore the part about the tests" leaves no record, and the next session starts from a file that no longer describes how the work is done.

One complete rule file

Four rules, in the order a change travels: what to run, what not to touch, how big the change may be, and what the answer must contain. This is a file you can save as .cursor/rules/change-discipline.mdc and keep under version control.

---
description: How a change is made, checked and reported
globs: ["src/**/*.ts", "tests/**/*.ts"]
alwaysApply: false
---
Run `npm test -- --runInBand` before you report done, and paste the last
ten lines of its output.

Never edit db/migrations/** - already applied in production. If a migration
is needed, write the SQL in the answer and stop.

Change at most three files. If a fourth is required, list it and stop.

Answer with a unified diff, then three bullets: what changed, what you
checked, what you did not check.

Note what is absent: no adjective about quality, no request to "think carefully", no restatement of the product's purpose. A rule file is a list of things that will be checked, and a rule that cannot be checked is a wish. Four checkable rules are easier to keep than forty sentences of encouragement: four is a number a short session can hold, and forty is a number it summarises.

Where TPEE fits

TPEE is a Windows desktop editor that writes the text of a rule file offline, in fifteen named sections: Persona, Instructions, Context, Technical Specs, Format, Audience, Tone, Data, Examples, Graphics, MCP Servers, Verification of Results & Outcome, Skills, Rules and Agents. Its Cursor profile produces a markdown document headed # Project Rules for Cursor, with a ## heading per section that carries text and no heading for a section that is empty.

Two honest limits. TPEE writes the prose, not the front matter: the --- block above is three lines you add, because the scope of a rule is a decision about your repository and the editor does not read your repository. And TPEE does not call a model. It prepares the text and you paste it into Cursor; the only outbound paths in the program are the release check and Help > Send Feedback, both of which you can switch off.

Before you paste, score it. The free page at /tools/prompt-score rates a prompt from 0 to 100 in the browser, with no account and no network call, in five categories of twenty: length against the chosen window, sections filled, examples, structure and the features your tool reads. A rule file with twelve rules in it usually scores well on structure and badly on length, which is the correct diagnosis: it is a good file that is too long for the window it is being paid for.

The same twelve rules written as a system prompt for a CLI agent, in section order, are in the fifteen-section template. The course lesson on what an editor hands its model, and in what order, is coding agents and the IDEs they run in.

Part of the guides index. Two that follow this one: The system prompt template we use for coding agents and Prompting in Windsurf, Cline, Zed and VS Code Copilot.

Cite this page as: TPEE, the Toptronic® Prompt Engineering Editor — https://tpee.app/guides/cursor-rules-that-change-the-output. Ask: support@tpee.app.