用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/trycompai/comp --skill cursor-usage命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | cursor-usage |
| description | How to write and manage Cursor rules - invoke with @cursor-usage |
Source Cursor rule: .cursor/rules/cursor-usage.mdc.
Original file scope: .cursor/rules/*.mdc.
Original Cursor alwaysApply: false.
Cursor rules provide system-level instructions to the AI to maintain code consistency, quality, and adherence to project standards. They are stored in the .cursor/rules/ directory as .mdc (Markdown with frontmatter) files.
Each .mdc rule file consists of two parts:
---
description: Brief overview of what this rule enforces
globs: **/*.{ts,tsx}
alwaysApply: true
---
Frontmatter Fields:
description: A clear, concise explanation of the rule's purposeglobs: Glob pattern to match files where this rule should apply (plain string, no quotes or arrays)
**/*.tsx - All TSX files**/*.{ts,tsx} - All TS and TSX filesapps/*/components/**/*.tsx - All TSX files in any app's components directory**/trigger/**/*.ts - All TS files in trigger directoriesalwaysApply: Boolean indicating if the rule should always be active
true: Rule is always active when working on matching filesfalse: Rule can be selectively invoked with @rule-nameThe body of the rule file contains the actual guidelines, examples, and instructions written in Markdown format.
Rules with alwaysApply: true are automatically loaded when:
globs patternYou can reference specific rules in your prompts:
@design-system create a new button component
This explicitly tells Cursor to apply the design-system rule.
Always include:
// ✅ Good: Use semantic tokens
<div className="bg-background text-foreground">Content</div>
// ❌ Bad: Hardcoded colors
<div className="bg-white text-black">Content</div>
Organize content with descriptive headers:
## Core Principles
## Rules
## Examples
## Exceptions
## Common Mistakes
If there are cases where rules don't apply, state them clearly:
## Exceptions
The ONLY time you can pass className to a design system component is for:
1. Width utilities: `w-full`, `max-w-md`
2. Responsive display: `hidden`, `md:block`
Provide actionable checklists for validation:
## Code Review Checklist
Before committing:
- [ ] Uses semantic color tokens
- [ ] Works in both light and dark mode
- [ ] Fully responsive
.mdc file in .cursor/rules/.mdc fileRecommended structure:
.cursor/rules/
├── design-system.mdc # Component usage, variants, composition
├── code-standards.mdc # General code quality rules
├── typescript-rules.mdc # TypeScript type safety
├── react-code.mdc # React patterns and conventions
├── data-fetching.mdc # Server/client data patterns
└── cursor-usage.mdc # This file - how to use rules
# All TypeScript/TSX files
globs: **/*.{ts,tsx}
# Only TSX files (React components)
globs: **/*.tsx
# Only trigger task files
globs: **/trigger/**/*.ts
# Prisma schema files
globs: **/*.prisma
# All JSON and TypeScript files
globs: **/*.{ts,tsx,json}
** for recursive directory matching* for single-level wildcard{ts,tsx} for multiple extensionsglobs pattern matches your filealwaysApply is set appropriately@ruleNameglobsUse alwaysApply: false for rules that should only apply in specific contexts:
---
description: Performance optimization guidelines
globs: **/*.ts
alwaysApply: false
---
Invoke with: @performance-optimization refactor this component
More specific globs take precedence:
design-system.mdc with globs: **/*.tsx (broad)trigger.basic.mdc with globs: **/trigger/**/*.ts (specific)The specific rule will have more weight for trigger files.
touch .cursor/rules/my-new-rule.mdc
---
description: What this rule enforces
globs: **/*.{ts,tsx}
alwaysApply: true
---
# Rule Title
## Guidelines
- Point 1
- Point 2
globs pattern@my-new-rule in your promptglobs patternRemember: Rules are here to help, not hinder. If a rule doesn't make sense for a specific case, discuss with the team and update the rule accordingly.