AgentSkillsCN

plugin-creator

为创建 Claude Code 插件提供指南,包括目录结构、清单配置、组件类型与初始化脚本。当用户希望创建、构建或理解 Claude Code 插件时,可使用此指南。

SKILL.md
--- frontmatter
name: plugin-creator
description: Guide for creating Claude Code plugins, including directory structure, manifest configuration, component types, and initialization scripts. Use when users want to create, build, or understand Claude Code plugins.

Plugin Creator

What is a Plugin?

A plugin is a distributable package format that bundles skills, hooks, MCP servers, and other components into an installable unit for sharing across projects or teams.

When to Use Plugin vs Standalone?

Use CaseRecommended Approach
Single project onlyPlace directly in .claude/ directory
Share across multiple projectsCreate a Plugin
Distribute to other usersCreate a Plugin
Internal project automationPlace directly in .claude/ directory

Quick Start

Using the Initialization Script

bash
# Create new plugin in current directory
python skills/plugin-creator/scripts/init_plugin.py my-awesome-plugin

# Specify output path
python skills/plugin-creator/scripts/init_plugin.py my-plugin --output ~/plugins

Manual Creation

  1. Create plugin directory structure:

    code
    my-plugin/
    ├── .claude-plugin/
    │   └── plugin.json      # Plugin manifest (required)
    ├── commands/            # User-invocable skills
    ├── skills/              # Agent skills
    ├── hooks/               # Hook configurations
    └── README.md
    
  2. Create plugin.json manifest:

    json
    {
      "name": "my-plugin",
      "description": "Plugin description",
      "version": "1.0.0",
      "author": "Your Name"
    }
    

Testing Plugins

Use the --plugin-dir flag to load and test your plugin:

bash
# Test local plugin
claude --plugin-dir ./my-plugin

# Test multiple plugins
claude --plugin-dir ./plugin-a --plugin-dir ./plugin-b

Component Types Overview

Plugins can contain the following components:

Component TypeDirectoryPurpose
Commandscommands/User-invocable slash commands
Skillsskills/Agent auto-used skills
Hookshooks/Event-triggered automation scripts
MCP ServersIn manifestExtend Claude's tool capabilities
LSP ServersIn manifestCode intelligence features

Reference Documentation

For detailed information:

FAQ

Q: Why isn't my skill being loaded?

Check the following:

  1. plugin.json is inside .claude-plugin/ directory
  2. Skills are in plugin root's skills/ or commands/, not inside .claude-plugin/
  3. Manifest JSON format is valid

Q: How to debug plugin loading issues?

bash
# Use verbose mode to see loading process
claude --plugin-dir ./my-plugin -v