Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Skills Tutorial

Skills Tutorial

Skills are essentially instruction manuals that teach AI to do things following a fixed process; once written, they can be called repeatedly like a function.

We can think of Skills as packaging "how a certain type of thing should be done professionally" into a reusable, auto-triggerable capability module.

Skills exist as Markdown files; they do not execute functions, but achieve efficient and reusable transfer of experience through on-demand, progressive loading.

The biggest difference between Skills and traditional Prompts is: on-demand loading + progressive disclosure (only stuffing the thick SOP into the context when needed, greatly saving tokens).

Comparison Item Ordinary Prompt Skills mechanism
Must be re-described every time Is No (described only once)
Context length usage Fully stuffed in every time Progressive loading (reads the full content only when triggered)
Consistency Depends on the quality of each prompt High (fixed SOP + templates)
Reusability Manual copy and paste Auto-matching / slash commands / project sharing
Maintenance method Changing the prompt once means re-sending it Modify the SKILL.md file, effective globally / per project

For example, when we usually write articles, before Skills, we had to repeat the following steps every time:

帮我总结文章 → 翻译 → 改成公众号风格 → 加标题 → 输出 Markdown

With Skills:

You only need one sentence:

使用「技术文章转公众号」Skill

The AI will automatically execute according to the steps you set.

Think of the AI as asmart but inexperienced intern who just graduated:

Mainstream clients that currently support Skills:

Sorting Tool name Whether Skills are free to use Recommended for Default path for storing skills Notes
1 Claude Code Yes (official) Everyone ~/.claude/skills The standard setter, with the most complete ecosystem
2 Cursor Is Most commonly used for writing code ~/.cursor/skills Almost seamless compatibility with Claude Skills
3 Trae / OpenCode Is For those seeking value for money Depends on tool settings More domestic users
4 VS Code + Extension Partial support For those already using VS Code deeply Configured in the extension settings Rapidly catching up
5 Coze / other domestic platforms Partial support For those who prefer the web version Platform's built-in skill marketplace Some require a membership

The difference between Skills and MCP: Skills are used forKnowledge reuse, MCP is used forCapability extension.

Skills

Knowledge reuse

MCP

Capability extension


The Core Structure of a Skill

The core of Skills is: one folder + one SKILL.md file.

The SKILL.md file contains:

A Skill is essentially a Markdown file (the filename is fixed as SKILL.md)

my-skill/

└── SKILL.md   (唯一必需)

SKILL.md basic template:

---

name: pdf-processing

description: 从 PDF 中提取文本和表格,填写表单,并合并文档

---



# PDF 处理



## Use Cases

Use when operating on PDF files, for example:



- 提取 PDF 文本或表格数据

- 填写 PDF 表单

- 合并多个 PDF 文件



## 提取文本

- 使用 `pdfplumber` 提取文本型 PDF 内容  

- 扫描版 PDF 需配合 OCR 工具  



## 填写表单

- 读取 PDF 表单字段  

- 按输入数据填充并生成新文件  

Minimal required example:

---

name: skill-name

description: 说明该 Skill 的功能以及适用场景

---

Example with optional fields:

---

name: pdf-processing

description: 从 PDF 中提取文本和表格,填写表单,并合并文档

license: Apache-2.0

metadata:

  author: example-org

  version: "1.0"

---

Field Required Description
name Is Skill name, up to 64 characters, may only use lowercase letters, digits and -, and cannot start or end with - at the beginning or end
description Is Description of features and use cases, up to 1024 characters, cannot be empty
license No License name or a pointer to the license file bundled with the Skill
compatibility No Environment and dependency notes (products, system packages, network permissions, etc.), up to 500 characters
metadata No Custom key-value pairs for extending metadata (e.g., author, version)
allowed-tools No List of allowed tools (space-separated, experimental feature)

If you need reference materials, examples or executable scripts, you can use a more complex Skill directory structure:

my-skill/

├── SKILL.md      # 必需:指令 + 元数据

├── scripts/      # 可选:可执行代码

├── references/   # 可选:文档资料

└── assets/       # 可选:模板、资源

How Skills Work

Skills use progressive loading to manage context efficiently:

This design keeps the AI fast while letting it fetch more information on demand.


Claude Code Skills

