跳到內容

貢獻插件

本指南說明如何建立新插件並將其加入 f5-sales-demo 市集。

每個插件都位於 plugins/ 下的獨立目錄中, 並遵循以下結構:

  • 目錄plugins/
    • 目錄example-plugin/
      • 目錄.claude-plugin/
        • plugin.json
      • 目錄skills/
        • 目錄example-skill/
          • SKILL.md
          • 目錄references/
            • reference-data.md
      • 目錄commands/
        • example-command.md
      • 目錄agents/
        • example-agent.md
      • README.md
  1. 建立插件目錄

    Terminal window
    mkdir -p plugins/example-plugin/.claude-plugin
    mkdir -p plugins/example-plugin/skills
    mkdir -p plugins/example-plugin/commands
  2. 撰寫 plugin.json

    建立 plugins/example-plugin/.claude-plugin/plugin.json

    {
    "name": "example-plugin",
    "description": "What this plugin does",
    "version": "1.0.0",
    "author": {
    "name": "f5-sales-demo"
    },
    "homepage": "https://github.com/f5-sales-demo/marketplace/tree/main/plugins/example-plugin",
    "keywords": ["relevant", "keywords"],
    "license": "Apache-2.0",
    "repository": "https://github.com/f5-sales-demo/marketplace"
    }
  3. 新增技能

    建立 plugins/example-plugin/skills/example-skill/SKILL.md, 並加入 frontmatter:

    ---
    name: example-skill
    description: One-line description of what this skill does
    ---
    Detailed instructions for Claude when this skill activates.

    將任何參考資料放置於 SKILL.md 旁的 references/ 子目錄中。

  4. 新增命令

    建立 plugins/example-plugin/commands/example-command.md

    ---
    description: What this command does
    argument_hint: "[optional-args]"
    allowed_tools:
    - Read
    - Glob
    - Grep
    ---
    Instructions for Claude when the user invokes this command.
  5. 將插件加入 marketplace.json

    .claude-plugin/marketplace.jsonplugins 陣列中 新增一筆項目:

    {
    "name": "example-plugin",
    "description": "What this plugin does",
    "version": "1.0.0",
    "author": { "name": "f5-sales-demo" },
    "source": "./plugins/example-plugin",
    "category": "productivity",
    "homepage": "https://github.com/f5-sales-demo/marketplace/tree/main/plugins/example-plugin",
    "license": "Apache-2.0",
    "keywords": ["relevant", "keywords"],
    "tags": ["searchable", "tags"],
    "repository": "https://github.com/f5-sales-demo/marketplace"
    }
  6. 在本機測試

    在發布前先測試插件,方法是將 Claude Code 指向本機目錄:

    Terminal window
    claude --plugin-dir ./plugins/example-plugin

    確認技能在正確的情境下啟動, 且命令產生預期的輸出結果。

  1. 建立一個描述新插件的 GitHub issue
  2. main 建立功能分支
  3. 新增插件目錄並更新 marketplace.json
  4. docs/plugins/example-plugin.mdx 新增說明文件頁面
  5. 開啟 PR 並透過 Closes #N 連結至對應的 issue
  6. 修正所有 CI 失敗問題,待檢查通過後合併
  • 保持技能專注 — 每個技能應只做好一件事
  • 使用參考檔案 — 將大型資料集、結構描述及查找表 放置於 references/ 中,而非內嵌於 SKILL.md
  • 善用範圍限制 — 盡可能透過檢查未提交的變更 來縮小工作範圍
  • 依嚴重性分組輸出 — 使用 ERROR、WARNING 和 INFO 等級,讓使用者能優先處理問題
  • 撰寫 README — 包含使用範例,以及每個技能 和命令的功能說明