Yeda AI Tips · #028

Cursor Rules: Set It Once

You type "use TypeScript, not JavaScript" into Cursor for the fifth time this week. You explain your team's Tailwind conventions again. Every one of those corrections evaporates the moment the chat ends, because a prompt is not memory — it's a one-time instruction. Cursor Rules fix that permanently.

Why the AI keeps forgetting

A large language model has no persistent state between conversations. Unless something is explicitly re-fed into its context window, it starts from zero every time. That's fine for one-off questions, but it's friction for anything repeated — coding standards, architectural conventions, "always write tests," "never touch the migrations folder." Left alone, you become the model's memory, manually re-pasting the same instructions into every new chat.

Cursor Rules exist specifically to close this gap. A rule is a small, persistent instruction that Cursor reads and injects automatically, so the standard lives in the repo instead of in your typing fingers.

Anatomy of a Cursor Rules file

Rules live in a .cursor/rules folder at the root of your project (Cursor also supports a legacy single .cursorrules file, but the folder form lets you split rules by concern). Each rule file has a rule type that controls when it fires:

Whichever type you use, the mechanism is the same: once the rule is saved, Cursor reads it automatically on the prompts it applies to. You write the standard once; Cursor re-applies it forever.

How to set it up

  1. In your project root, create the folder .cursor/rules if it doesn't exist.
  2. Add a new rule file inside it (Cursor's UI can generate the scaffold, or hand-write a markdown file).
  3. Set the rule type — for a repo-wide standard, choose Always.
  4. Write the instruction plainly: "Always use TypeScript and Tailwind. Do not use inline styles. Match existing naming conventions in the file you're editing."
  5. Save. Every prompt in the project now carries this instruction automatically.

If you don't want to write rules from scratch, cursor.directory hosts a library of community-written rules for specific stacks and frameworks that you can copy directly into your project.

Where rules pay off

Pitfalls

Building an AI feature? Yeda AI designs, audits, and ships production LLM systems.

Talk to us · Read the blog