Episode 9: Plugin Anatomy - What's Inside a Plugin
A Plugin is the final form of a Claude Code extension. It's not a single feature, but a "combo meal" that bundles multiple components together for distribution.
The Core Manifest: plugin.json
Every Plugin must have a plugin.json in its root (or in the .claude-plugin/ directory).
{
"name": "my-awesome-plugin",
"version": "1.0.0",
"description": "This is my first plugin",
"hooks": { ... }, // Define Hooks
"commands": [ ... ], // Define Commands
"keywords": [ ... ] // Keywords
}
Component Matrix
Different plugins have different focuses. The table below shows the composition of several typical plugins:
| Plugin | Skills | Hooks | MCP | Commands | Key Feature |
|---|---|---|---|---|---|
| GSD | 137 | 9 | 0 | 0 | Pure instruction-driven, extreme engineering |
| caveman | 5 | 2 | 0 | 3 | Ultra-compressed mode, extreme token saving |
| claude-mem | 7 | 9 | 1 | 0 | Background Worker service, long-term memory |
| claude-hud | 0 | 0 | 0 | 2 | UI status bar enhancement, compiled project |
Typical File Structure
Taking caveman as an example, a typical plugin directory looks like this:
caveman/
├── .claude-plugin/
│ └── plugin.json # Manifest (defines entry points and Hooks)
├── hooks/
│ ├── activate.js # SessionStart Hook
│ └── tracker.js # Message tracking Hook
├── skills/
│ └── caveman/
│ └── SKILL.md # /caveman slash command
├── commands/
│ └── caveman.toml # Structured command definition
└── CLAUDE.md # Plugin-level project rules
Workflow Overview
graph LR
P[plugin.json] --> S[Skills]
P --> H[Hooks]
P --> M[MCP]
P --> C[Commands]
S -->|Defines| SC[Slash Commands]
H -->|Responds to| LE[Lifecycle Events]
M -->|Provides| ET[Extra Tool Capabilities]