Claude Code Plugins
Plugins are the **highest-level extension mechanism** in Claude Code, used to package, version, share, and distribute capabilities such as commands, agents, Skills, hooks, MCP, and LSP.
**Plugin = A set of reusable Claude Code extension capabilities**
A plugin can contain:
* Slash Commands
* Sub-agents
* Skills (capability descriptions)
* Hooks (event hooks)
* MCP servers (external tools/services)
* LSP servers (code intelligence)
> The core goal of plugins is simple:
>
>
> **To make Claude Code's capabilities reusable like a toolbox, rather than reconfiguring each project individually**
* * *
## Plugins vs Independent Configuration (How to Choose)
Claude Code supports two extension methods:
| Method | Command Format | Suitable Scenarios |
| --- | --- | --- |
| **Independent Configuration** (`.claude/`) | `/hello` | Personal use, single project, quick experiments |
| **Plugin** (`.claude-plugin/`) | `/plugin-name:hello` | Team sharing, cross-project, versioned |
### When to Use Independent Configuration?
* Used only in the current project
* Personal workflow
* Experimental configurations that are not yet stable
* Wanting short command names (e.g., `/review`)
### When to Use Plugins?
* To reuse across **multiple projects**
* To **share with teams or community**
* Need **version control, upgrades, rollbacks**
* Planning to distribute via marketplace
* Can accept namespace commands (to avoid conflicts)
> **Best Practice:**
>
>
> Iterate in `.claude/` first β Package into plugin once stable
* * *
## Minimum Plugin Structure (Must Remember)
my-plugin/βββ .claude-plugin/β βββ plugin.json # Plugin manifest (required)βββ commands/ # Slash commandsβββ agents/ # Sub-agentsβββ skills/ # Skillsβββ hooks/ # Hooksβββ .mcp.json # MCP configurationβββ .lsp.json # LSP configuration
**Important Rules**
* Only `plugin.json` is allowed in the `.claude-plugin/` directory
* Other directories must be at the plugin root
* * *
## Plugin Manifest (plugin.json)
The plugin's "ID card", determines:
* Plugin name
* Command namespace
* Version
* Author information
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 plugin marketplace |
| version | Semantic versioning |
| author | Optional, for attribution |
* * *
## Slash Commands (Most Common Plugin Capability)
### 1. Command Definition Method
* Located in the `commands/` directory
* Each command = one Markdown file
* File name = command name
Example:
commands/hello.md
Corresponding command:
/my-first-plugin:hello
### 2. Sample Command Content
--- description: Greet the user with a friendly message ---Greet the user warmly and ask how you can help them today.
### 3. Command Arguments
Use `$ARGUMENTS` to capture user input:
Greet the user named "$ARGUMENTS" warmly.
Invocation:
/my-first-plugin:hello Alex
* * *
## Local Plugin Testing (Essential for Development)
Load plugin directory directly using `--plugin-dir`:
claude --plugin-dir ./my-plugin
Features:
* No installation required
* Requires restarting Claude Code after changes
* Supports loading multiple plugins simultaneously
claude --plugin-dir ./plugin-a --plugin-dir ./plugin-b
* * *
## What Else Can Plugins Do
| Capability | Usage |
| --- | --- |
| Commands | Custom slash commands |
| Agents | Dedicated sub-agents |
| Skills | Teach Claude when to use certain capabilities |
| Hooks | Automation (run command after saving file, etc.) |
| MCP | Connect external services (GitHub, DB, API) |
| LSP | Code intelligence (navigation, type checking) |
* * *
## Plugin Marketplace
Plugins are distributed through the **marketplace**, essentially a repository of plugin directories.
### Official Marketplace
* Added by default
* Run `/plugin` β **Discover**
!(#)
Install plugin:
/plugin install plugin-name@claude-plugins-official
* * *
## Plugin Installation Scope
| Scope | Description |
| --- | --- |
| User scope | Only for yourself, all projects |
| Project scope | Current repository, team shared |
| Local scope | Current repository, only for you |
Recommendations:
* Team tools β **Project scope**
* Personal productivity tools β **User scope**
* * *
## Typical Plugin Categories
### 1. Code Intelligence (LSP)
* TypeScript, Python, Go, Rust, etc.
* Provides definition navigation, references, type errors
Requires local installation of corresponding language servers
### 2. External Integration (MCP)
* GitHub / GitLab
* Jira / Notion
* Slack / Figma
* Vercel / Supabase
> Essence: **Plugin = MCP server + configuration**
### 3. Development Workflow
* Git commits, PRs
* Code review agent
* Plugin development tools
* * *
## Common Plugin Management Commands
/plugin # Open plugin manager/plugin install # Install plugin/plugin uninstall # Uninstall/plugin enable/disable # Enable / Disable/plugin marketplace add # Add marketplace/plugin marketplace rm # Remove marketplace
* * *
## Migrating from `.claude/` to Plugins (Core Idea)
| Original | After Migration |
| --- | --- |
| `.claude/commands` | `plugin/commands` |
| `.claude/agents` | `plugin/agents` |
| `settings.json hooks` | `plugin/hooks/hooks.json` |
After migration:
* Plugin versions take precedence
* Old `.claude/` configs can be removed to prevent duplication
* * *
## When You Must Use Plugins?
* You already have a **stable Claude workflow**
* You're **repeatedly copying `.claude/`**
* Team members start asking: "How do I configure this?"
* You want Claude to behave like an IDE plugin
> **Plugins mark the watershed between Claude Code as a "personal AI assistant" and an "engineering tool"**
YouTip