Next, let's use Claude Code as an example to create a simple Skill.

Claude Code looks up and loads Skills in the following order (more specific locations have higher priority):

Level Path Scope
Enterprise level Configured via the management console (managed settings) All users in the organization
Personal level ~/.claude/skills//SKILL.md All your projects
Project-level .claude/skills//SKILL.md Only the current project
Plugin level /skills//SKILL.md Environments where the plugin is enabled

Each Skill is a folder, and the folder name is the skill identifier (kebab-case lowercase + hyphens recommended).

Minimal structure:

~/.claude/skills/

  └── code-comment-expert/          # 技能文件夹名

      └── SKILL.md                  # 唯一必填文件(必须全大写 + .md 小写)

Full SKILL.md format:

---                                 #  YAML frontmatter 开始(顶格)

name: code-comment-expert           # 必填:技能名(也是 /slash 命令名)

description: >-                     # 必填:最关键一行!Claude 靠它判断是否加载

  为代码添加专业、清晰的中英双语注释。

  适合缺少文档、可读性差、需要分享审查的代码。

  常见触发场景:加注释、注释一下、加文档、explain this、improve readability



trigger_keywords:                   # 强烈推荐(大幅提升自动触发率)

  - 加注释

  - 注释

  - 加文档

  - explain code

  - document

  - comment this

  - readability



version: 1.0                        # 可选

author: yourname                    # 可选

--- # ← YAML end



# Here starts the main body (Markdown) — instructions when Claude actually executes



你现在是「专业代码注释专家」。



## Core Principles

- 只在缺少注释或可读性明显不足处添加

- 优先使用英文 JSDoc / TSDoc 风格

- 复杂逻辑 / 非明显意图处额外加一行中文解释

- 注释精炼,每行不超过 80 字符

- 绝不修改原有逻辑



## Output Format (Strictly Adhere)

