Part of the Cursor AI Complete Guide (2026) series. This deep dive covers every Rules mechanism Cursor offers — with production-ready templates you can download today.


Why Rules Matter

Large language models do not retain memory between conversations. Rules solve this by providing persistent instructions automatically included whenever the Agent works on your project.

Without Rules, every prompt starts from zero. With Rules, Cursor already knows your TypeScript standards, React patterns, testing framework, and folder structure before you ask for anything.

flowchart LR
    subgraph Without Rules
        P1[Prompt] --> G1[Generic Output]
    end
    subgraph With Rules
        P2[Prompt] --> R[Rules Applied]
        R --> G2[Project-Aligned Output]
    end

Types of Cursor Rules

Rule TypeScopeBest Use
Project RulesCurrent repositoryCoding standards
User RulesEvery projectPersonal preferences
AGENTS.mdEntire projectSimple project instructions
Team RulesOrganisationCompany-wide standards

Team Rules are available on Team and Enterprise plans.

graph TB
    subgraph Rule Hierarchy
        TR[Team Rules] --> UR[User Rules]
        UR --> PR[Project Rules]
        PR --> AG[AGENTS.md]
    end
    AG --> A[Cursor Agent Context]
    PR --> A
    UR --> A
    TR --> A

Project Rules

Project Rules live in:

.cursor/rules/

Each rule is typically an .mdc file with YAML frontmatter and Markdown instructions. They are version-controlled with your repository.

project/
  .cursor/
    rules/
      react.mdc
      typescript.mdc
      testing.mdc
      security.mdc

Example React Rule

---
description: React Best Practices
globs: **/*.tsx
alwaysApply: false
---

- Always use TypeScript.
- Prefer functional components.
- Use React Hooks.
- Avoid class components.
- Use Tailwind CSS.
- Generate accessible JSX.
- Use descriptive prop names.

Rule Frontmatter Fields

FieldPurpose
descriptionShown in Cursor UI; helps the Agent select relevant rules
globsFile patterns that trigger this rule
alwaysApplyIf true, included in every Agent conversation
flowchart TD
    A[Agent Request] --> B{alwaysApply?}
    B -->|Yes| C[Include Rule]
    B -->|No| D{File matches glob?}
    D -->|Yes| C
    D -->|No| E[Skip Rule]
    C --> F[Combined Context]

User Rules

User Rules apply across every project. Configure them in Cursor Settings → Rules → User Rules.

Example:

Keep explanations concise.
Always explain before writing code.
Prefer async/await.
Use British English.

User Rules are plain text — not .mdc files — and are automatically included in Agent conversations.


AGENTS.md

For simpler projects, AGENTS.md provides straightforward instructions without frontmatter:

# Project Instructions

## Code Style
- Use TypeScript
- Use ESLint
- Prefer React Hooks

## Architecture
- Feature-based folders
- Repository pattern
- Zod validation

## Testing
- Vitest
- React Testing Library

Place AGENTS.md in your project root (or nested directories for monorepos). For many smaller projects, this single file is enough.


A practical organisation for larger projects:

.cursor/
  rules/
    react.mdc          # UI components
    typescript.mdc     # Type conventions
    tailwind.mdc       # Styling
    testing.mdc        # Test patterns
    security.mdc       # Auth & validation
    database.mdc       # ORM / queries
    api-routes.mdc     # Backend endpoints

This modular approach keeps guidance maintainable as your codebase grows.


Downloadable Templates

TrendForge publishes production-ready rule packs for popular stacks:

FrameworkDownload
React/downloads/cursor-rules/react/react.mdc
Next.js/downloads/cursor-rules/nextjs/nextjs.mdc
Astro/downloads/cursor-rules/astro/astro.mdc
Python/downloads/cursor-rules/python/python.mdc
Node.js/downloads/cursor-rules/nodejs/nodejs.mdc
Laravel/downloads/cursor-rules/laravel/laravel.mdc

Full index: Cursor Rules Templates


Best Practices

  • Keep each rule focused on one topic — split frontend, backend, testing, security.
  • Provide concrete examples where helpful.
  • Reference templates or files when appropriate.
  • Avoid vague language — “write good code” helps nobody.
  • Commit rules to git so your team shares conventions.
  • Update rules as the project evolves — stale rules produce stale output.

Common Mistakes

  • One massive rule file with hundreds of instructions
  • Rules that never match file globs (wrong paths)
  • Duplicating the same instructions in User Rules and Project Rules
  • Never updating rules after architecture changes
  • Using alwaysApply: true on every rule (context bloat)

Frequently Asked Questions

What is the difference between Rules and AGENTS.md?

Project Rules (.mdc) support globs, descriptions, and selective application. AGENTS.md is a single Markdown file always included — simpler but less granular.

Should I use User Rules or Project Rules for coding standards?

Project Rules. User Rules are for personal preferences that apply everywhere (tone, language, async style).

How many rules should I have?

Start with 3–5 focused rules. Add more only when the Agent consistently violates a specific convention.

Can rules reference other files?

Yes. Point the Agent to templates, example components, or architecture docs in your rule text.


Last reviewed: July 2026