AgentSkillsCN

claude-plugin-dev

当用户询问“创建插件”、“构建插件”、“插件结构”、“插件如何工作”、“插件文档”,或需要关于 Claude Code 插件开发的一般指导时,应使用此技能。

SKILL.md
--- frontmatter
name: claude-plugin-dev
description: This skill should be used when the user asks to "create a plugin",
  "build a plugin", "plugin structure", "how do plugins work", "plugin documentation",
  or needs general guidance on Claude Code plugin development.
version: 0.3.1

Claude Code Plugin Development

Guide for building Claude Code plugins with proper structure, conventions, and best practices.

Quick Start

Use the /create-plugin command for a guided 8-phase workflow:

code
/create-plugin my-plugin

This interactive workflow guides you through discovery, planning, implementation, validation, and documentation.

Plugin Structure

code
my-plugin/
├── .claude-plugin/
│   └── plugin.json        # Required: name, version, description
├── skills/                # SKILL.md in subdirectories
├── agents/                # AGENT.md files
├── commands/              # Slash command files
├── hooks/hooks.json       # Event handlers
├── .mcp.json              # MCP server configs
├── .local.example.md      # Configuration template
└── README.md

Manifest (plugin.json)

json
{
  "name": "my-plugin",
  "version": "1.0.0",
  "description": "What this plugin does"
}

Testing

bash
claude --plugin-dir ./my-plugin

Components

ComponentLocationPurpose
Skillsskills/name/SKILL.mdExtend Claude's knowledge
Agentsagents/name/AGENT.mdSpecialized subagents
Commandscommands/name.mdUser-triggered actions
Hookshooks/hooks.jsonEvent automation
MCP.mcp.jsonExternal tool integration
Settings.local.mdUser configuration

Focused Skills

TopicSkillPurpose
Directory layout/claude-plugin-dev:plugin-structurePlugin directories
Creating skills/claude-plugin-dev:skill-developmentSKILL.md files
Creating agents/claude-plugin-dev:agent-developmentAGENT.md files
Creating commands/claude-plugin-dev:command-developmentSlash commands
Event hooks/claude-plugin-dev:hook-developmentAutomation
MCP servers/claude-plugin-dev:mcp-integrationExternal tools
User config/claude-plugin-dev:plugin-settings.local.md patterns

Agents

AgentPurpose
plugin-validatorValidate plugin structure and conventions
agent-creatorInteractive agent generation
skill-reviewerSkill quality review

Key Conventions

Naming

  • Plugin names: kebab-case (my-plugin)
  • Skill names: match directory name
  • Use descriptive names

Skill Descriptions (Critical)

Always use third-person with trigger phrases:

yaml
description: This skill should be used when the user asks to "create X",
  "configure Y", "add Z", or needs guidance on [topic].

Progressive Disclosure

  • SKILL.md: Core concepts (~1,000-1,500 words)
  • references/: Detailed documentation
  • examples/: Working code samples

Development Workflow

  1. Plan: Use /create-plugin for guided setup
  2. Implement: Use focused skills for each component
  3. Validate: Run plugin-validator agent
  4. Test: Use claude --plugin-dir ./my-plugin
  5. Review: Use skill-reviewer for quality check

Reference Files

  • references/docs-cache.md - Official documentation
  • references/conventions.md - Patterns from official plugins
  • references/examples.md - Complete plugin examples

Common Mistakes

  1. Components in .claude-plugin/: Only plugin.json goes there
  2. Vague descriptions: Include specific trigger phrases
  3. Too much in SKILL.md: Move details to references/
  4. Missing example blocks: Agents need <example> for triggers
  5. Wrong hook paths: Use ${CLAUDE_PLUGIN_ROOT}