Cursor Rules (.mdc形式) 公式ガイド
Cursor公式の.mdc形式ルールガイド。.cursorrules廃止→.mdc移行。4種の適用モード、frontmatter制御。
# Cursor Rules (.mdc Format)
## Rule Types
1. **Always Apply** — Active in every chat session
2. **Apply Intelligently** — Agent decides relevance based on description
3. **Apply to Specific Files** — Activated when file matches glob patterns
4. **Apply Manually** — Invoked via @-mention (e.g., `@my-rule`)
## Frontmatter Structure
```markdown
---
description: "Your rule's purpose"
globs: ["**/*.ts", "**/*.tsx"]
alwaysApply: false
---
```
## Best Practices
- Keep rules under 500 lines
- Split large rules into multiple, composable pieces
- Reference files rather than copying content
- Start simple. Add rules only when you notice Agent making the same mistake repeatedly
- Rules should be focused, actionable, and scoped
## Examples
**Frontend Standards:**
Enforce Tailwind for styling, Framer Motion for animations, and zod validation for APIs.
**Template Rule:**
Reference `@express-service-template.ts` for service structure rather than embedding full code. こちらもおすすめ
DevOps カテゴリの他のルール
もっとルールを探す
CLAUDE.md、.cursorrules、AGENTS.md、Image Prompts の全 157 ルールをチェック。



