.cursor/rules/*.mdc & .cursorrules2173 Tailored RulesTarget: .cursor/rules/*.mdc

372 Industrial Architecture Guardrails for Cursor (.mdc & .cursorrules)

Explore 372 battle-tested architectural guardrails, anti-hallucination specifications, and scoped .mdc rules for Cursor IDE. Enforce Next.js 15 App Router, React 19 Compiler, Tailwind CSS v4, Vue, Nuxt, Svelte, and Mobile Native with deterministic precision.

Scoped File Globs

Activates rules only when relevant file patterns match, conserving context.

Zero Drift Invariants

Forbids legacy API patterns and catches unawaited promises before execution.

Composer Multi-File Safety

Prevents full-tree destruction during complex multi-file refactors.

npx agentrules-cli export --client cursor
View Config Spec
Domain Focus:Frontend, UI & Mobile App Scoped Globs
Showing 24 of 2173 native tailored rules for CursorTAILORED ALLOCATION
solidstart-1-0-server-functions-async-boundaries-production-standard
frontendcritical

SolidStart 1.0 Server Functions & Async Boundaries Production Standard

SolidStart 1.0 relies on the Vinxi bundler to split `server$` closures into independent HTTP POST RPC endpoints. Direct lexical closure over client signals within `server$` scopes or failure to demarcate async boundaries with `<Suspense>` causes silent serialization failures, client-bundle secret leaks, and SSR hydration mismatches. Enforcing strict parameter passing, runtime input validation, and Solid async primitives maintains security and fine-grained reactivity across network boundaries.

Blocks:Closing over reactive client signals inside server$ RPCs or calling unvalidated server functions directly in reactive effects.
Targets:Cursor•Claude•Windsurf•Codex
astro-5-actions-content-layer-production-standard
frontendcritical

Astro 5 Actions & Content Layer Production Standard

Enforces strict type safety and architectural correctness for Astro 5 Server Actions and the zero-waterfall Content Layer API. Prevents runtime contract mismatches, hydration mismatches, and unhandled mutation exceptions across dynamic and prerendered boundaries. Failure to follow these patterns leads to silent data fetching waterfalls, build-time cache corruptions, and unhandled server action exceptions.

Blocks:Writing legacy Astro v4 content collection configurations and unvalidated server actions that throw generic Errors instead of ActionError.
Targets:Cursor•Claude•Windsurf•Codex
nuxt-4-nitro-server-engine-shared-directory-production-standard
frontendcritical

Nuxt 4 Nitro Server Engine & Shared Directory Production Standard

Nuxt 4 enforces strict boundary segregation between client UI in the app/ directory, backend endpoints in server/, and universal contracts in shared/. Violating cross-boundary isolation or maintaining module-scoped state in Nitro server handlers causes catastrophic cross-request data corruption and hydration mismatches under concurrent production traffic. Architects must enforce request-isolated H3 event contexts, universal serialization schemas, and strict path-alias boundaries.

Blocks:Placing mutable module-level state in Nitro event handlers and importing server-only dependencies into client or shared directories.
Targets:Cursor•Claude•Windsurf•Codex
svelte-5-runes-reactivity
frontendcritical

Svelte 5 Runes ($state, $derived, $effect) & Legacy Reactivity Elimination

Production standard for Svelte 5. Mandates using modern Runes ($state, $derived, $effect) and strictly eliminates deprecated Svelte 3/4 reactive declarations ($: variable = ...) and mutable let bindings.

Blocks:AI writes deprecated $: reactive declarations or let count = 0 inside Svelte 5 components, failing to trigger the new signals-based reactivity engine.
Targets:Cursor•Claude•Windsurf•Codex
tanstack-start-router-ssr-production-standard
frontendcritical

TanStack Start SSR: Type-Safe Search Validation, Granular Loader Dependencies, and Deferred Data Streaming

Enforces strict type safety for URL search parameters via schema validators, prevents SSR render blocking through deferred streaming promises, and ensures loaders trigger re-executions only when declared dependencies mutate. Failing to adhere leads to TTFB degradation, hydration mismatch exceptions, and silent cache invalidation bugs in fullstack TanStack applications.

Blocks:Blocking SSR on non-critical queries and relying on untyped search params without loaderDeps
Targets:Cursor•Claude•Windsurf•Codex
react-19-action-hooks-useactionstate-production-standard
frontendcritical

React 19 Action Hooks & useActionState Production Standard & Concurrency Guardrail

React 19 introduces native async Action transitions that manage pending states, concurrent updates, and optimistic rollbacks natively within the framework lifecycle. Reverting to legacy manual useState booleans for submission states introduces race conditions, breaks concurrent rendering boundaries, and bypasses automatic error boundaries. Modern production frontends must leverage useActionState, useOptimistic, and useFormStatus to ensure resilient, race-condition-free form lifecycles.

Blocks:Wrapping async form handlers in manual useState loading and error states instead of leveraging native React 19 Actions.
Targets:Cursor•Claude•Windsurf•Codex
next-js-15-server-actions-boundary-csrf-production-standard
frontendcritical

Next.js 15 Server Actions Boundary CSRF & Origin Validation Standard

Next.js 15 Server Actions enforce built-in origin checks against the Host header, but multi-domain setups, reverse proxy misconfigurations, or unauthenticated action endpoints create severe CSRF and unauthorized state mutation vectors. Production actions must assert authenticated session identity, validate strict schemas, and configure experimental.serverActions.allowedOrigins to protect critical boundaries.

Blocks:Treating Server Actions as private client-only functions while omitting boundary session checks and reverse-proxy origin configurations.
Targets:Cursor•Claude•Windsurf•Codex
qwik-city-resumability-containerization-production-standard
frontendcritical

Qwik City Resumability & Containerization Production Standard

Enforces Qwik's zero-hydration resumability model by strictly isolating lexical boundaries across Optimizer-split chunk closures. Prevents accidental closure captures, serialization bottlenecks, and eager code evaluation that degrade instant-on performance. Failure to maintain clean serializable boundaries introduces runtime de-opt failures, memory leaks, and massive client bundle bloat.

Blocks:Capturing non-serializable runtime instances inside '$' closures or eagerly importing heavy client modules without QRL boundaries.
Targets:Cursor•Claude•Windsurf•Codex
vite-6-environment-api-multi-runtimes-production-standard
frontendcritical

Vite 6 Environment API & Multi-Runtimes Architecture Standard

Vite 6 deprecates monolithic SSR transforms in favor of the Environment API, isolating module graphs and module runners across distinct runtimes (Node.js, Edge, workerd, and Client). Conflating environment module graphs or invoking deprecated APIs like `ssrLoadModule` causes cross-runtime state leakage, broken HMR transport boundaries, and unhandled execution crashes. Strict boundary isolation across `server.environments` MUST be enforced to guarantee deterministic compilation and Hot Module Replacement.

Blocks:Defaulting to legacy `ssrLoadModule` and accessing shared server transform caches across multi-runtime targets instead of scoped `DevEnvironment` instances.
Targets:Cursor•Claude•Windsurf•Codex
tanstack-start-router-ssr-streaming-standard
frontendcritical

TanStack Start & Router SSR: Type-Safe Search Validation, Loaders, and Deferred Streaming

Enforces strict type safety and streaming invariants in TanStack Start and TanStack Router SSR applications. Mandates route-level search param schema validation via Zod/Valibot, prevents waterfall SSR blocking by requiring deferred streaming for non-critical dependencies, and enforces execution-boundary safety between loaders and server functions.

Blocks:Unvalidated search params with blocking SSR loaders that serialize entire component trees before initial stream flush.
Targets:Cursor•Claude•Windsurf•Codex
tauri-2-0-mobile-ipc-permissions-scope-production-standard
mobilecritical

Tauri 2.0 Mobile IPC & Capabilities Permissions Matrix Standard

Tauri v2 introduces a capability-driven permissions system replacing legacy v1 allowlists across iOS and Android runtimes. Failure to constrain IPC command handlers with typed schemas and explicit mobile capability definitions exposes native mobile OS surfaces to arbitrary code execution, permission leakage, and silent serialization failures. Production mobile deployments require strictly typed IPC boundary validation, granular capability scopes, and graceful permission degradation.

Blocks:Hallucinating deprecated Tauri v1 allowlists or executing unsanitized IPC commands across mobile webviews without capability scoping.
Targets:Cursor•Claude•Windsurf•Codex
capacitor-7-native-bridge-biometric-auth-production-standard
mobilecritical

Capacitor 7 Native Bridge, Biometric Auth & Android 15 Lifecycle Production Standard

Capacitor 7 enforces strict bridge lifecycle contracts, asynchronous native plugin interop, and mandatory Android 15 edge-to-edge window inset handling. Storing sensitive authentication tokens in unencrypted web storage or failing to bind biometric authentication directly to hardware-backed Keystore or Secure Enclave mechanisms compromises app integrity and causes fatal crash or viewport occlusion issues on modern mobile operating systems.

Blocks:Persisting biometrically gated tokens in plaintext Web Storage or CapacitorPreferences while ignoring Android 15 edge-to-edge safe area occlusion.
Targets:Cursor•Claude•Windsurf•Codex
tanstack-start-ssr-streaming-search-params
frontendcritical

TanStack Start SSR Loader Invariants: Type-Safe Search Params & Deferred Streaming

Enforces type-safe search parameter validation via explicit schemas, prevents SSR TTFB stalls by delegating non-critical data to deferred streaming promises, and guarantees server-only boundaries using TanStack Start server functions.

Blocks:Awaiting slow secondary data in SSR loaders and accessing raw, unvalidated search parameters.
Targets:Cursor•Claude•Windsurf•Codex
tailwind-v4-css-first-theme-directives
frontendcritical

Tailwind CSS v4 CSS-First Theme Directives and Dynamic Interpolation Guardrail

Enforces modern Tailwind CSS v4 CSS-first configuration via pure @theme and @theme inline blocks, deprecating legacy tailwind.config.js/ts abstractions. Mandates native CSS custom properties with color-mix() runtime opacity interpolation instead of legacy RGB channel workarounds. Ensures token declarations follow v4 standard namespace conventions and CSS variable resolution across the build pipeline.

Blocks:Persisting legacy tailwind.config.js architecture and RGB-tuple opacity hacks in Tailwind CSS v4 environments
Targets:Cursor•Claude•Windsurf•Codex
hono-jsx-edge-streaming-pipeline-standard
frontendcritical

Hono JSX Edge Streaming Pipelines and Non-Blocking Chunk Composition

Enforces non-blocking chunk composition and zero-buffer streaming pipelines for Hono JSX on Cloudflare Workers and Deno edge runtimes. Prohibits full-document string serialization and post-flush HTTP header mutation while guaranteeing correct Suspense boundaries and stream-safe middleware chaining.

Blocks:Buffering Monolithic JSX Strings into Edge Memory and Attempting Post-Flush Response Header Mutation
Targets:Cursor•Claude•Windsurf•Codex
angular-19-signals-defer-views-standard
frontendcritical

Angular 19 Standalone Signals, LinkedSignals, and Defer Block Invariants

Enforces Modern Angular 19 architectural standards by mandating signal inputs and linkedSignal for reactive derived mutable state, eliminating decorator-based inputs and manual synchronization side-effects in ngOnChanges or effects. Enforces strictly structured @defer blocks with minimum placeholder constraints to guarantee performance chunking and prevent cumulative layout shifts (CLS).

Blocks:Mutating internal signal state via ngOnChanges/effects and unconstrained @defer block usage causing layout shift
Targets:Cursor•Claude•Windsurf•Codex
react-router-7-hydration-single-fetch-guardrail
frontendcritical

React Router 7 Framework Mode Hydration, Typegen, and Single-Fetch Boundaries

Enforces deterministic SSR-to-client hydration invariants in React Router 7 Framework Mode. Mandates strict adherence to Single Fetch promise streaming, generated route module typings, and explicit clientLoader execution policies to prevent rendering waterfalls and hydration drift.

Blocks:Uncontrolled clientLoader Execution and Deprecated defer() Usage Under Single Fetch
Targets:Cursor•Claude•Windsurf•Codex
tanstack-virtual-dynamic-measurement-saturation-guardrail
frontendcritical

TanStack Virtual 3.0 Dynamic Measurement, Scroll Containment, and DOM Saturation Guardrail

Enforces strict industrial standards for TanStack Virtual 3.0 in massive datasets and dynamic tables. Mandates native ref-based element measurement via measureElement, strict containment of scroll margins to prevent viewport jitter, and hard limits on overscan to avoid catastrophic DOM node saturation.

Blocks:Unbounded Overscan, Manual getBoundingClientRect Layout Thrashing, and Index-Keyed Dynamic Rows
Targets:Cursor•Claude•Windsurf•Codex
lexical-headless-engine-transforms-and-serialization-guardrails
frontendcritical

Lexical Headless Node Mutation, Selection Reconciliation, and Markdown Engine Guardrails

Enforces architectural invariants within Meta Lexical headless document workflows and client-side editors. Prevents dirty node write corruptions, selection collapse regressions, and out-of-order transform loop recursion during headless Markdown and AST operations. Guarantees predictable reconciliation and clone-on-write integrity across server-side rendering and client editor states.

Blocks:Direct In-Place Node Property Mutation and Untracked Selection Reconciliation in Lexical Transforms
Targets:Cursor•Claude•Windsurf•Codex
tanstack-start-ssr-streaming-searchparams-production-standard
frontendcritical

TanStack Start SSR Loaders, Streaming Deferred Data, and Validated Search Params

Enforces strict type-safety, streaming efficiency, and boundary isolation in TanStack Start and Fullstack TanStack Router. Requires declarative validation of search parameters via schema parsers, non-blocking SSR TTFB via explicit promise deferral with Suspense boundaries, and strict server/client boundary isolation using server functions.

Blocks:Blocking SSR TTFB via Cascading Loader Awaits and Unvalidated Runtime Search Param Parsing
Targets:Cursor•Claude•Windsurf•Codex
tailwind-v4-css-first-theme-production-standard
frontendcritical

Tailwind CSS v4 CSS-First Declarative Theme and Color Architecture Guardrails

Tailwind CSS v4 replaces JavaScript-based configurations with native CSS-first declarations via `@theme` directives and standard CSS custom properties. Enforcing this invariant prevents silent build regressions, eliminates obsolete CSS opacity-channel string hacks, and unlocks native CSS color gamut interpolation (OKLCH) via dynamic `color-mix()`. Projects migrating to or initialized with v4 must strictly maintain styling configuration inside CSS boundary layers.

Blocks:Retaining legacy tailwind.config.js files, obsolete RGB tuple opacity workarounds, and deprecated PostCSS plugin pipelines in Tailwind CSS v4 builds.
Targets:Cursor•Claude•Windsurf•Codex
angular-19-signals-linked-defer-architectural-guardrail
frontendcritical

Angular 19 Signal Primitives, linkedSignal Derivations, and Deferred Viewport Chunking

Enforces modern Angular 19 standalone architecture using signal inputs, signal-based outputs, linkedSignal for resettable/derived state, and production-hardened @defer blocks. Prevents architectural anti-patterns such as writing to signals inside effects, using legacy decorator inputs, and defer blocks lacking layout stability constraints.

Blocks:Mutating Signals in Effects for State Sync and Naked @defer Directives Causing Cumulative Layout Shift (CLS)
Targets:Cursor•Claude•Windsurf•Codex
rr7-framework-hydration-single-fetch-guardrail
frontendcritical

React Router 7 Framework Mode Hydration & Single-Fetch Architecture

Enforces strict adherence to React Router 7 framework mode hydration contracts, single-fetch streaming semantics, and route module typegen. Prevents hydration mismatches, duplicate network waterfalls, and broken serialized state caused by legacy Remix primitives (such as json() or defer()) and misconfigured clientLoader boundaries.

Blocks:Bypassing Route Typegen and Mismanaging clientLoader Hydration Boundaries in React Router 7 Single-Fetch
Targets:Cursor•Claude•Windsurf•Codex
tanstack-virtual-windowing-performance-guardrail
frontendcritical

TanStack Virtual 3.0: Dynamic Measurement and DOM Containment Invariants

Enforces deterministic virtualization mechanics in TanStack Virtual 3.0, mandating stable dynamic element measurement callbacks, strict CSS containment, and bounded overscan budgets. Prevents layout thrashing, scroll-drift jitter, and DOM node saturation in massive data grids.

Blocks:Unbounded Overscan, Re-measuring Layout Thrash, and Missing CSS Containment in Virtualized Lists
Targets:Cursor•Claude•Windsurf•Codex

Cursor Native Configuration Format

Target location: .cursor/rules/

# File: .cursor/rules/nextjs-15-app-router.mdc
---
 description: Next.js 15 App Router & React 19 Architectural Invariants
 globs: "app/**/*.{ts,tsx}", "src/app/**/*.{ts,tsx}"
 alwaysApply: false
 ---
 
 # Next.js 15 App Router & Async Request Invariants
 
 - NEVER scaffold or reference legacy `pages/` directory structure.
 - ALWAYS await asynchronous request headers (`await cookies()`, `await headers()`).
 - Forbid manual `useMemo` and `useCallback` boilerplate in React 19 compiler environments.
 - Enforce server actions boundary protection with explicit input validation schemas.

Top AI Hallucination Traps Solved for Cursor

Without deterministic negative constraints, AI coding models frequently fall into common architectural failure modes:

1Un-scoped global .cursorrules consuming 80%+ of the LLM context window on unrelated files
2Composer agent hallucinating deprecated Next.js 14 Pages router structures in modern App Router setups
3Spurious useMemo and useCallback boilerplate sprays polluting React 19 compiler codebases
4Scaffolding conflicting .eslintrc and .prettierrc files when modern single-binary Biome is active
5Silently dropping transaction rollback semantics during Prisma or Drizzle ORM mutations

Frequently Asked Questions: Cursor AI Agent (.mdc, .cursorrules)

Common questions about configuring rules, optimizing context token usage, and enforcing architectural invariants in Cursor.

Targeted Architecture Patterns & Long-Tail Scopes for Cursor

how to write cursor rules with file globscursor alwaysApply mdc configuration best practicescursor composer multi file refactoring negative constraintsprevent nextjs 14 pages router hallucination in cursorcursor rules for fastapi pydantic v2 validationcursor agent token budget optimization prunercursor rules vs windsurf rules differencescursor rust tokio concurrency invariant specificationscursor biome linter single binary configurationenterprise cursor rules monorepo architecture guidelines