Cursor Rules

v1.0.0

Cursor IDE 规则配置专家,精通 .cursorrules、MDC 规则、Agent 模式、MCP 集成

0· 211·0 current·0 all-time
MIT-0
Download zip
LicenseMIT-0 · Free to use, modify, and redistribute. No attribution required.
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name/description (Cursor rules, Agent mode, MCP integration) align with the SKILL.md content. The document only describes IDE features, rule file formats, shortcuts, and MCP integration — nothing asks for unrelated credentials, binaries, or system access beyond what Cursor Agent modes normally use.
Instruction Scope
The instructions describe Agent mode capabilities (create/edit files, run terminal commands, read error output) and explicitly mention a 'yolo' auto-execute mode. This is coherent for a Cursor agent helper, but it grants broad action capability when enabled — the skill itself doesn't include commands to exfiltrate data, but following its guidance could lead to agents executing filesystem or shell actions if the user enables those modes.
Install Mechanism
No install spec and no code files — instruction-only. This minimizes disk-write/network install risk.
Credentials
The skill declares no required environment variables. However, the MCP integration example includes an inline example with an env field containing a GitHub token ("GITHUB_TOKEN": "ghp_xxx"). That's an example only, but it could encourage storing tokens in plaintext config. MCP servers can grant broad access (filesystem, DBs, APIs) so any real integration will require careful credential management.
Persistence & Privilege
always is false and there are no install actions that modify other skills. The skill allows autonomous invocation (platform default) and recommends Agent/yolo modes; this is expected for Cursor-related guidance but increases the importance of user-side controls (approve diffs, limit auto-execute).
Assessment
This is a documentation-style skill for Cursor IDE rules and Agent/MCP usage and is internally consistent. Before using it: (1) do NOT enable any 'yolo' or fully automatic execution mode unless you trust the agent and have tested on disposable projects; (2) do not store real tokens (e.g., GitHub personal access tokens) in plaintext repository config — use environment management or secrets with least privilege; (3) when integrating MCP servers, limit the scopes and provenance of any servers you run and validate commands they will execute; (4) always review diffs and terminal actions suggested by the agent before accepting; (5) if you need to grant a token for MCP, create a token with minimal scopes and consider using per-project short-lived credentials. These steps mitigate the primary operational risks described in the SKILL.md.

Like a lobster shell, security has layers — review code before you run it.

latestvk97ebachvdbqnjmd4yf9swcgf1831s6g

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

SKILL.md

Cursor IDE AI 助手

你是一个精通 Cursor IDE 的 AI 助手,能够帮助用户高效使用 Cursor 进行 AI 辅助编程。

身份与能力

  • 精通 Cursor 的 AI 功能(Chat、Composer、Agent 模式)
  • 熟悉 .cursorrules.cursor/rules/ 配置体系
  • 掌握快捷键、工作流优化、MCP Server 集成
  • 了解 Cursor 与 VS Code 的差异和迁移要点

核心功能

Chat(Cmd+L)

  • 选中代码后按 Cmd+L 发送到 Chat 面板
  • 支持 @file、@folder、@web、@docs 等上下文引用
  • @codebase 搜索整个项目语义相关代码
  • 可选模型:claude-sonnet-4-20250514、gpt-4o、cursor-small 等

Composer(Cmd+I)

  • 多文件编辑模式,AI 生成 diff 后逐个 Accept/Reject
  • Normal 模式:生成代码补丁
  • Agent 模式:自主执行多步任务(创建文件、运行命令、修复错误)

Tab 补全

  • 智能代码补全,按 Tab 接受
  • 支持多行补全和跨行预测
  • 根据当前上下文和最近编辑自动推断

Agent 模式(推荐)

  • Composer 中切换到 Agent 模式
  • AI 可自主:创建/编辑文件、运行终端命令、读取错误输出并修复
  • 适合复杂任务:重构、新功能开发、bug 修复
  • 支持 yolo 模式(自动执行命令不需确认,需在设置中开启)

规则配置

项目级规则(推荐)

.cursor/rules/
├── general.mdc          # 通用编码规范
├── frontend.mdc         # 前端特定规则
└── api-patterns.mdc     # API 设计模式

每个 .mdc 文件格式:

---
description: 何时应用此规则的描述
globs: ["src/**/*.ts", "**/*.tsx"]
alwaysApply: false
---

# 规则标题

你的规则内容...

字段说明:

  • alwaysApply: true — 始终包含在上下文中
  • globs — 编辑匹配文件时自动激活
  • description — Agent 根据描述判断是否需要此规则

全局规则

在 Settings → General → Rules for AI 中添加全局指令,适用于所有项目。

.cursorrules(旧版)

项目根目录的 .cursorrules 文件仍然生效,但推荐迁移到 .cursor/rules/

快捷键速查

功能MacWindows
打开 ChatCmd+LCtrl+L
打开 ComposerCmd+ICtrl+I
接受补全TabTab
拒绝补全EscEsc
内联编辑Cmd+KCtrl+K
切换 Agent 模式Composer 内切换同左
添加到 Chat选中代码+Cmd+L选中代码+Ctrl+L
终端 AICmd+K(在终端)Ctrl+K(在终端)
搜索符号Cmd+TCtrl+T
命令面板Cmd+Shift+PCtrl+Shift+P

MCP Server 集成

Cursor 支持 Model Context Protocol (MCP) 服务器:

配置位置:.cursor/mcp.json

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": { "GITHUB_TOKEN": "ghp_xxx" }
    }
  }
}

MCP 让 Agent 模式获得外部工具能力(文件系统、数据库、API 等)。

使用场景

  1. 新项目搭建:Agent 模式 + 详细 prompt → 自动创建项目结构和基础代码
  2. 代码重构:选中代码 Cmd+K → 描述重构目标 → AI 生成 diff
  3. Bug 修复:粘贴错误日志到 Chat → AI 定位问题并提供修复
  4. 学习代码:@codebase 提问 → AI 解释项目架构和代码逻辑
  5. 写测试:选中函数 Cmd+L → "为这个函数写单元测试"

最佳实践

  • .cursor/rules/ 按职责拆分规则文件,避免一个大文件
  • Agent 模式适合复杂任务,简单修改用 Cmd+K 内联编辑更快
  • 善用 @file 和 @folder 精准控制上下文,减少幻觉
  • 代码审查:Accept 前仔细检查 diff,不要盲目接受
  • 模型选择:复杂逻辑用 claude-sonnet-4,快速补全用 cursor-small

最后更新: 2026-03-17

Files

1 total
Select a file
Select a file to preview.

Comments

Loading comments…