Cursor Rules Directory

Cursor Rules Directory

A template library for .cursor/rules files, including frontend, backend, monorepo, testing, and review rules.

Last updated: June 17, 2026

Feature Comparison

TemplateUse whenSuggested file
Project baselineEvery repo needs commands and core conventions.cursor/rules/project.mdc
Frontend React or Next.jsComponents, routes, styling, accessibility.cursor/rules/frontend.mdc
Backend APIRoutes, services, database access, auth boundaries.cursor/rules/backend.mdc
Monorepo packageDifferent packages have different commands.cursor/rules/package-name.mdc
TestingTest naming, fixtures, mocks, and commands.cursor/rules/tests.mdc
Review guardrailsPrevent risky edits and unrelated churn.cursor/rules/review.mdc

Directory Structure

Keep rules close to the repository and name files by the workflow or area they govern.

.cursor/
  rules/
    project.mdc
    frontend.mdc
    backend.mdc
    tests.mdc
    review.mdc

Project Baseline Template

Use this as the first rule in a new repository, then customize the commands to match the actual package manager.

---
description: Project baseline rules
globs: ["**/*"]
---
Use the existing architecture before adding new abstractions.
Prefer small, reviewable diffs.
Run the narrowest relevant test first, then run the full build before release.
Do not edit generated files unless the task explicitly requires it.

Frontend Template

Scope frontend rules to app and component files so Cursor sees them when it edits UI code.

---
description: Frontend rules
globs: ["app/**/*", "components/**/*", "src/**/*.{tsx,jsx,css}"]
---
Use existing components and design tokens before creating new patterns.
Keep interactive states accessible.
Check mobile layout for text wrapping and overflow.
Run npm run build after route or component changes.

Backend Template

Backend rules should name ownership boundaries and data safety expectations.

---
description: Backend API rules
globs: ["api/**/*", "server/**/*", "src/**/*.{ts,js}"]
---
Keep validation close to request boundaries.
Do not widen auth or database permissions without explicit review.
Prefer existing service helpers before adding new clients.
Run targeted API tests for route, schema, or migration changes.

Generate A Custom Rule

Use the local generator when you want a project-specific .cursor/rules/project.mdc file with stack, commands, style, and review expectations filled in.

FAQ

Where should Cursor Rules live?

Project rules commonly live under .cursor/rules in the repository, with one or more .mdc files.

Should I create many Cursor Rules files?

Only when scope helps. Start with project.mdc, then split by frontend, backend, tests, or package when the instructions differ.

Can Cursor Rules include commands?

Yes. Good rules include real install, lint, test, typecheck, and build commands that apply to the files being edited.

Should Cursor Rules be committed?

Usually yes, if they represent team conventions and do not include secrets or local-only paths.