# 策展 · X (Twitter) 🔥🔥🔥🔥🔥

> 作者：Nyk 🌱 (@nyk_builderz) · 平台：X (Twitter) · 日期：2026-04-25

> 原始來源：https://x.com/nyk_builderz/article/2048115264680829238

## 中文摘要

Claude Code 的 SKILL.md 讓你 15 分鐘內建置首個自動觸發 AI 工作流程。

Claude Code 的「skill」僅是個 Markdown 檔案，就能教會 Claude 處理先前無法完成的工作，或避免重複浪費時間的失敗模式；作者整合官方文件、熱門社群技能（如 96K stars 的 superpowers、20K stars 的 gstack）及自身 x-article-factory pipeline 經驗，彙整此完整指南，讓新手快速上手。

**skill 的本質**

skill 不是 plugin、框架或 API 整合，而是一個置於資料夾的 Markdown 檔案；當 Claude 遇到匹配 skill 描述的任務時，會自動載入並遵循指示，無需手動呼叫或額外提示。

與 commands 和 agents 的差異：
- commands 需使用者輸入 /command-name，手動觸發。
- Agents 是獨立 context window 的專門子代理人格。
- skills 監控對話，任務匹配即自動啟用，如本能反應。

作者強調，這差異關鍵：commands 如按鈕、agents 如專家、skills 如直覺。

**SKILL.md 結構**

每個 skill 置於專屬目錄，以 SKILL.md 為入口，包含 frontmatter 和指示兩部分。

範例（security-review skill）：
```
---
name: security-review
description: Comprehensive security audit. Use when reviewing
  code for vulnerabilities, before deployments, or when the
  user mentions security.
allowed-tools: Read, Grep, Glob
---
Analyze the codebase for security vulnerabilities:

1. SQL injection and XSS risks
2. Exposed credentials or secrets
3. Insecure configurations
4. Authentication gaps

Report findings with severity ratings and specific fixes.
Reference @DETAILED_GUIDE.md for our security standards.
```

description 是核心，Claude 據此判斷是否啟用；模糊描述（如 "help with code"）會過度觸發，過窄（如 "only for Python 3.11 FastAPI handlers"）則永不啟用。最佳作法：描述觸發條件，而非 skill 本身，例如 "Use when reviewing code for vulnerabilities" 優於 "security review tool"。

**5 分鐘建置首個 skill**

作者示範最實用新手 skill：code-review，針對團隊常見問題檢查程式碼。

步驟：
1. 建立目錄：`mkdir -p .claude/skills/code-review`
2. 撰寫 SKILL.md：
```
---
name: code-review
description: Expert code reviewer. Use PROACTIVELY when
  reviewing PRs, checking for bugs, or before merging.
allowed-tools: Read, Grep, Glob
---
You are a senior code reviewer focused on correctness.

When reviewing code:
- Flag bugs, not style issues
- Suggest specific fixes, not vague improvements
- Check for edge cases and error handling gaps
- Note performance concerns only at scale

Output format:
## Critical (must fix)
## Warnings (should fix)
## Notes (consider)
```
3. 重啟 Claude Code 或新開 session。
4. 要求 Claude 審核程式碼，即自動載入 skill。

總計不到 5 分鐘，即有可運作 skill。

**自動觸發的魔力（auto-invocation）**

skill 強大之處在於 Claude 讀取 frontmatter 的 description，自動判斷任務是否匹配，無需輸入 /code-review；例如處理 PR 時，因描述匹配而自動載入。

控制觸發方式：
- 精準 description："Use when the user asks to review a pull request or when checking code before merging" 只在 PR 審核觸發；"Use for code" 則無所不觸發。
- allowed-tools 限制權限：security-review 只允許 Read、Grep、Glob，不得 Write 或 Edit，作為安全網。
- paths 欄位範圍限制：
```
---
paths:
  - "src/api/**/*.ts"
  - "src/handlers/**/*.ts"
---
```
如此，API conventions skill 只在 API 檔案觸發，test standards skill 只在測試檔案啟用。

**附加模板與支援檔案**

skill 可捆綁支援檔案，轉化為完整套件，而非單純提示。

目錄結構範例（.claude/skills/security-review/）：
```
├── SKILL.md
├── DETAILED_GUIDE.md          # 以 @ 參照的詳細指南
├── templates/
│   └── security-report.md     # 輸出模板
└── examples/
    └── good-review.md         # 範例輸出
```

在指示中以 @FILENAME.md 參照，skill 啟用時自動載入。適用時機：
- SKILL.md 過長需拆分詳細指南。
- 需一致輸出模板。
- 提供「好範例」示範期望輸出。

不適用時：SKILL.md 少於 50 行，保持簡潔即可。

**5 種新手 skill 類型**

作者建議勿一開始建複雜多檔 skill，從以下入手，按日常痛點選擇，今晚即安裝一個。

- **Review skill**：檢查特定程式碼問題，如上述範例。最易建置、立即價值最高。
- **Debugging skill**：強制方法論 "reproduce → isolate → hypothesize → verify"，避免 Claude 的「猜測套用」循環產生新 bug。
- **Documentation skill**：依團隊格式產生文件，提供模板讓 Claude 填入，確保一致性無需手動。
- **Test-first skill**：強制先寫測試再實作，反轉預設「先寫程式碼、再補通過的測試」行為。
- **Deploy skill**：執行部署檢查清單，包括 version bump、changelog、build、test、tag、push，自動化重複手動序列。

**常見浪費時間錯誤**

作者列出 5 大錯誤，強調避免以確保效率：

- **描述過廣**：如 "help with coding" 匹配一切，造成每場 session 雜訊；須精準觸發條件。
- **指示過多**：200 行 SKILL.md 耗 context 卻無相稱價值；50 行內說不清，拆為 SKILL.md + @DETAILED_GUIDE.md。
- **無範例**：Claude 更遵從範例而非規則；特定輸出格式須示範，而非僅描述。
- **略過 allowed-tools**：無限制，skill 可任意 Read、Write、Edit、執行；總指定最小必要工具。
- **先建多檔複雜 skill**：單檔 skill 未熟練前勿加複雜；先掌握基礎。

**結語與實踐建議**

skill 非程式碼，而是 Markdown 書寫的行為合約；精準定義觸發、指示、輸出格式，越可靠 Claude 表現越佳。

起步：建一個 skill，測試 5 個真實任務，改善一項，再建下一個。個人 skill 放 ~/.claude/skills/（全專案通用）；專案 skill 放 .claude/skills/（經 git 分享團隊）。

skill 市場有 80,000+ 條目，但自製針對特定工作流程、痛點、團隊的 20 行 skill，永遠勝通用下載品。作者提問：Claude 哪個任務總錯，一個 20 行 skill 就能修？

## 標籤

Skills, Claude Code, 教學資源, Anthropic, Claude
