Claude Code: Plugin System
Last updated: 2026-08-31
Plugins make Claude Code's capabilities pluggable — install a plugin, gain a new ability, without modifying core code.
💡 Tip: Claude Code plugins and MCP are two different extension methods. Plugins modify Claude Code's own behavior; MCP extends its ability to connect to the outside world.
📋 Prerequisites: Chapter 13 - SubAgents
1. What You'll Learn
- Plugin system architecture
- Official and community plugins
- Plugin installation and management
- Plugin development basics
- Plugin vs MCP distinction
2. Plugin System Architecture
(1) Plugin Types
| Type | Purpose | Example |
|---|---|---|
| Tool plugins | Add new tools/commands | Code analysis tool |
| Hook plugins | Custom behavior on specific events | Auto-lint before commit |
| Theme plugins | Change output style | Colored diff display |
| Integration plugins | Connect third-party services | Jira integration |
(2) Plugin vs MCP Comparison
| Dimension | Plugin | MCP |
|---|---|---|
| Extension direction | Modify Claude Code behavior | Connect external services |
| Runtime location | Within Claude Code process | Independent process |
| Communication | Direct function calls | Protocol communication |
| Use case | Add commands, change output | Databases, APIs, browsers |
| Dev difficulty | Medium | Low |
3. Official and Community Plugins
(1) Official Plugins
| Plugin | Function | Install |
|---|---|---|
| claude-plugin-lint | Auto-lint modified files | claude plugin add lint |
| claude-plugin-test | Auto-run tests after modifications | claude plugin add test |
| claude-plugin-git | Enhanced git integration | claude plugin add git |
| claude-plugin-doc | Auto-generate documentation | claude plugin add doc |
(2) Plugin Management
BASH
# View installed plugins
claude plugin list
# Install official plugin
claude plugin add lint
# Install community plugin
claude plugin add @community/claude-plugin-jira
# Disable plugin
claude plugin disable lint
# Uninstall plugin
claude plugin remove lint
# Update plugins
claude plugin update
▶ Example 1: Lint Plugin Workflow
TEXT
📖 Display only
# After installing lint plugin
> Refactor slugify function in src/utils/string.ts
Claude Code:
→ Reading src/utils/string.ts
→ Modifying slugify function...
→ [lint plugin] Running: npm run lint -- --fix
→ [lint plugin] Found 1 issue: missing return type
→ Auto-fixing: adding string return type
→ [lint plugin] All clean ✓
→ Running: npm test -- string.test.ts
✅ All tests passed
4. Plugin Configuration
(1) Global Configuration
JSON
// ~/.claude/plugins.json
{
"plugins": [
{
"name": "lint",
"enabled": true,
"config": {
"runOnSave": true,
"fix": true
}
}
]
}
(2) Project-Level Configuration
JSON
// .claude/plugins.json
{
"plugins": [
{
"name": "lint",
"config": {
"command": "npm run lint:fix",
"files": ["src/**/*.ts"]
}
}
]
}
5. Plugin Development Basics
▶ Example 2: Simple Plugin
TYPESCRIPT
export default {
name: "my-custom-linter",
version: "1.0.0",
hooks: {
"after:file:write": async (context) => {
const { filePath } = context;
if (filePath.endsWith(".ts")) {
const { execSync } = require("child_process");
try {
execSync(`npx eslint --fix ${filePath}`, { stdio: "pipe" });
} catch (e) {
console.log(`[my-linter] Issues in ${filePath}`);
}
}
},
},
};
6. Plugin Best Practices
| Principle | Description |
|---|---|
| Minimalism | Only install necessary plugins |
| Verify source | Prefer official; audit community plugins |
| Test first | Validate new plugins on test projects |
| Regular cleanup | Remove unused plugins |
| Avoid duplicates | Same-type plugins may conflict |
❓ FAQ
Q Plugin or MCP?
A Use MCP for connecting external services (databases, GitHub); use plugins for modifying Claude Code behavior (auto-lint, custom commands). Both can coexist.
Q Too many plugins slow things down?
A Yes. Each plugin uses load time and memory. Install only what's needed.
Q Are community plugins safe?
A Not guaranteed. Check source code and author reputation before installing.
Q Can I install multiple same-type plugins?
A Possible but may conflict. Two lint plugins may enforce different rules. Keep one per type.
📖 Summary
- Plugins extend Claude Code's behavior; MCP extends connectivity
- Official plugins: lint, test, git, doc
- Manage via
claude plugin add/remove - Plugin dev: define tools and hooks following interface spec
- Minimalism principle: only install necessary plugins
📝 Exercises
- Basic (⭐): Install the official lint plugin, verify auto-lint on file modification.
- Intermediate (⭐⭐): Install and configure two plugins ensuring no conflicts.
- Advanced (⭐⭐⭐): Develop a custom plugin that auto-runs format and lint after each file modification.