Agent Skills 是模块化的能力包,包含指令、元数据和可选资源(脚本、模板),让AI Agent在需要时自动加载和使用。
📁 skill-name/
├── SKILL.md # 核心指令文件(YAML frontmatter + Markdown)
├── scripts/ # 可执行脚本(Python/Bash)
├── references/ # 参考文档
└── assets/ # 模板和资源文件

Level 1: 元数据(Metadata)- 总是加载
让 AI Agent 知道有哪些 Skills 可用,什么时候该用
Level 2: 指令(Instructions)- 触发时加载
当用户请求匹配 Skill 的 description 时
Level 3+: 资源和代码(Resources & Code)- 引用时加载
当 SKILL.md 中的指令引用这些文件时
1️⃣ 启动阶段(所有 Skills)
System Prompt 包含:
- "PDF Processing - Extract text and tables from PDFs"
- "Excel Analysis - Analyze spreadsheet data"
- ... (其他所有 Skills 的元数据)
Token 成本: 100 tokens × 10 Skills = 1,000 tokens
2️⃣ 用户请求
User: "Extract the text from this PDF and summarize it"
3️⃣ Claude 判断并触发
Claude 识别到需要 PDF 处理能力
执行: bash: cat pdf-skill/SKILL.md
Token 成本: +3,000 tokens(SKILL.md 内容)
4️⃣ Claude 评估是否需要更多资源
- 不需要表单填写 → 不读取 FORMS.md
- 需要提取表格 → 执行 python scripts/extract_tables.py
Token 成本: +200 tokens(脚本输出)
5️⃣ 完成任务
总 Token 消耗: 1,000 + 3,000 + 200 = 4,200 tokens