Skip to main content

สร้างและแจกจ่าย Plugin Marketplace

สร้างและโฮสต์ plugin marketplace เพื่อแจกจ่าย Claude Code extensions ให้กับทีมและชุมชน

Plugin marketplace คือ catalog ที่ให้คุณแจกจ่าย plugin ให้คนอื่น ๆ Marketplace ให้การค้นพบแบบรวมศูนย์ การติดตามเวอร์ชัน การอัปเดตอัตโนมัติ และรองรับประเภท source หลายแบบ

กำลังติดตั้ง plugin จาก marketplace ที่มีอยู่? ดู Discover and install prebuilt plugins

ภาพรวม

การสร้างและแจกจ่าย marketplace ประกอบด้วย:

  1. สร้าง plugins: สร้าง plugin หนึ่งอันหรือมากกว่าพร้อม skills, agents, hooks, MCP servers หรือ LSP servers
  2. สร้างไฟล์ marketplace: กำหนด marketplace.json ที่แสดง plugin ของคุณและที่อยู่ (ดู Create the marketplace file)
  3. โฮสต์ marketplace: push ไปยัง GitHub, GitLab หรือ git host อื่น
  4. แชร์กับผู้ใช้: ผู้ใช้เพิ่ม marketplace ของคุณด้วย /plugin marketplace add และติดตั้ง plugin แต่ละตัว

Walkthrough: สร้าง Local Marketplace

ขั้นตอนที่ 1: สร้างโครงสร้าง directory

mkdir -p my-marketplace/.claude-plugin
mkdir -p my-marketplace/plugins/quality-review-plugin/.claude-plugin
mkdir -p my-marketplace/plugins/quality-review-plugin/skills/quality-review

ขั้นตอนที่ 2: สร้าง skill

---
description: Review code for bugs, security, and performance
disable-model-invocation: true
---

Review the code I've selected or the recent changes for:
- Potential bugs or edge cases
- Security concerns
- Performance issues
- Readability improvements

Be concise and actionable.

ขั้นตอนที่ 3: สร้าง plugin manifest

{
"name": "quality-review-plugin",
"description": "Adds a quality-review skill for quick code reviews",
"version": "1.0.0"
}

ขั้นตอนที่ 4: สร้างไฟล์ marketplace

{
"name": "my-plugins",
"owner": {
"name": "Your Name"
},
"plugins": [
{
"name": "quality-review-plugin",
"source": "./plugins/quality-review-plugin",
"description": "Adds a quality-review skill for quick code reviews"
}
]
}

ขั้นตอนที่ 5: เพิ่มและติดตั้ง

/plugin marketplace add ./my-marketplace
/plugin install quality-review-plugin@my-plugins

ขั้นตอนที่ 6: ทดลองใช้

/quality-review-plugin:quality-review

สร้างไฟล์ Marketplace

สร้าง .claude-plugin/marketplace.json ใน repository root ของคุณ:

{
"name": "company-tools",
"owner": {
"name": "DevTools Team",
"email": "[email protected]"
},
"plugins": [
{
"name": "code-formatter",
"source": "./plugins/formatter",
"description": "Automatic code formatting on save",
"version": "2.1.0",
"author": {
"name": "DevTools Team"
}
},
{
"name": "deployment-tools",
"source": {
"source": "github",
"repo": "company/deploy-plugin"
},
"description": "Deployment automation tools"
}
]
}

Marketplace Schema

ฟิลด์ที่จำเป็น

ฟิลด์ประเภทคำอธิบาย
namestringตัวระบุ marketplace (kebab-case ไม่มีเว้นวรรค)
ownerobjectข้อมูลผู้ดูแล marketplace
pluginsarrayรายการ plugin ที่มี

หมายเหตุ: ชื่อที่สงวนไว้รวมถึง: claude-code-marketplace, claude-plugins-official, claude-plugins-community เป็นต้น

ฟิลด์ Owner

ฟิลด์ประเภทจำเป็นคำอธิบาย
namestringใช่ชื่อผู้ดูแลหรือทีม
emailstringไม่Email ติดต่อ

Plugin Sources

Sourceประเภทฟิลด์หมายเหตุ
Relative pathstring (เช่น "./my-plugin")ไม่มีLocal directory ภายใน marketplace repo
githubobjectrepo, ref?, sha?
urlobjecturl, ref?, sha?Git URL source
git-subdirobjecturl, path, ref?, sha?Subdirectory ภายใน git repo
npmobjectpackage, version?, registry?ติดตั้งผ่าน npm install

Relative Paths

{
"name": "my-plugin",
"source": "./plugins/my-plugin"
}

GitHub Repositories

{
"name": "github-plugin",
"source": {
"source": "github",
"repo": "owner/plugin-repo",
"ref": "v2.0.0",
"sha": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0"
}
}

การจัดการเวอร์ชัน

ถ้า plugin entry มีฟิลด์ version ที่ตั้งไว้ผู้ใช้จะได้รับอัปเดตเฉพาะเมื่อฟิลด์นั้นเปลี่ยน ถ้าไม่มี version และ marketplace โฮสต์ใน git ทุก commit จะนับเป็นเวอร์ชันใหม่

โฮสต์และแจกจ่าย Marketplace

ใช้ GitHub หรือ GitLab repositories เป็นวิธีที่ง่ายที่สุดในการโฮสต์ marketplace:

/plugin marketplace add owner/repo

ใน managed settings สำหรับทีม:

{
"extraKnownMarketplaces": {
"company-tools": {
"source": {
"source": "github",
"repo": "company/claude-plugins"
}
}
}
}

Private Repositories

สำหรับ marketplace ส่วนตัว ใช้:

{
"source": {
"source": "github",
"repo": "your-org/internal-plugins",
"auth": "token"
}
}

หรือผ่าน SSH:

/plugin marketplace add [email protected]:your-org/internal-plugins.git

การแก้ปัญหา

Plugin ที่มี relative path ล้มเหลวใน URL-based marketplace: Relative path ใช้ได้เฉพาะเมื่อผู้ใช้เพิ่ม marketplace ของคุณผ่าน Git สำหรับการแจกจ่ายแบบ URL-based ใช้ GitHub, npm หรือ git URL source แทน

การติดตั้งล้มเหลวด้วย dependency error: ตรวจสอบ allowCrossMarketplaceDependenciesOn ใน marketplace schema ของคุณ