ipIterPrompt
RulesetAgent ConfigurationVerified Last verified 2026-07-24

Cursor Project Rules

by Anysphere

Cursor Project Rules are Markdown-with-metadata files stored in your repo under `.cursor/rules/` (the `.mdc` format). Each rule carries frontmatter — a description, glob patterns, and an alwaysApply flag — that decides when Cursor injects it into the model's context. They replace the older single-file `.cursorrules` and let a team encode conventions the agent follows automatically.

Works with

MCP servers, rules, and VS Code-compatible extensions.

When to use it

  • When the agent keeps ignoring your stack's conventions across chats
  • Onboarding a repo so Cursor knows its patterns without re-explaining
  • Enforcing house style (imports, error handling, test framework) at scale

When not to

  • For one-off instructions that belong in a single prompt, not the whole repo

What it does

  • Encode project conventions (style, architecture, libraries) the agent applies automatically
  • Scope rules to specific files via glob patterns, or make them always-on
  • Version rules in git so the whole team shares the same agent behavior

How to install

Setup steps with copy-paste config. Sources are cited under each method.

Add a project rule

Cursor

Requires: Cursor installed · A project folder

  1. Create the rules directory

    Add a `.cursor/rules/` folder at your project root and create a `.mdc` file per rule.

    shell
    mkdir -p .cursor/rules && touch .cursor/rules/conventions.mdc
  2. Write the rule with frontmatter

    The frontmatter's globs/alwaysApply control when the rule loads; the body is the instruction.

    config
    ---
    description: Enforce our TypeScript API conventions
    globs: ["**/*.ts", "**/*.tsx"]
    alwaysApply: false
    ---
    
    - Validate all request bodies with zod.
    - Return typed Result objects; do not throw across module boundaries.
    - Co-locate a Vitest test with every new module.

How to prompt it

Copy-paste prompts written to exercise this plugin, with what to expect.

Let a rule do the reminding

You want new endpoints to always include validation and a test.

Add a POST /users endpoint. Follow the project rules for validation and tests.

What to expect: With the conventions rule in place, Cursor scaffolds the endpoint with zod validation and a co-located test without you spelling out each convention.

  • Keep each rule short and single-purpose; several focused rules beat one giant file.

Tips for getting the most out of it

  • Use `alwaysApply: true` sparingly — always-on rules consume context on every request.
  • Migrate any legacy `.cursorrules` content into `.cursor/rules/*.mdc`; the old flat file is ignored in Agent mode.

Prompts to pair with it

Real prompts from the IterPrompt library you can copy or run.

4.7

Conventional Commit Writer

A SKILL.md that makes your agent write clean conventional commits, every time.

3,420 copiesOpen ↗

Conventional Commit Message Generator

Turn any AI chat into a conventional commit message generator with this community persona prompt.

4,303 copiesOpen ↗

Continue Coding Assistant

Turn any AI chat into a continue coding assistant with this community persona prompt.

4,894 copiesOpen ↗

Landing Page Vibe Coding

Turn any AI chat into a landing page vibe coding with this community persona prompt.

2,478 copiesOpen ↗

Coding Structure with MVC and SOLID Principles

Turn any AI chat into a coding structure with mvc and solid principles with this community persona prompt.

3,547 copiesOpen ↗

Vibe Coding Master

Turn any AI chat into a vibe coding master with this community persona prompt.

4,153 copiesOpen ↗
See more prompts in the library

Frequently asked questions

How is this different from .cursorrules?+

`.cursorrules` was a single flat file. Project Rules live in `.cursor/rules/` as multiple `.mdc` files with frontmatter, so you can scope rules by glob and keep them modular.

Do rules apply to autocomplete too?+

Rules primarily shape the agent/chat context. Confirm current behavior on Cursor's docs, as scope changes between releases.

Pairs well with

Related guides

Alternatives to Cursor Project Rules

Sources & verification

The facts on this page and where they come from. Anything unverified is labeled — we'd rather say "unknown" than guess.

Install steps, pricing, and availability change often. Always confirm on the official page before relying on setup details.