cursor-rules-config
БесплатноБез исполняемых скриптовНе проверенConfigure Cursor project rules using .cursor/rules/*.mdc files and legacy .cursorrules. Triggers on "cursorrules", ".cursorrules", "cursor rules", "cursor…
от jeremylongshore★ 2 961 звезда на GitHubОб этом скилле
Cursor Rules Config
Overview
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.
Prerequisites
- Repository owner approval, existing engineering/security standards, and a test workspace.
- A reviewed ignore strategy for secrets, generated files, and sensitive data.
Instructions
- Write one clear rule per concern with scope, priority, and concrete acceptance behavior.
- Keep shared rules in source control and use path-scoped rules for local conventions.
- Test new rules on a non-sensitive fixture, inspect resulting behavior, and merge via normal review.
- Periodically remove stale/conflicting rules and document any intentional exceptions.
Output
- A reviewed, versioned rule set with clear scope and a tested behavior example.
Error Handling
| 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. |
Examples
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.
Rules System Architecture
Modern Project Rules (.cursor/rules/*.mdc)
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 |
Rule Types by 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 |
File Naming Convention
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
Complete Project Rules Example
.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';
cons
Установить cursor-rules-config в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditBash(cmd:*)Вложенные файлы
FAQ
Что делает скилл cursor-rules-config?
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".
Как установить скилл cursor-rules-config?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cursor-rules-config запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic