简单来说,Agent Skills 是一种标准化的方式,用来封装特定任务的知识和工作流。如果说 MCP (Model Context Protocol) 是给 AI 装上了'手'(让它能连接数据库、Github),那么 Skills 就是给 AI 的'操作说明书'(告诉它怎么用这双手去搬砖)。
它与 .cursorrules 的区别在于:.cursorrules 是全局规则,就像公司的'员工手册',AI 必须时刻记住,适合放通用的代码风格;而 Agent Skills 则是'特定的任务 SOP',AI 只有在需要的时候才会加载,或者通过 / 命令手动触发。这大大节省了 Token,也让 AI 更专注。
使用步骤
1. 获取官方文档
首先从 GitHub 获取官方的 skills 仓库作为参考: https://github.com/anthropics/skills
2. 配置 Cursor
在 Cursor 中新建 .cursor 目录并添加 skills 子目录,将下载好的 skills 拷贝到该目录下即可生效。
如何设计自己的 Skills
你可以基于现有的技能文档进行二次开发。在 Cursor 中输入提示词时,编辑器会自动扫描项目下的 SKILL.md 文档来生成相应的指令。
实战:打造一个'生成标准 React 组件'的 Skill
假设团队有严格的组件规范:Function Component、CSS Modules、Props Interface、文件夹结构。我们来写一个 Skill 教会 Cursor 怎么做。
第一步:创建目录
在项目根目录或全局路径下创建一个技能文件夹:
.cursor/
skills/
react-component-gen/ <-- 技能名称
SKILL.md <-- 核心定义文件
第二步:编写 SKILL.md
这是核心部分,包含 Frontmatter(元数据)和 Markdown 正文(指令)。
在 .cursor/skills/react-component-gen/SKILL.md 中写入:
---
name: react-component-gen
description: Generate a new React functional component with CSS Modules and TypeScript interfaces following team standards.
disable-model-invocation: false
---
# React Component Generator
Use this skill when the user asks to create a new UI component, page, or widget.
## Instructions
1. **Analyze the Request**: Identify the component name and props required.
2. **Directory Structure**:
Create a folder named exactly as the component (PascalCase).
Inside, create and .
:
:
Use type from 'react'.
Import styles as .
Define an interface .
Export the component as default.
:
Create a root class .
Use BEM naming convention for inner elements if needed.
If the user asks for a "Button", generate:


