plugin-dev-guide

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Plugin Development Guide

插件开发指南

This meta-skill provides an overview of Claude Code plugin development and routes to specialized skills based on the task at hand.
本元技能提供Claude Code插件开发的概览,并根据手头任务引导至专业技能。

Plugin Development Skills Overview

插件开发技能概览

The plugin-dev toolkit provides 9 specialized skills for building Claude Code plugins, plus this guide. Each skill handles a specific domain of plugin development.
插件开发工具包提供9个用于构建Claude Code插件的专业技能,加上本指南。每个技能负责插件开发的特定领域。

Skill Quick Reference

技能速查

SkillPurpose
plugin-structureDirectory layout, manifest, component organization
command-developmentSimple prompts (single .md files in commands/)
agent-developmentAutonomous subagents
skill-developmentComplex prompts with bundled resources (skills/)
hook-developmentEvent-driven automation
mcp-integrationModel Context Protocol servers
lsp-integrationLanguage Server Protocol for code intelligence
plugin-settingsUser configuration via .local.md
marketplace-structurePlugin marketplace creation
技能名称用途
plugin-structure目录布局、清单文件、组件组织
command-development简单提示(commands/目录下的单个.md文件)
agent-development自主子Agent
skill-development包含捆绑资源的复杂提示(skills/目录下)
hook-development事件驱动的自动化
mcp-integrationModel Context Protocol 服务器
lsp-integration用于代码智能的Language Server Protocol
plugin-settings通过.local.md实现用户配置
marketplace-structure插件市场创建

When to Use Each Skill

何时使用各技能

Starting a New Plugin

启动新插件

Skill:
plugin-structure
Use when the user needs to:
  • Create a new plugin from scratch
  • Understand plugin directory layout
  • Configure plugin.json manifest
  • Learn about component auto-discovery
  • Use ${CLAUDE_PLUGIN_ROOT} for portable paths
技能:
plugin-structure
当用户需要以下操作时使用:
  • 从零开始创建新插件
  • 了解插件目录布局
  • 配置plugin.json清单文件
  • 学习组件自动发现机制
  • 使用${CLAUDE_PLUGIN_ROOT}实现可移植路径

Adding User-Facing Commands

添加面向用户的命令

Skill:
command-development
Use when the user needs to:
  • Create slash commands (/command-name)
  • Configure command frontmatter (description, allowed-tools, model)
  • Use dynamic arguments ($ARGUMENTS, $1, $2)
  • Reference files with @ syntax
  • Execute bash inline with
    [BANG]
    backticks
技能:
command-development
当用户需要以下操作时使用:
  • 创建斜杠命令(/command-name)
  • 配置命令前置元数据(描述、允许使用的工具、模型)
  • 使用动态参数($ARGUMENTS, $1, $2)
  • 使用@语法引用文件
  • 使用
    [BANG]
    反引号内联执行bash命令

Creating Autonomous Agents

创建自主Agent

Skill:
agent-development
Use when the user needs to:
  • Create subagents for complex tasks
  • Write agent system prompts
  • Configure agent triggering (description with examples)
  • Choose agent models and colors
  • Restrict agent tool access
技能:
agent-development
当用户需要以下操作时使用:
  • 创建用于复杂任务的子Agent
  • 编写Agent系统提示词
  • 配置Agent触发条件(带示例的描述)
  • 选择Agent模型和颜色
  • 限制Agent的工具访问权限

Building Skills

构建技能

Skill:
skill-development
Use when the user needs to:
  • Create skills that extend Claude's capabilities
  • Write SKILL.md with proper frontmatter
  • Organize skill content with progressive disclosure
  • Create references/, examples/, scripts/ directories
  • Write effective trigger phrases
技能:
skill-development
当用户需要以下操作时使用:
  • 创建扩展Claude能力的技能
  • 编写带有正确前置元数据的SKILL.md
  • 使用渐进式披露组织技能内容
  • 创建references/、examples/、scripts/目录
  • 编写有效的触发短语

Implementing Event Hooks

实现事件钩子

