Anthropic 在 2025 年 10 月正式发布了 Claude Skills / Agent Skills 机制,这是该概念首次以产品级形态出现,并在随后(2025 年 12 月)进一步被推广为开放标准。

Agent Skill 是一个“能力包”(Capability Package),本质上是一个文件夹,里面包含:

  • SKILL.md:告诉 Agent 何时使用这个技能、做什么
  • 可选脚本:如 Python/JS 等可执行代码
  • 可选资源:模板、参考文档等

它的作用是:

  • 让 AI Agent 在需要时自动加载技能
  • 让 Agent 学会稳定执行某类任务(如 PDF 处理、做 PPT、调用 API…)
  • 把能力从 prompt 中抽离出来,变成可共享、可复用、可版本化的“工程制品”

一句话总结:

Agent Skill = 给 AI Agent 的“可安装技能包”,能让它像软件一样获得新能力。

这篇文章的目的只有一个,真正理解Skill为以后快速上手构建一个 Skill做准备。

— 1 SKILL.md 的构成— SKILL.md 是 Skill 中唯一必需的文件 每个 Skill 需要一个 SKILL.md 文件,以 — 标记之间的 YAML 元数据开头,必须包含 name 和 description,后跟 Markdown 指令。 注意,SKILL.md 是 Skill 中唯一必需的文件!

---
name: api-doc-generator
description: Generate comprehensive API documentation from code. Use when creating API docs, documenting endpoints, or generating OpenAPI specs.
---
# API Documentation Generator
When generating API documentation:
1. Identify all API endpoints and routes
2. Document request/response formats
3. Include authentication requirements
4. Add example requests and responses
5. Generate OpenAPI/Swagger specification if needed

简单的 Skill 只需要一个 SKILL.md,但复杂的任务可以包含脚本和参考资料。标准目录结构:

{skill-name}/
├── SKILL.md              # Required: main file
├── REFERENCE.md          # Optional: reference
├── EXAMPLES.md           # Optional: documentation examples
├── scripts/              # Optional: helper scripts
│   └── helper.py
└── templates/            # Optional: template files
└── template.txt

SKILL.md 中引用辅助文件实现渐进式披露:

For better usage,see [REFERENCE.md]. For examples, see [EXAMPLES.md].
Run the helper script:
python scripts/helper.py input.txt
plaintext — 1 Skill 示例 — Skill 从简单到复杂 接下来用一个简单和复杂的Skill 示例对Skill做一个更加 清晰的讲解和梳理 示例 1:单文件简单 Skill,分析日志文件并诊断问题。 目录结构:仅skill.md ``````code-snippet__js --- name: log-analyzer description: Analyze log files to identify errors, patterns, and performance issues. Use when debugging logs, investigating errors, or monitoring application behavior. --- # Log Analyzer ## Instructions 1. Read the log file to understand its format 2. Identify and categorize issues: - Error patterns and stack traces - Warning messages - Performance bottlenecks - Unusual patterns or anomalies 3. Provide summary with: - Issue severity and frequency - Root cause analysis - Recommended solutions ## Analysis tips - Focus on recent critical errors first - Look for recurring patterns - Check timestamp correlations across entries ``````plaintext ``````plaintext 示例 2:多文件 Skill 数据库迁移与版本管理工具,目录结构: ```

### ```code-snippet__js database-migrator/ ├── SKILL.md ├── MIGRATION_GUIDE.md ├── ROLLBACK.md └── scripts/ ├── generate_migration.py ├── validate_schema.py └── backup_db.sh ``````plaintext skill.md ```

```code-snippet__js
---
name: database-migrator
description: Generate and manage database migrations, schema changes, and data transformations. Use when creating migrations, modifying database schema, or managing database versions. Requires sqlalchemy and alembic packages.
---
# Database Migrator
## Quick start
Generate a new migration:
```bash
python scripts/generate_migration.py --name add_user_table

