建立技能的五個步驟

建立您第一個 Agent 技能的逐步指南。

步驟 1:確定核心需求

在撰寫任何內容之前,請清楚定義:

  • 問題:您的技能解決什麼挑戰?
  • 受眾:誰會使用這個技能?
  • 範圍:技能應涵蓋(和不涵蓋)什麼?

需要回答的問題

  1. AI 使用此技能會執行哪些任務?
  2. 需要哪些領域知識?
  3. AI 應該表現出什麼行為?
  4. 應該避免哪些常見錯誤?

範例

問題:開發人員需要一致的程式碼審查回饋 受眾:使用 Pull Request 的開發團隊 範圍:程式碼品質、安全性和風格 - 不包含專案管理

步驟 2:撰寫名稱欄位

您的技能名稱應該:

  • 描述性:清楚說明技能的功能
  • 簡潔:最多 3-5 個字詞
  • 獨特:與類似技能區隔

好的名稱

  • "React Component Guidelines"
  • "API Security Checker"
  • "Brand Voice Guide"

不好的名稱

  • "My Skill"(沒有描述性)
  • "The Ultimate Complete Development Guide for Everything"(太長)
  • "Helper"(不夠具體)

步驟 3:撰寫描述

描述會出現在搜尋結果和技能卡片中。請好好利用它:

  • 前 100 個字元:最重要 - 會顯示在預覽中
  • 包含關鍵字:幫助使用者找到您的技能
  • 具體明確:提及主要功能或使用案例

範本

[Action] for [audience] that [key benefit]. Covers [main features].

範例

Code review guidelines for development teams that ensure consistent, high-quality feedback. Covers security, performance, and style checks.

步驟 4:撰寫主要內容

為了清晰和有效性,請結構化您的內容:

背景資訊區段

提供背景資訊:

markdown
## Context

This skill helps AI assistants review code with a focus on:
- Security vulnerabilities
- Performance optimization
- Code style consistency
- Best practice adherence

指導原則區段

列出具體規則:

markdown
## Guidelines

1. Always check for input validation
2. Look for potential SQL injection
3. Verify error handling exists
4. Check for hardcoded credentials
5. Review logging practices

範例區段

展示預期行為:

markdown
## Examples

### Security Review Comment
"Consider using parameterized queries here to prevent SQL injection.
The current string concatenation is vulnerable to malicious input."

### Performance Review Comment
"This loop iterates over the entire array for each element.
Consider using a Set or Map for O(1) lookups instead of O(n)."

步驟 5:上傳並測試

建立儲存庫

  1. 前往 GitHub 並建立新的儲存庫
  2. 將您的 SKILL.md 檔案新增至根目錄
  3. 將儲存庫設為公開

提交至市集

  1. 前往市集的 /submit
  2. 輸入您的儲存庫 URL
  3. 點擊「Submit」

測試您的技能

提交後:

  1. 在您偏好的平台上安裝技能
  2. 使用各種提示詞進行測試
  3. 驗證 AI 是否遵循您的指導原則
  4. 根據結果進行迭代和改進

測試檢查清單

發布前,請測試以下情境:

正常操作

  • [ ] AI 正確遵循主要指導原則
  • [ ] 範例被適當應用
  • [ ] 語氣和風格符合預期

邊界案例

  • [ ] 能優雅處理異常輸入
  • [ ] 不與其他技能衝突
  • [ ] 在支援的平台上都能運作

超出範圍

  • [ ] AI 正確處理不相關的主題
  • [ ] 不超越技能界限
  • [ ] 優雅處理範圍外的請求

後續步驟