Example result: Write Cursor project rules for your codebase
AI-generated example · Agent Setup · Rules
Updated

Write Cursor project rules for your codebase

This prompt writes project rules for Cursor's agent, split into small files by topic and scoped to the right folders. It includes a rule to ask before adding new dependencies, a common source of trouble.

text-code-cursor-rules-file — claude code — 89 words

Help me write project rules for Cursor (files in .cursor/rules) for this codebase.

Stack: [e.g. React Native, Expo, TypeScript]
Conventions: [e.g. functional components, Zustand for state, styles in a separate file]
Things the AI keeps getting wrong: [e.g. uses old API, adds new libraries]

Split the rules into a few small files by topic, and say which files or folders each one should apply to. Each rule should be one clear instruction with a short reason. Add a rule telling the AI to ask before adding a new dependency.

Add a rule every time the AI makes the same mistake twice. Rules work best when they come from real problems.

Get a better result

What you will get

A small set of rule files split by topic, each with a clear scope for the files it applies to, one-line instructions with short reasons, and a rule that makes the AI ask before adding a dependency.

Common mistake

The rules are long and vague, like “write clean code”.

Fix: Keep each rule to one instruction you could check in a diff, such as “use named exports, not default exports”, with a reason in a few words.

Also watch for
  • One big file mixes everything and applies everywhere. Ask for separate files for testing, styling and data fetching, each scoped to its own folders so the AI only reads what it needs.
  • Rules contradict the code that already exists. Paste two or three real files and say “write rules that match how this code is already written, and flag anything that conflicts”.
Try a variation: start from mistakes

Paste the last three pieces of AI code you had to fix and ask “write one rule for each problem, so the AI will not repeat it”. Rules built from real misses are the ones that last.

Still not right? Reply with this

Shorten every rule to one line and one reason. Group them by folder, and mark the three rules that matter most for this project.

Guides that use this prompt

More chat & writing prompts

See all 465 →