From cursor-pack
Configures Cursor project rules via .cursor/rules/*.mdc files with globs and alwaysApply. Supports legacy .cursorrules; includes examples for TypeScript, React, and project context.
npx claudepluginhub jeremylongshore/claude-code-plugins-plus-skills --plugin cursor-packThis skill is limited to using the following tools:
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.
Defines directory structure, .cursor/rules organization, indexing strategy, and configuration patterns for Cursor IDE projects to optimize AI features.
Guides creation of .claude/rules/ files for path-scoped project conventions using TDD workflow: RED (test gaps), GREEN (write rule), REFACTOR (optimize). Triggers on 'add rule', 'create convention', 'scope guideline'.
Guides authoring .claude/rules/*.md files for auto-applied constraints scoped by file patterns. Use when creating or updating rules for code conventions and quality standards.
Share bugs, ideas, or general feedback.
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:
---
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.mdc
Create new rules via: Cmd+Shift+P > New Cursor Rule
.cursor/rules/project-context.mdc (always-on):
---
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):
---
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
```tsx
// Correct pattern
export interface ButtonProps {
variant: 'primary' | 'secondary';
children: React.ReactNode;
onClick?: () => void;
}
export function Button({ variant, children, onClick }: ButtonProps) {
return (
<button className={styles[variant]} 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
```ts
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 }
);
}
}
## Legacy .cursorrules Format
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:
---
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