什麼是 Agent Skill
2026-03-04 23:08:01
# 1. 什麼是 Agent Skills?
Agent Skills 是 Anthropic 於 **2025 年 12 月 18 日**正式發布的**開放標準**,與 MCP(Model Context Protocol,模型上下文協定)一樣,朝著**通用跨平台規範**的方向發展。
官方提供了開箱即用的 **[Pre-built Skills](https://github.com/anthropics/skills/blob/main/skills/skill-creator/SKILL.md)**(如 Word、Excel、PowerPoint、PDF 處理),讓開發者能直接使用這些能力。同時,Atlassian、Figma、Canva、Stripe、Notion 等合作夥伴也已提供了官方 Skills。
# 2. SKILL 基礎架構
SKILL MD 檔案,範例如下
```yaml
---
name: backend-pr-review
description: 後端發 PR 時的程式碼審查流程
---
# 後端 PR 審查
## 使用時機
當開發者準備發 PR 時...
## 執行流程
1. 檢查程式碼風格
2. 驗證測試覆蓋率
3. ...
```
Skill 資料夾結構可參考如下
```c#
skill-name/
├── SKILL.md (必須)
│ ├── YAML frontmatter metadata (必須)
│ │ ├── name: (必須)
│ │ └── description: (必須)
│ └── Markdown instructions (必須)
└── Bundled Resources (選用)
├── scripts/ - 可執行程式碼(Python/Bash 等)
├── references/ - 需視需求載入 context 的文件
└── assets/ - 輸出用檔案(模板、圖示、字型等)
```
### Skill 資源類型說明
#### references/(參考文件)
在 SKILL中會描述:「執行這個步驟時,需要參考 references 中的某份文件」
Agent 會將該文件載入上下文中
**用途範例**:API 規格文件、公司編碼規範、範本格式說明
#### scripts/(可執行腳本)
Agent **只會執行**這些腳本,**不會讀取**程式碼內容
適合「先處理資料,再讓 Agent 接手」的場景
**用途範例**:
```python
# scripts/format_data.py
# Agent 執行這段程式將原始資料整理成結構化格式
# 輸出結果才會載入上下文供 Agent 繼續處理
```
#### assets/(資源檔案)
與 references 類似,透過 SKILL流程按需載入
可放置圖片、範本檔案等
# 3. 為什麼這樣設計?
把 SKILL想成「**可模組化的 Prompt**」:
| 特性 | 說明 |
|----|----|
| **可重複執行** | 同一個 Skill 可以反覆使用於類似任務 |
| **可搬遷** | Skills 就是檔案,可以版本控制、分享、跨平台 |
| **通用格式** | 任何支援此標準的 Agent 都能讀懂並執行 |
# 4. 漸進式揭露(Progressive Disclosure)
這是 Agent Skills 最強大的設計之一 —— **不需要每次都把所有指令塞進 System Prompt**。
### 運作流程
```
┌─────────────────────────────────────────────────────────────────┐
│ 1. Discovery(發現) │
│ Agent 啟動時只載入 Skill List │
│ 每個 Skill 只包含 name + description(僅數十個 tokens) │
└─────────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────────┐
│ 2. Activation(啟用) │
│ 當 Agent 判斷使用者意圖與某個 Skill 描述吻合時 │
└─────────────────────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────────────────────┐
│ 3. Execution(執行) │
│ Agent 載入完整的 SKILL.md │
│ 按照 SOP 流程逐步執行,按需載入 references、執行 scripts │
└─────────────────────────────────────────────────────────────────┘
```
### 為什麼這很重要?
* **節省 Token**:平常只佔用極少量的 context
* **按需載入**:需要時才載入完整指令
* **擴展性強**:可以部署大量 Skills 而不影響效能
### 對比:MCP 的 Context 爆掉問題
MCP 剛推出時,許多人遇到「裝太多 MCP servers 導致 context window 爆掉」的問題:
| 情況 | Token 消耗 |
|----|----|
| 單一 MCP server(20 tools) | \~14,000 tokens |
| 多個 MCP servers 同時啟用 | **66,000 - 82,000 tokens** |
| Claude Sonnet 4.5 總 context | 200,000 tokens |
> 實際案例:有人分享過,**還沒開始對話,光是載入 4 個 MCP servers,就已經用掉 67,000 tokens(約 33%)**。
**問題根源**:MCP 的設計是將所有連接的工具定義(名稱、描述、參數、JSON schema)**一開始就全部載入**到 context window。
### MCP vs Agent Skills 的 Context 使用對比
| | MCP | Agent Skills |
|----|----|----|
| **初始載入** | 所有工具的完整定義 | 只有 name + description |
| **初始 Token 消耗** | 數萬 tokens | 數十 tokens |
| **完整內容載入時機** | 一開始就全載入 | 需要時才載入 |
| **擴展性** | 工具越多越慢 | 可大量部署不影響效能 |
這正是 Progressive Disclosure 的核心價值 —— **從根本上解決了 context 膨脹的問題**。
---
# 5. 為什麼用「通用 Agent + Skills」而非「多個專用 Agent」?
根據 [VentureBeat 報導](https://venturebeat.com/ai/anthropic-launches-enterprise-agent-skills-and-opens-the-standard),Anthropic 產品經理 Mahesh Murag 在專訪中表示,Skills 代表了一種「**哲學轉變(philosophical shift)**」:
> "The traditional approach involved building specialized agents for different use cases — a customer service agent, a coding agent, a research agent."
>
> "Rather than building and maintaining multiple specialized AI systems, organizations can invest in creating and curating skills that encode their institutional knowledge and best practices."
### 思維轉變
> **這一兩年的做法**:針對不同用途打造「客服 Agent」、「程式 Agent」、「研究 Agent」...
>
> **Skills 做法**:維護一個通用 Agent,為它裝備各種「技能」
就像是:與其雇用多個只會單一技能的員工,不如培訓一個能學習多種技能的通才。
### Skills 的優勢
| 優勢 | 說明 |
|----|----|
| **模組化** | 一個 Skill 可被多種場景重複使用 |
| **集中管理** | 企業可統一管理、分發、更新 Skills |
| **版本控制** | Skills 是檔案,可以用 Git 管理 |
| **跨平台相容** | 開放標準,不被單一平台綁定 |
| **按需載入** | Progressive Disclosure 大幅節省 Token |
---
# 6. 與 MCP 的關係
| 協定 | 角色 | 比喻 |
|----|----|----|
| **MCP** | 定義 Agent 如何連接外部工具與資料 | 水管(Plumbing) |
| **Agent Skills** | 定義 Agent 如何使用這些連接來完成任務 | 操作手冊(Manual) |
兩者互補:MCP 提供安全的連接能力,Skills 提供具體的操作知識。
---
# 7. 安全管理與權限控管
### 為什麼 Skills 更容易審核?
Skills 的設計本身就具備「**Self-documenting**」特性:
* SKILL 是人類可讀的 Markdown 格式
* 任何人都能直接閱讀並理解這個 Skill 會做什麼
* 流程透明、步驟明確,便於審查與改進
> "A skill author or user can read a [SKILL.md](http://SKILL.md) and understand what it does, making skills easy to audit and improve." — 官方文件
### 信任來源原則
Anthropic 官方明確建議:
| 來源類型 | 建議做法 |
|----|----|
| **官方 / 合作夥伴 Skills** | 可直接使用(如 Atlassian、Notion、Figma 等) |
| **第三方 Skills** | 必須徹底審核後才能安裝 |
| **自行開發的 Skills** | scripts/ 中的可執行腳本需經過安全審查 |
> "Anthropic recommends installing skills only from trusted sources and thoroughly auditing those from less-trusted origins." — VentureBeat
### Scripts 安全注意事項
由於 scripts/ 中的程式碼會被 Agent **直接執行**,安全風險較高:
* **限制檔案系統存取**:僅允許存取特定目錄(如暫存工作區)
* **限制可用指令**:僅允許必要的工具(如 pytest、node)
* **避免廣泛權限**:除非有明確需求,否則不要開放 package manager
# 8. 參考資源
### 官方文件
* 官方網站:[agentskills.io](https://agentskills.io)
* 規格文件:[agentskills.io/specification](https://agentskills.io/specification)
* GitHub 範例:[github.com/anthropics/skills](https://github.com/anthropics/skills)
* 最佳實踐指南:[platform.claude.com/docs](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices)
### MCP Context 問題相關資料
* [Optimising MCP Server Context Usage in Claude Code](https://scottspence.com/posts/optimising-mcp-server-context-usage-in-claude-code) — Scott Spence 的實測數據(82,000 tokens 消耗)
* [Claude Code Just Cut MCP Context Bloat by 46.9%](https://medium.com/@joe.njenga/claude-code-just-cut-mcp-context-bloat-by-46-9-51k-tokens-down-to-8-5k-with-new-tool-search-ddf9e905f734) — 67,000 tokens 案例記錄
* [Code execution with MCP: building more efficient AI agents](https://www.anthropic.com/engineering/code-execution-with-mcp) — Anthropic 官方工程部落格
* [GitHub Issue #6186: Agent-Scoped MCP Servers](https://github.com/anthropics/claude-code/issues/6186) — 社群對 context overflow 的討論
### 新聞報導
* [VentureBeat: Anthropic launches enterprise 'Agent Skills'](https://venturebeat.com/technology/anthropic-launches-enterprise-agent-skills-and-opens-the-standard) — 2025/12/18 發布報導
* [Unite.AI: Anthropic Opens Agent Skills Standard](https://www.unite.ai/anthropic-opens-agent-skills-standard-continuing-its-pattern-of-building-industry-infrastructure/) — 開放標準策略分析
點擊複製文章連結