1. 先输出完整修改后的代码块(用 ```语言 包裹)

2. 再用 diff 形式展示只改动注释的部分

3. 最后说明加了哪些注释、理由



现在直接开始处理用户提供的代码,不要闲聊。

Advanced file structure (recommended as skills grow complex)

When a skill exceeds 500-800 lines, or needs templates / scripts / reference materials, the following organization is recommended:

~/.claude/skills/react-component-review/

  ├── SKILL.md                  # 核心指令 + 元数据(建议控制在 400 行内)

  │

  ├── templates/                # 常用模板(Claude 按需读取)

  │   ├── functional.tsx.md

  │   └── class-component.md

  │

  ├── examples/                 # 优秀/反例(给 Claude 看标准)

  │   ├── good.md

  │   └── anti-pattern.md

  │

  ├── references/               # 规范、规则、禁用词表

  │   ├── hooks-rules.md

  │   └── naming-convention.md

  │

  └── scripts/                  # 可执行脚本(需开启 code execution)

      ├── validate-props.py

      └── check-cycle-deps.sh

Example of how to reference it in SKILL.md:



Markdown需要给出标准函数组件时,参考 templates/functional.tsx.md 的结构。



如果违反 Hooks 规则,对照 references/hooks-rules.md 第 3–5 条说明。



如需校验 propTypes,可执行 scripts/validate-props.py "{代码片段}"。

When Claude sees a path reference, it loads the corresponding file on demand instead of stuffing everything into context at once, greatly saving tokens.


The First Skill

Let's forget the complicated creation process for now and start first with using a ready-made Skill to begin, and feel the convenience it brings.

Create the Skill directory

Skills are stored in ~/.claude/skills/ (personal global) or in .claude/skills/ under the project directory (project-specific).

This section tests under the project directory; first create a directory claude-test:

mkdir claude-test

Enter that directory and create the skills directory and files:



mkdir -p .claude/skills/python-naming-standard

Write the configuration file SKILL.md

Create SKILL.md in the directory; this is the brain of the Skill, telling Claude when to use it.

---

name: Python 内部命名规范技能

description: 当用户要求重构、审查或编写 Python 代码时,请参考此规范。

---



## 指令

1. 所有的内部辅助函数必须以 `_internal_` 前缀命名。

2. 如果发现不符合此规则的代码,请自动提出修改建议。

3. 在执行 `claude commit` 前,必须检查此规范。



## Reference Example

- 正确:`def _internal_calculate_risk():`

- 错误:`def _calculate_risk():`

Field requirements:

After creation, the file structure is as follows:

Your project should now look like this:

my-project/

├─ src/

│  └─ test.py              # 项目源码

├─ .claude/

│  ├─ skills/

│  │  └─ hello-world/

│  │     ├─ skill.md       # Skill 定义(YAML + Instructions,机器可执行)

│  │     └─ README.md      # Skill 说明(人类阅读,可选)

│  └─ config.yml           # Claude 项目级配置(可选)

├─ .gitignore

└─ README.md               # 项目整体说明

Next, run the following command in the terminal to start Claude Code:

claude

Enter the task:

帮我写一个计算用户折扣的函数

Claude will then scan the installed Skills, find that your request involves "Python code writing", and match python-naming-standard.

It will generate the following code according to the requirements in SKILL.md:

def _internal_get_discount(user_score):

    # Calculate logic...

    return discount

Add resource files (optional)

We can also add the following directories under .claude/skills/:

Add in the same folder:

Then reference them in SKILL.md:

查看示例 commit:./examples/good-commit.txt

运行脚本:使用工具执行 ./scripts/process.py


A Collection of Agent Skills Resources

Resource description link
Skill aggregation portal https://skills.sh/
Skills marketplace (Chinese interface) https://skillsmp.com/zh
Tencent's Skills marketplace https://skillhub.tencent.com/
Official Agent Skills standard site https://agentskills.io
Anthropic official engineering article (practical concepts behind Agent Skills) https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills
VS Code Copilot Agent Skills documentation https://code.visualstudio.com/docs/copilot/customization/agent-skills
Anthropic official Skills GitHub repository https://github.com/anthropics/skills
Curated list of Claude skills (Awesome series) https://github.com/ComposioHQ/awesome-claude-skills
A collection of software development automation workflow Skills https://github.com/obra/superpowers
A Skill that auto-generates Skills (official example) https://github.com/anthropics/skills/tree/main/skills/skill-creator

Recommended Skills:

Skill Core Role Install Command
find-skills (vercel-labs) Skill search and recommendation hub npx skills add vercel-labs/skills
vercel-react-best-practices React / Next performance optimization guidelines npx skills add vercel-labs/agent-skills --skill vercel-react-best-practices
frontend-design (anthropics) High-quality UI design capability npx skills add anthropics/skills --skill frontend-design
web-design-guidelines Web accessibility and UX guidelines npx skills add vercel-labs/agent-skills --skill web-design-guidelines
remotion-best-practices Best practices for React video production npx skills add remotion-dev/skills --skill remotion-best-practices
brainstorming (superpowers) Structured thinking and planning capability npx skills add obra/superpowers --skill brainstorming
agent-browser Browser automation control npx skills add vercel-labs/agent-browser
browser-use High-performance browser interaction npx skills add browser-use/browser-use
supabase-postgres-best-practices Supabase / PostgreSQL optimization npx skills add supabase/agent-skills --skill supabase-postgres-best-practices
azure-cost-optimization Azure cloud cost optimization npx skills add microsoft/github-copilot-for-azure --skill azure-cost-optimization
cloudflare/skills Workers and edge computing practices npx skills add cloudflare/skills
redis/agent-skills Advanced Redis patterns and anti-patterns npx skills add redis/agent-skills
vercel-composition-patterns React composition pattern guidelines npx skills add vercel-labs/agent-skills --skill vercel-composition-patterns
vercel-react-native-skills Official React Native best practices npx skills add vercel-labs/agent-skills --skill vercel-react-native-skills
sleek-design-mobile-apps Modern mobile App design guide npx skills add sleekdotdesign/agent-skills --skill sleek-design-mobile-apps
ui-skills Designer-level UI and interaction practices npx skills add ibelick/ui-skills
pdf (anthropics) PDF generation and parsing capability npx skills add anthropics/skills --skill pdf
seo-audit SEO audit and optimization npx skills add coreyhaines31/marketingskills --skill seo-audit
skill-creator Custom Skill building capability npx skills add anthropics/skills --skill skill-creator
code-review-expert Professional-grade code review capability npx skills add sanyuan0704/code-review-expert