Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Claude Code Plugins

Claude Code Plugins

A plugin (Plugin) is Claude Code'shighest-level extension mechanism,used to package, version, share, and distribute capabilities such ascommands, agents, Skills, hooks, MCP, LSP。

Plugin = a collection of reusable Claude Code extension capabilities

A plugin can contain:

The core goal of plugins is only one:

Let Claude Code's capabilities be reused like a toolbox, rather than repeatedly configuring every project


Plugins vs Standalone Configuration (How to choose)

Claude Code supports two extension approaches:

Method Command form Suitable scenarios
Standalone configuration(.claude/) /hello Personal use, single project, rapid experimentation
Plugin(.claude-plugin/) /plugin-name:hello Team sharing, cross-project, versioning

When to use standalone configuration?

When to use plugins?

Best practices:

First in .claude/ iterate → package as a plugin once stable


Minimal plugin structure (must remember)

my-plugin/

├── .claude-plugin/

│   └── plugin.json     # 插件清单(必需)

├── commands/           # 斜杠命令

├── agents/             # 子代理

├── skills/             # Skills

├── hooks/              # 钩子

├── .mcp.json           # MCP 配置

└── .lsp.json           # LSP 配置

Important rules


Plugin manifest (plugin.json)

The plugin's "ID card", determines:

Example:

{

  "name": "my-first-plugin",

  "description": "A greeting plugin to learn the basics",

  "version": "1.0.0",

  "author": { "name": "Your Name" }

}

Key field descriptions:

Field Purpose
name Unique identifier + command namespace
description Displayed in the plugin marketplace
version Semantic versioning
author Optional, attribution description

Slash commands (most commonly used plugin capability)

1. Command definition method

Example:

commands/hello.md

Corresponding command:

/my-first-plugin:hello

2. Command content example

---

description: Greet the user with a friendly message

---



Greet the user warmly and ask how you can help them today.

3. Command parameters

Use $ARGUMENTS Capture user input:

Greet the user named "$ARGUMENTS" warmly.

Call:

/my-first-plugin:hello Alex


Local plugin testing (essential for development)

Use --plugin-dir Directly load the plugin directory:

claude --plugin-dir ./my-plugin

Characteristics:

claude --plugin-dir ./plugin-a --plugin-dir ./plugin-b


What else can plugins do

Capability Purpose
Commands Custom slash commands
Agents Dedicated sub-agents
Skills Teach Claude when to use a certain capability
Hooks Automation (execute commands after writing files, etc.)
MCP Connect external services (GitHub, DB, API)
LSP Code intelligence (navigation, type checking)

Plugin Marketplace

Plugins are distributed throughMarket, essentially a repository of plugin directories.

Official marketplace

Install the plugin:

/plugin install plugin-name@claude-plugins-official


Plugin installation scope

Range Description
User scope Only yourself, all projects
Project scope Current repository, shared with team
Local scope Current repository, only you

Recommended:


Typical plugin categories

1. Code intelligence (LSP)

Requires local installation of the corresponding language server

2. External integration (MCP)

Essence:Plugin = MCP server + configuration

3. Development workflow


Common plugin management commands

/plugin                # 打开插件管理器

/plugin install         # 安装插件

/plugin uninstall       # 卸载

/plugin enable/disable  # 启用 / 禁用

/plugin marketplace add # 添加市场

/plugin marketplace rm  # 移除市场


From the .claude/ Migrating to plugins (core approach)

Before After migration
.claude/commands plugin/commands
.claude/agents plugin/agents
settings.json hooks plugin/hooks/hooks.json

After migration:


When must you use plugins?

Plugins are the watershed taking Claude Code from a "personal AI assistant" to an "engineering tool"