Pillar Specification & Hub DirectoryCursor Rules (.mdc) Directory & Generator
Modular, glob-targeted rules for Cursor AI. Keep token overhead near zero while steering the LLM with production architectural guardrails.
.cursor/rules/<rule-name>.mdcHow Cursor Rules (.mdc) Operates in Production
Cursor Project Rules (.cursor/rules/*.mdc) represent the modern standard for AI-assisted development in Cursor IDE. Unlike legacy monolithic .cursorrules files which flood the context window on every prompt, .mdc rules attach conditionally using file glob patterns (e.g. `src/components/**/*.tsx`) and frontmatter directives (`alwaysApply: false`). This guarantees that your model only loads rules relevant to the exact files being edited.
Every .mdc file begins with YAML frontmatter specifying its description and target file globs.
---
description: Next.js 15 App Router and Server Actions standard
globs: src/app/**/*.{ts,tsx}
alwaysApply: false
---Direct instructions constraining how Cursor proposes modifications.
## Behaviors
- Deliver surgical diffs; never rewrite entire 200-line files.
- Inspect surrounding imports and tsconfig paths before adding packages.
- Always use typed Zod schemas for input validation..cursor/rules/nextjs.mdcsrc/app/**/*Enforces React Server Components, Server Actions, and Next.js 15 conventions on App Router routes.
.cursor/rules/database.mdcsrc/db/**/*, prisma/schema.prismaEnforces database indexing, migrations, parameterized SQL, and ORM type safety.
.cursor/rules/testing.mdc**/*.test.ts, **/*.spec.tsxEnforces Vitest or Playwright testing conventions, mocking standards, and coverage requirements.
Available Tech Stack Presets (18)
Click any tech stack below to open the client-side editor preloaded with this verified configuration.
Next.js 15 App Router
Generate strict Next.js 15 App Router Cursor rules with React Server Components, Server Actions, and Zod validation.
"Enforce React Server Components (RSC) by default; restrict 'use client' strictly to interactive leaf components."
React 19 & Vite
Generate modern React 19 SPA Cursor rules enforcing custom hooks, TanStack query caching, and avoiding redundant useEffects.
"Use React 19 action hooks (useActionState, useOptimistic, useFormStatus) for async mutations."
Python FastAPI & Pydantic v2
Generate strict Python FastAPI Cursor rules with Pydantic v2 schemas, async endpoints, and AI agent integrations.
"Use strict Pydantic v2 BaseModels with Field validation for all input and output schemas."
Supabase & PostgreSQL
Generate Supabase Cursor rules enforcing Row-Level Security (RLS), typed client queries, and Server Component auth guards.
"Always include `ENABLE ROW LEVEL SECURITY;` on every created table."
Prisma ORM
Generate Prisma ORM Cursor rules enforcing transaction safety, indexed queries, and minimal payload selections.
"Always use `select` to specify required fields; avoid raw `findMany()` fetching unused relations."
Drizzle ORM
Generate Drizzle ORM Cursor rules with relational queries, type-safe SQL migrations, and prepared statements.
"Define schemas using pgTable/sqliteTable with explicit foreign keys and constraints."
Go (Golang) & Fiber
Generate Go Fiber Cursor rules enforcing idiomatic error handling, context propagation, and zero-allocation routing.
"Check every `if err != nil` explicitly; never swallow errors or ignore returned values."
Rust & Axum
Generate Rust Axum Cursor rules enforcing type-safe extractors, Result error handling, and Tokio async runtimes.
"Never call `.unwrap()` or `.expect()` in production route handlers; propagate errors via `Result<T, AppError>`."
Tailwind CSS v4
Generate Tailwind CSS v4 Cursor rules enforcing CSS-first theme configuration, @theme directives, and zero tailwind.config.js.
"Configure themes directly in globals.css using `@theme` and `@import 'tailwindcss';`."
Vue 3 & Nuxt 3
Generate Vue 3 & Nuxt 3 Cursor rules with Composition API, script setup, and Nitro server routes.
"Always use `<script setup lang='ts'>` and the Composition API; ban legacy Options API."
SvelteKit 5 & Svelte 5
Generate SvelteKit 5 Cursor rules enforcing Svelte 5 Runes ($state, $derived), form actions, and load functions.
"Use Svelte 5 runes: `$state()`, `$derived()`, and `$props()`."
Universal Cursor Pro
Generate modular, strict Cursor rules enforcing minimal diffs, zero-any typing, and pragmatic architecture.
"Deliver surgical, targeted diffs; never replace entire files unnecessarily."
Pragmatic Rapid Prototyping
Generate high-velocity, pragmatic vibe coding Cursor rules prioritizing fast feedback loops and flat structures.
"Prioritize working software over complex design patterns or deep inheritance hierarchies."
Zero-Trust Security
Generate strict security Cursor rules focused on mitigating SQL injection, XSS, and insecure endpoints.
"Flag and prevent any dynamic SQL query string interpolation."
Docker & CI/CD
Generate Docker & DevOps Cursor rules enforcing multi-stage builds, non-root users, and minimal Alpine/Debian base images.
"Always use multi-stage Docker builds to separate builder tools from the lean production image."
Vitest & Playwright TDD
Generate Test-Driven Development Cursor rules enforcing Vitest/Jest unit tests, edge-case coverage, and mocking discipline.
"Write unit tests covering happy paths and at least two edge/error cases for every new function."
Automated Code Reviewer
Generate production-grade Cursor rules (.mdc) for Automated Code Reviewer.
"Scan repository manifests to map stack idioms before evaluating logic."
Multi-Agent System Orchestration
Generate production-grade Cursor rules (.mdc) for Multi-Agent System Orchestration.
"Define subagent roles: Lead Architect, Frontend Engineer, Backend Specialist, Security Reviewer."
What is the difference between .cursor/rules/*.mdc and legacy .cursorrules?
The legacy .cursorrules file is a single monolithic document loaded on every single user interaction, quickly consuming context window limits and causing rule confusion. Modern .mdc rules support YAML frontmatter with file globs and 'alwaysApply: false', activating only when relevant files are being edited.
Where should I save .mdc files in my project?
Save your rules in the `.cursor/rules/` directory at the root of your repository (for example: `.cursor/rules/react-19.mdc`). Cursor automatically detects and indexes this directory.
Can I use wildcards in glob patterns?
Yes. You can use standard globbing syntax such as `src/components/**/*.{ts,tsx}`, `api/**/*.py`, or comma-separated lists to bind rules to specific directory trees.