StarPillar Specification & Hub Directory

Cursor Rules (.mdc) Directory & Generator

Modular, glob-targeted rules for Cursor AI. Keep token overhead near zero while steering the LLM with production architectural guardrails.

Open Blank Studio Editor
Target: .cursor/rules/<rule-name>.mdc
01 / SPECIFICATION & RUNTIME BEHAVIOR

How 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.

YAML Frontmatter ScopingSpec Syntax

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
---
Behavioral GuardrailsSpec Syntax

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.
02 / REPOSITORY PLACEMENT
.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.prisma

Enforces database indexing, migrations, parameterized SQL, and ORM type safety.

.cursor/rules/testing.mdc**/*.test.ts, **/*.spec.tsx

Enforces Vitest or Playwright testing conventions, mocking standards, and coverage requirements.

03 / PRESET SPOKE MATRIX

Available Tech Stack Presets (18)

Click any tech stack below to open the client-side editor preloaded with this verified configuration.

FrontendLaunch

Next.js 15 App Router

Generate strict Next.js 15 App Router Cursor rules with React Server Components, Server Actions, and Zod validation.

Enforced Invariant:

"Enforce React Server Components (RSC) by default; restrict 'use client' strictly to interactive leaf components."

FrontendLaunch

React 19 & Vite

Generate modern React 19 SPA Cursor rules enforcing custom hooks, TanStack query caching, and avoiding redundant useEffects.

Enforced Invariant:

"Use React 19 action hooks (useActionState, useOptimistic, useFormStatus) for async mutations."

BackendLaunch

Python FastAPI & Pydantic v2

Generate strict Python FastAPI Cursor rules with Pydantic v2 schemas, async endpoints, and AI agent integrations.

Enforced Invariant:

"Use strict Pydantic v2 BaseModels with Field validation for all input and output schemas."

Fullstack & DBLaunch

Supabase & PostgreSQL

Generate Supabase Cursor rules enforcing Row-Level Security (RLS), typed client queries, and Server Component auth guards.

Enforced Invariant:

"Always include `ENABLE ROW LEVEL SECURITY;` on every created table."

Fullstack & DBLaunch

Prisma ORM

Generate Prisma ORM Cursor rules enforcing transaction safety, indexed queries, and minimal payload selections.

Enforced Invariant:

"Always use `select` to specify required fields; avoid raw `findMany()` fetching unused relations."

Fullstack & DBLaunch

Drizzle ORM

Generate Drizzle ORM Cursor rules with relational queries, type-safe SQL migrations, and prepared statements.

Enforced Invariant:

"Define schemas using pgTable/sqliteTable with explicit foreign keys and constraints."

BackendLaunch

Go (Golang) & Fiber

Generate Go Fiber Cursor rules enforcing idiomatic error handling, context propagation, and zero-allocation routing.

Enforced Invariant:

"Check every `if err != nil` explicitly; never swallow errors or ignore returned values."

BackendLaunch

Rust & Axum

Generate Rust Axum Cursor rules enforcing type-safe extractors, Result error handling, and Tokio async runtimes.

Enforced Invariant:

"Never call `.unwrap()` or `.expect()` in production route handlers; propagate errors via `Result<T, AppError>`."

FrontendLaunch

Tailwind CSS v4

Generate Tailwind CSS v4 Cursor rules enforcing CSS-first theme configuration, @theme directives, and zero tailwind.config.js.

Enforced Invariant:

"Configure themes directly in globals.css using `@theme` and `@import 'tailwindcss';`."

FrontendLaunch

Vue 3 & Nuxt 3

Generate Vue 3 & Nuxt 3 Cursor rules with Composition API, script setup, and Nitro server routes.

Enforced Invariant:

"Always use `<script setup lang='ts'>` and the Composition API; ban legacy Options API."

FrontendLaunch

SvelteKit 5 & Svelte 5

Generate SvelteKit 5 Cursor rules enforcing Svelte 5 Runes ($state, $derived), form actions, and load functions.

Enforced Invariant:

"Use Svelte 5 runes: `$state()`, `$derived()`, and `$props()`."

Specialist PersonaLaunch

Universal Cursor Pro

Generate modular, strict Cursor rules enforcing minimal diffs, zero-any typing, and pragmatic architecture.

Enforced Invariant:

"Deliver surgical, targeted diffs; never replace entire files unnecessarily."

Specialist PersonaLaunch

Pragmatic Rapid Prototyping

Generate high-velocity, pragmatic vibe coding Cursor rules prioritizing fast feedback loops and flat structures.

Enforced Invariant:

"Prioritize working software over complex design patterns or deep inheritance hierarchies."

Specialist PersonaLaunch

Zero-Trust Security

Generate strict security Cursor rules focused on mitigating SQL injection, XSS, and insecure endpoints.

Enforced Invariant:

"Flag and prevent any dynamic SQL query string interpolation."

DevOps & ToolingLaunch

Docker & CI/CD

Generate Docker & DevOps Cursor rules enforcing multi-stage builds, non-root users, and minimal Alpine/Debian base images.

Enforced Invariant:

"Always use multi-stage Docker builds to separate builder tools from the lean production image."

Specialist PersonaLaunch

Vitest & Playwright TDD

Generate Test-Driven Development Cursor rules enforcing Vitest/Jest unit tests, edge-case coverage, and mocking discipline.

Enforced Invariant:

"Write unit tests covering happy paths and at least two edge/error cases for every new function."

Specialist PersonaLaunch

Automated Code Reviewer

Generate production-grade Cursor rules (.mdc) for Automated Code Reviewer.

Enforced Invariant:

"Scan repository manifests to map stack idioms before evaluating logic."

Specialist PersonaLaunch

Multi-Agent System Orchestration

Generate production-grade Cursor rules (.mdc) for Multi-Agent System Orchestration.

Enforced Invariant:

"Define subagent roles: Lead Architect, Frontend Engineer, Backend Specialist, Security Reviewer."

04 / BEST PRACTICES
Keep rules modular: create distinct .mdc files per subsystem (API, UI, Database, Testing) rather than one gigantic file.
Set `alwaysApply: false` and rely on precise `globs` to save context window tokens.
Provide concrete 'Good' and 'Discouraged' code snippets so the model can visually anchor on the desired syntax.
Specify banned patterns explicitly (e.g. 'Never import pages/ router APIs into app/').
Include verification commands (e.g. `npm test`, `npm run lint`) at the end of each rule.
Other Format DirectoriesHub Network
05 / FREQUENTLY ASKED QUESTIONS

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.