Skill:
hook-development
Use when the user needs to:
  • React to Claude Code events (PreToolUse, Stop, SessionStart, etc.)
  • Create prompt-based or command-based hooks
  • Validate tool inputs before execution
  • Enforce completion standards
  • Block dangerous operations
技能:
hook-development
当用户需要以下操作时使用:
  • 响应Claude Code事件(PreToolUse、Stop、SessionStart等)
  • 创建基于提示词或命令的钩子
  • 在执行前验证工具输入
  • 强制执行完成标准
  • 阻止危险操作

Integrating External Services via MCP

通过MCP集成外部服务

Skill:
mcp-integration
Use when the user needs to:
  • Add MCP servers to plugins
  • Configure stdio, SSE, HTTP, or WebSocket servers
  • Set up authentication (OAuth, tokens)
  • Use MCP tools in commands and agents
  • Discover existing MCP servers on PulseMCP
技能:
mcp-integration
当用户需要以下操作时使用:
  • 向插件添加MCP服务器
  • 配置stdio、SSE、HTTP或WebSocket服务器
  • 设置身份验证(OAuth、令牌)
  • 在命令和Agent中使用MCP工具
  • 在PulseMCP上发现现有MCP服务器

Adding Code Intelligence via LSP

通过LSP添加代码智能

Skill:
lsp-integration
Use when the user needs to:
  • Add Language Server Protocol servers to plugins
  • Enable go-to-definition and find-references
  • Configure language-specific servers (pyright, gopls, rust-analyzer)
  • Set up extensionToLanguage mappings
  • Enhance Claude's code understanding
技能:
lsp-integration
当用户需要以下操作时使用:
  • 向插件添加Language Server Protocol服务器
  • 启用跳转到定义和查找引用功能
  • 配置特定语言的服务器(pyright、gopls、rust-analyzer)
  • 设置extensionToLanguage映射
  • 增强Claude的代码理解能力

Managing Plugin Configuration

管理插件配置

Skill:
plugin-settings
Use when the user needs to:
  • Store user-configurable settings
  • Use .claude/plugin-name.local.md pattern
  • Parse YAML frontmatter in hooks
  • Create temporarily active hooks
  • Manage agent state
技能:
plugin-settings
当用户需要以下操作时使用:
  • 存储用户可配置的设置
  • 使用.claude/plugin-name.local.md模式
  • 在钩子中解析YAML前置元数据
  • 创建临时激活的钩子
  • 管理Agent状态

Creating Plugin Marketplaces

创建插件市场

Skill:
marketplace-structure
Use when the user needs to:
  • Create a marketplace for multiple plugins
  • Configure marketplace.json
  • Set up plugin sources (relative, GitHub, git URL)
  • Distribute plugins to teams
  • Organize plugin collections
技能:
marketplace-structure
当用户需要以下操作时使用:
  • 为多个插件创建市场
  • 配置marketplace.json
  • 设置插件源(相对路径、GitHub、Git URL)
  • 向团队分发插件
  • 组织插件集合

Decision Tree for Skill Selection

技能选择决策树

User wants to...
├── Create/organize a plugin structure? → plugin-structure
├── Add a simple slash command (no bundled resources)? → command-development
├── Create an autonomous agent? → agent-development
├── Add a complex skill with scripts/references? → skill-development
├── React to Claude Code events? → hook-development
├── Integrate external service/API? → mcp-integration
├── Add code intelligence/LSP? → lsp-integration
├── Make plugin configurable? → plugin-settings
└── Distribute multiple plugins? → marketplace-structure
用户想要...
├── 创建/组织插件结构? → plugin-structure
├── 添加简单斜杠命令(无捆绑资源)? → command-development
├── 创建自主Agent? → agent-development
├── 添加包含脚本/参考资料的复杂技能? → skill-development
├── 响应Claude Code事件? → hook-development
├── 集成外部服务/API? → mcp-integration
├── 添加代码智能/LSP? → lsp-integration
├── 使插件可配置? → plugin-settings
└── 分发多个插件? → marketplace-structure

Common Multi-Skill Workflows

常见多技能工作流

Building a Complete Plugin

