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

Skills Basic Structure

Skills Basic Structure

The core essence of Skills is to provide AI with operational guidance that defines standardized execution flows; once the rules are written, they can be repeatedly called and directly reused like program functions.

Skills are stored as Markdown text and do not directly execute functionality themselves.

Skills' characteristics of on-demand loading and progressive invocation efficiently accumulate work experience and enable rapid reuse and precise transfer of capabilities.


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: your-skill-name

description: 一句话描述该 Skill 的功能和使用场景

---



# Skill Name



## Usage Guide

[给 AI 的分步骤行为指引]



## 示例

[该 Skill 的具体使用示例]



The entire SKILL.md is divided into two parts: a YAML frontmatter (header configuration) wrapped in ---, and the Markdown body (execution instructions) below it.

Field Required Description Example
name Is The unique identifier of a Skill, named in kebab-case. It is referenced by the / command and is the key field for the system to identify the Skill. web-design-guidelines
description Is A one-sentence description of the functionality and trigger scenarios. The more specific the content, the more accurate the triggering. UI/UX design review for web pages

Next, we will break down each part one by one:

Frontmatter: Two Required Fields

Frontmatter is the YAML configuration block wrapped in --- at the top of SKILL.md, containing the identity information of the entire Skill.

Only two fields are officially required:

Field 1: name (skill name)

The name field has a maximum of 64 characters and can only contain lowercase letters, digits, and hyphens.

name: processing-pdfs        # 好:动名词形式,清晰描述功能

name: analyzing-spreadsheets # 好:一眼知道用途

name: my-brand-guidelines    # 好:组织专属知识



name: helper      # 差:太模糊

name: MySkill     # 差:包含大写字母(不合规)

name: data files  # 差:包含空格(不合规)

It is recommended to use a gerund form (verb + -ing) for naming, such as processing-pdfs and analyzing-spreadsheets, which clearly describes the activity or capability the Skill provides.

Recommend Not recommended Reason
code-reviewer CodeReviewer Use lowercase and hyphens consistently to avoid cross-platform compatibility issues
sql-optimizer sql_optimizer kebab-case is the conventional format, consistent with the directory name
deploy-check deploy-check-tool-v2 The name should be short, with version information described inside the file

Field 2: description (trigger condition description)

This is the most important field. At startup, the system only preloads the name and description of all Skills into the system prompt.

Only when the AI determines that the description is relevant to the current task will it further read the full SKILL.md content.

description should contain two parts:What this Skill does, and when Claude should use it.

description: |

  Use when the user needs to create, read, edit, or generate Word

  documents (.docx). Triggers include: 'Word doc', 'word document',

  '.docx', 'report', 'letter', 'memo', or any request to produce

  a formatted document for sharing or printing.

Markdown Body: Internal Structure of Execution Instructions

Recommend Not recommended Reason
"Scan for SQL injection risks in Python code and give fix suggestions" "A security tool" The description is too broad to trigger accurately
"Convert Markdown into brand-compliant HTML emails" "Convert file formats" Lacks specific scenarios and may be falsely triggered in other tasks

After the frontmatter comes the Markdown body, which tells the AI exactly what to do.

It should contain at least two sections:

SKILL.md example

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 descriptions:

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)

Skill file directory structure

A skill is a folder containing at least a SKILL.md file, and may also include other directories and files as needed.

To avoid context bloat:

Recommended structure:



my-skill/

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

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

      └── helper.py

├── references/       # 可选:参考文档

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

└── ...               # 其他文件或目录

The purpose of each directory is as follows: