Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Configure Cursor project rules using .cursor/rules/*.mdc files and legacy .cursorrules. Triggers on "cursorrules", ".cursorrules", "cursor rules", "cursor config", "cursor project settings", ".mdc rules", "project rules".
.claude/skills/jeremylongshore-cursor-rules-config/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 49% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 131% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 93% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 21% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 98% | 0% |
Manage Cursor rules as versioned engineering policy that shapes AI context and behavior; rules must be specific, scoped, reviewed, and consistent with repository source of truth.
| Condition | Safe response | |---|---| | Rules conflict | Resolve to one authority and test the revised rule before rollout. | | Rule exposes sensitive content | Remove it, repair ignore controls, and assess the exposure. | | Rule is too broad | Scope it by path/task rather than disabling all shared governance. |
Add a path-scoped API rule that requires existing validation and tests, then test it on a sanitized fixture. Open a PR for the rule and verify it does not apply to unrelated frontend files before merging.
Configure project-specific AI behavior through Cursor's rules system. The modern approach uses .cursor/rules/*.mdc files; the legacy .cursorrules file is still supported but deprecated.
Each .mdc file contains YAML frontmatter followed by markdown content:
yaml--- description: "Enforce TypeScript strict mode and functional patterns" globs: "src/**/*.ts,src/**/*.tsx" alwaysApply: false --- # TypeScript Standards - Use `const` over `let`, never `var` - Prefer pure functions over classes - All functions must have explicit return types - Use discriminated unions over enums
Frontmatter fields:
| Field | Type | Purpose | |-------|------|---------| | description | string | Concise rule purpose (shown in Cursor UI) | | globs | string | Gitignore-style patterns for auto-attachment | | alwaysApply | boolean | true = always active; false = only when matching files referenced |
alwaysApply + globs Combination| alwaysApply | globs | Behavior | |-------------|-------|----------| | true | empty | Always injected into every prompt | | false | set | Auto-attached when matching files are in context | | false | empty | Manual only -- reference with @Cursor Rules in chat |
Use kebab-case with .mdc extension. Names should describe the rule's scope:
.cursor/rules/
typescript-standards.mdc
react-component-patterns.mdc
api-error-handling.mdc
testing-conventions.mdc
database-migrations.mdc
security-requirements.mdcCreate new rules via: Cmd+Shift+P > New Cursor Rule
.cursor/rules/project-context.mdc (always-on):
yaml--- description: "Core project context and conventions" globs: "" alwaysApply: true --- # Project: E-Commerce Platform Tech stack: Next.js 15, TypeScript 5.7, Prisma ORM, PostgreSQL, Tailwind CSS 4. Package manager: pnpm. Monorepo with turborepo. ## Conventions - API routes in `app/api/` using Route Handlers - Server Components by default, `"use client"` only when needed - Error boundaries at layout level - All monetary values stored as integers (cents) - Dates stored as UTC, displayed in user timezone
.cursor/rules/react-patterns.mdc (glob-scoped):
yaml--- description: "React component standards for TSX files" globs: "src/**/*.tsx,app/**/*.tsx" alwaysApply: false --- # React Component Rules - Export components as named exports, not default - Props interface named `{Component}Props` - Use `forwardRef` for components accepting `ref` - Colocate styles in `.module.css` files - Server Components: no `useState`, `useEffect`, or event handlers
// Correct pattern export interface ButtonProps { variant: 'primary' | 'secondary'; children: React.ReactNode; onClick?: () => void; }
export function Button({ variant, children, onClick }: ButtonProps) { return ( <button className={stylesvariant]} onClick={onClick}> {children} </button> ); }
.cursor/rules/api-routes.mdc (glob-scoped):
yaml--- description: "API route handler patterns" globs: "app/api/**/*.ts" alwaysApply: false --- # API Route Standards - Always validate request body with Zod - Return typed `NextResponse.json()` responses - Use consistent error response shape: `{ error: string, code: string }` - Wrap handlers in try/catch with structured logging
import { NextRequest, NextResponse } from 'next/server'; import { z } from 'zod';
const CreateOrderSchema = z.object({ items: z.array(z.object({ productId: z.string().uuid(), quantity: z.number().int().positive(), })), });
export async function POST(req: NextRequest) { try { const body = await req.json(); const parsed = CreateOrderSchema.parse(body); const order = await createOrder(parsed); return NextResponse.json(order, { status: 201 }); } catch (err) { if (err instanceof z.ZodError) { return NextResponse.json( { error: 'Validation failed', code: 'INVALID_INPUT', details: err.issues }, { status: 400 } ); } return NextResponse.json( { error: 'Internal server error', code: 'INTERNAL_ERROR' }, { status: 500 } ); } }
Place a .cursorrules file in project root. Plain markdown, no frontmatter:
markdown# Project Rules You are working on a Django REST Framework API. ## Stack - Python 3.12, Django 5.1, DRF 3.15 - PostgreSQL 16 with pgvector extension - Redis for caching and Celery broker - pytest for testing ## Conventions - ViewSets over function-based views - Always use serializer validation - Custom exceptions inherit from `APIException` - All endpoints require authentication unless explicitly marked - Use `select_related` and `prefetch_related` to avoid N+1 queries ## Code Style - Type hints on all function signatures - Docstrings on all public methods (Google style) - Max function length: 30 lines
Split a monolithic .cursorrules into scoped .mdc files:
.cursor/rules/ directoryalwaysApply: true rule.cursorrules after verifying all rules loadUse @file syntax to include additional context files when a rule is applied:
yaml--- description: "Database schema context for migration files" globs: "prisma/**/*.prisma,drizzle/**/*.ts" alwaysApply: false --- Reference these files for schema context: @prisma/schema.prisma @docs/data-model.md
@Cursor Rules to see which rules are activealwaysApply: true always show; glob rules only appear when matching files are in context.cursor/rules/ to git -- rules are project documentationalwaysApply: true for team-wide standards| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 13,759 | 10,766 | -22% | 1 | 1 | 0% | 2,533 | 3,779 | +49% | 0 | 0 | — |
case-02 | pass→pass | 13,998 | 13,090 | -6% | 1 | 1 | 0% | 795 | 2,321 | +192% | 0 | 0 | — |
case-03 | pass→pass | 4,168 | 5,362 | +29% | 1 | 1 | 0% | 778 | 2,381 | +206% | 0 | 0 | — |
case-04 | pass→pass | 3,992 | 2,314 | -42% | 1 | 1 | 0% | 765 | 2,115 | +176% | 0 | 0 | — |
case-05 | fail→pass | 6,312 | 4,342 | -31% | 1 | 1 | 0% | 1,082 | 2,504 | +131% | 0 | 0 | — |
case-06 | pass→pass | 12,018 | 9,392 | -22% | 1 | 1 | 0% | 1,529 | 2,381 | +56% | 0 | 0 | — |
case-07 | pass→pass | 11,631 | 23,545 | +102% | 1 | 1 | 0% | 1,915 | 2,548 | +33% | 0 | 0 | — |
case-08 | fail→pass | 10,715 | 14,232 | +33% | 1 | 1 | 0% | 1,870 | 3,616 | +93% | 0 | 0 | — |
case-09 | fail→pass | 9,692 | 3,044 | -69% | 1 | 1 | 0% | 1,899 | 2,307 | +21% | 0 | 0 | — |
case-10 | pass→pass | 7,163 | 3,330 | -54% | 1 | 1 | 0% | 1,137 | 2,328 | +105% | 0 | 0 | — |
case-11 | pass→pass | 13,688 | 11,124 | -19% | 1 | 1 | 0% | 2,298 | 3,836 | +67% | 0 | 0 | — |
case-12 | fail→pass | 10,998 | 11,391 | +4% | 1 | 1 | 0% | 2,109 | 4,178 | +98% | 0 | 0 | — |
case-13 | pass→pass | 9,846 | 7,573 | -23% | 1 | 1 | 0% | 1,777 | 3,031 | +71% | 0 | 0 | — |
case-14 | pass→pass | 7,733 | 7,206 | -7% | 1 | 1 | 0% | 1,353 | 2,984 | +121% | 0 | 0 | — |
case-15 | pass→pass | 10,462 | 7,262 | -31% | 1 | 1 | 0% | 1,956 | 3,093 | +58% | 0 | 0 | — |
case-16 | pass→pass | 12,574 | 9,190 | -27% | 1 | 1 | 0% | 2,526 | 3,640 | +44% | 0 | 0 | — |
case-17 | pass→pass | 6,004 | 2,330 | -61% | 1 | 1 | 0% | 1,005 | 2,186 | +118% | 0 | 0 | — |
case-18 | fail→pass | 3,993 | 2,994 | -25% | 1 | 1 | 0% | 767 | 2,278 | +197% | 0 | 0 | — |
case-19 | pass→pass | 5,708 | 3,395 | -41% | 1 | 1 | 0% | 1,085 | 2,449 | +126% | 0 | 0 | — |
case-20 | fail→pass | 15,558 | 11,297 | -27% | 1 | 1 | 0% | 2,653 | 3,715 | +40% | 0 | 0 | — |
case-21 | pass→pass | 5,146 | 3,270 | -36% | 1 | 1 | 0% | 1,044 | 2,433 | +133% | 0 | 0 | — |
case-22 | pass→pass | 10,563 | 6,329 | -40% | 1 | 1 | 0% | 2,032 | 3,053 | +50% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +32 percentage points is the difference between those two pass rates over the 22 comparable cases.
The publisher has shipped newer versions since this run, so these numbers describe v1, not the version currently listed.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.