For detailed migration patterns, see [MIGRATION_GUIDE.md](MIGRATION_GUIDE.md).
For rollback strategies, see [ROLLBACK.md](ROLLBACK.md).
## Workflow
1. **Analyze changes**: Compare current schema with desired state
2. **Generate migration**: Create migration file with up/down operations
3. **Validate**: Run `python scripts/validate_schema.py` to check syntax
4. **Backup**: Execute `scripts/backup_db.sh` before applying
5. **Apply**: Run migration in staging environment first
6. **Verify**: Check data integrity after migration
## Requirements
Install required packages:
```bash
pip install sqlalchemy alembic psycopg2-binary

Safety checks

  • Always backup before migrations
  • Test rollback procedures
  • Validate data integrity after changes
  • Use transactions for atomic operations

针对这个案例,我们会加入一些解释说明:
database-migrator 可以被视为是一个非常典型的生产级 Skill 范本。它展示了如何将一个复杂的运维任务(数据库迁移)拆解为 AI 可理解、可执行的结构化指令。

我们可以从以下四个维度来拆解这个 Skill 的设计精妙之处,作为案例分析:

  1. 语义锚点:精准的元数据(Metadata)

在 YAML 区块中,description 扮演了“导航员”的角色。

  • 动作词驱动:使用了 Generate、manage、modifying 等动词,精准匹配用户的意图。
  • 上下文补全:明确提到了 sqlalchemy 和 alembic。这不仅是信息,更是给 AI 的提示——如果当前项目中没有这些库,AI 会主动提醒你安装,或者切换到对应的逻辑。
  1. 渐进式披露:主从文件结构

注意到 MIGRATION_GUIDE.md 和 ROLLBACK.md 了吗?

这是高级 Skill 设计的核心技巧:

  • 不要把所有东西都塞进一个文件。
  • 主文件(SKILL.md)负责定义流程(Workflow)。
  • 从文件负责存储长篇累牍的参考资料

这种设计避免了 AI 在单次对话中因上下文过长而导致指令漂移(Instruction Drift),只有在需要时才引导 AI 去阅读细节。

  1. SOP 化:闭环的工作流(Workflow)

Skill 的核心价值在于标准化。

这里的 Workflow 是一个严格的 6 步 SOP:

分析(Analyze) →
生成(Generate) →
验证(Validate) →
备份(Backup) →
应用(Apply) →
验证(Verify)

这种线性递进的设计,能显著降低 AI 产生“幻觉”的概率。它强制 AI 在执行前先验证,在应用前先备份,将人类的高级工程经验固化成了 AI 的行为准则。

  1. 自动化集成:脚本与指令的结合

这个 Skill 不只是文本,它还关联了 scripts/ 目录下的 Python 和 Shell 脚本。

  • 它让 AI 知道:它不仅仅能说话,它还有“工具包”。
  • 通过这种方式,Skill 将 LLM 的推理能力 与 传统程序的确定性 相结合。AI 负责决定什么时候迁移,脚本负责如何执行操作。

总结:一个优秀的 Skill 应该像一份资深工程师给新员工写的技术手册:告诉他的手册关于的是哪方面技能也就是目标是什么(Metadata),第一步该做什么(Quick Start),标准流程是什么(Workflow),以及绝对不能踩的红线在哪里(Safety Checks)。

学AI大模型的正确顺序,千万不要搞错了

🤔2026年AI风口已来!各行各业的AI渗透肉眼可见,超多公司要么转型做AI相关产品,要么高薪挖AI技术人才,机遇直接摆在眼前!

有往AI方向发展,或者本身有后端编程基础的朋友,直接冲AI大模型应用开发转岗超合适!

就算暂时不打算转岗,了解大模型、RAG、Prompt、Agent这些热门概念,能上手做简单项目,也绝对是求职加分王🔋

在这里插入图片描述

📝给大家整理了超全最新的AI大模型应用开发学习清单和资料,手把手帮你快速入门!👇👇

学习路线:

✅大模型基础认知—大模型核心原理、发展历程、主流模型(GPT、文心一言等)特点解析
✅核心技术模块—RAG检索增强生成、Prompt工程实战、Agent智能体开发逻辑
✅开发基础能力—Python进阶、API接口调用、大模型开发框架(LangChain等)实操
✅应用场景开发—智能问答系统、企业知识库、AIGC内容生成工具、行业定制化大模型应用
✅项目落地流程—需求拆解、技术选型、模型调优、测试上线、运维迭代
✅面试求职冲刺—岗位JD解析、简历AI项目包装、高频面试题汇总、模拟面经

以上6大模块,看似清晰好上手,实则每个部分都有扎实的核心内容需要吃透!

我把大模型的学习全流程已经整理📚好了!抓住AI时代风口,轻松解锁职业新可能,希望大家都能把握机遇,实现薪资/职业跃迁~

这份完整版的大模型 AI 学习资料已经上传CSDN,朋友们如果需要可以微信扫描下方CSDN官方认证二维码免费领取【保证100%免费

在这里插入图片描述

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