构建完整插件

  1. Start: Load
    plugin-structure
    skill to create directory layout
  2. Add features: Load
    command-development
    for user-facing commands
  3. Automation: Load
    hook-development
    for event-driven behavior
  4. Configuration: Load
    plugin-settings
    if user configuration needed
  5. Validation: Use plugin-validator agent to validate structure
  1. 开始:加载
    plugin-structure
    技能创建目录布局
  2. 添加功能:加载
    command-development
    实现面向用户的命令
  3. 自动化:加载
    hook-development
    实现事件驱动行为
  4. 配置:如果需要用户配置,加载
    plugin-settings
  5. 验证:使用plugin-validator Agent验证结构

Creating an MCP-Powered Plugin

创建基于MCP的插件

  1. Start: Load
    plugin-structure
    for basic structure
  2. Integration: Load
    mcp-integration
    to configure MCP servers
  3. Commands: Load
    command-development
    to create commands that use MCP tools
  4. Agents: Load
    agent-development
    for autonomous MCP workflows
  1. 开始:加载
    plugin-structure
    搭建基础结构
  2. 集成:加载
    mcp-integration
    配置MCP服务器
  3. 命令:加载
    command-development
    创建使用MCP工具的命令
  4. Agent:加载
    agent-development
    实现自主MCP工作流

Building a Code Intelligence Plugin

构建代码智能插件

  1. Start: Load
    plugin-structure
    for basic structure
  2. LSP: Load
    lsp-integration
    to configure language servers
  3. Commands: Load
    command-development
    for commands using LSP features
  1. 开始:加载
    plugin-structure
    搭建基础结构
  2. LSP:加载
    lsp-integration
    配置语言服务器
  3. 命令:加载
    command-development
    创建使用LSP功能的命令

Building a Skill-Focused Plugin

构建聚焦技能的插件

  1. Start: Load
    plugin-structure
    for basic structure
  2. Skills: Load
    skill-development
    to create specialized skills
  3. Validation: Use skill-reviewer agent to validate skill quality
  1. 开始:加载
    plugin-structure
    搭建基础结构
  2. 技能:加载
    skill-development
    创建专业技能
  3. 验证:使用skill-reviewer Agent验证技能质量

Available Agents

可用Agent

The plugin-dev plugin also provides 3 agents:
AgentPurpose
plugin-validatorValidates plugin structure and manifests
skill-reviewerReviews skill quality and triggering
agent-creatorGenerates new agents from descriptions
Use agents proactively after creating components to ensure quality.
插件开发插件还提供3个Agent:
Agent名称用途
plugin-validator验证插件结构和清单文件
skill-reviewer审核技能质量和触发机制
agent-creator根据描述生成新的Agent
创建组件后主动使用这些Agent以确保质量。

Available Commands

可用命令

CommandPurpose
/plugin-dev:plugin-dev-guide
Overview and skill routing
/plugin-dev:start
Entry point - choose plugin or marketplace creation
/plugin-dev:create-plugin
8-phase guided plugin creation workflow
/plugin-dev:create-marketplace
8-phase guided marketplace creation workflow

命令名称用途
/plugin-dev:plugin-dev-guide
概览和技能指引
/plugin-dev:start
入口点 - 选择创建插件或市场
/plugin-dev:create-plugin
8阶段引导式插件创建工作流
/plugin-dev:create-marketplace
8阶段引导式市场创建工作流

User Request

用户请求

$ARGUMENTS
If the user provided a request above, analyze it and either:
  1. Route to a specific skill if the request clearly matches one domain
  2. Answer directly using this guide's overview information
  3. Ask for clarification if the request is ambiguous
If no request was provided, summarize the available plugin development capabilities and ask what the user wants to build or learn about.
$ARGUMENTS
如果用户在上方提供了请求,请进行分析并选择以下操作之一:
  1. 引导至特定技能:如果请求明确匹配某个领域
  2. 直接回答:使用本指南的概览信息
  3. 请求澄清:如果请求不明确
如果未提供请求,请总结可用的插件开发能力,并询问用户想要构建或了解什么。