caruso 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -0
- data/impl.md +111 -0
- data/lib/caruso/adapter.rb +16 -96
- data/lib/caruso/adapters/base.rb +102 -0
- data/lib/caruso/adapters/command_adapter.rb +88 -0
- data/lib/caruso/adapters/dispatcher.rb +83 -0
- data/lib/caruso/adapters/hook_adapter.rb +222 -0
- data/lib/caruso/adapters/markdown_adapter.rb +23 -0
- data/lib/caruso/adapters/skill_adapter.rb +87 -0
- data/lib/caruso/cli.rb +22 -6
- data/lib/caruso/config_manager.rb +30 -28
- data/lib/caruso/fetcher.rb +137 -29
- data/lib/caruso/remover.rb +73 -13
- data/lib/caruso/version.rb +1 -1
- data/package-lock.json +6 -0
- data/reference/claude_code_create_marketplaces.md +511 -0
- data/reference/claude_code_hooks.md +1137 -0
- data/reference/claude_code_plugins.md +769 -0
- data/reference/claude_code_slash_commands.md +515 -0
- data/reference/cursor_commands.md +90 -0
- data/reference/cursor_hooks.md +467 -0
- data/reference/cursor_modes.md +105 -0
- data/reference/cursor_rules.md +246 -0
- data/reference/steering_docs.md +57 -0
- data/tasks.md +22 -0
- metadata +20 -3
- data/reference/plugins_reference.md +0 -376
- /data/reference/{marketplace.md → claude_code_marketplaces.md} +0 -0
|
@@ -0,0 +1,769 @@
|
|
|
1
|
+
# Plugins reference
|
|
2
|
+
|
|
3
|
+
> Complete technical reference for Claude Code plugin system, including schemas, CLI commands, and component specifications.
|
|
4
|
+
|
|
5
|
+
<Tip>
|
|
6
|
+
Looking to install plugins? See [Discover and install plugins](/en/discover-plugins). For creating plugins, see [Plugins](/en/plugins). For distributing plugins, see [Plugin marketplaces](/en/plugin-marketplaces).
|
|
7
|
+
</Tip>
|
|
8
|
+
|
|
9
|
+
This reference provides complete technical specifications for the Claude Code plugin system, including component schemas, CLI commands, and development tools.
|
|
10
|
+
|
|
11
|
+
## Plugin components reference
|
|
12
|
+
|
|
13
|
+
This section documents the five types of components that plugins can provide.
|
|
14
|
+
|
|
15
|
+
### Commands
|
|
16
|
+
|
|
17
|
+
Plugins add custom slash commands that integrate seamlessly with Claude Code's command system.
|
|
18
|
+
|
|
19
|
+
**Location**: `commands/` directory in plugin root
|
|
20
|
+
|
|
21
|
+
**File format**: Markdown files with frontmatter
|
|
22
|
+
|
|
23
|
+
For complete details on plugin command structure, invocation patterns, and features, see [Plugin commands](/en/slash-commands#plugin-commands).
|
|
24
|
+
|
|
25
|
+
### Agents
|
|
26
|
+
|
|
27
|
+
Plugins can provide specialized subagents for specific tasks that Claude can invoke automatically when appropriate.
|
|
28
|
+
|
|
29
|
+
**Location**: `agents/` directory in plugin root
|
|
30
|
+
|
|
31
|
+
**File format**: Markdown files describing agent capabilities
|
|
32
|
+
|
|
33
|
+
**Agent structure**:
|
|
34
|
+
|
|
35
|
+
```markdown theme={null}
|
|
36
|
+
---
|
|
37
|
+
description: What this agent specializes in
|
|
38
|
+
capabilities: ["task1", "task2", "task3"]
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
# Agent Name
|
|
42
|
+
|
|
43
|
+
Detailed description of the agent's role, expertise, and when Claude should invoke it.
|
|
44
|
+
|
|
45
|
+
## Capabilities
|
|
46
|
+
- Specific task the agent excels at
|
|
47
|
+
- Another specialized capability
|
|
48
|
+
- When to use this agent vs others
|
|
49
|
+
|
|
50
|
+
## Context and examples
|
|
51
|
+
Provide examples of when this agent should be used and what kinds of problems it solves.
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Integration points**:
|
|
55
|
+
|
|
56
|
+
* Agents appear in the `/agents` interface
|
|
57
|
+
* Claude can invoke agents automatically based on task context
|
|
58
|
+
* Agents can be invoked manually by users
|
|
59
|
+
* Plugin agents work alongside built-in Claude agents
|
|
60
|
+
|
|
61
|
+
### Skills
|
|
62
|
+
|
|
63
|
+
Plugins can provide Agent Skills that extend Claude's capabilities. Skills are model-invoked—Claude autonomously decides when to use them based on the task context.
|
|
64
|
+
|
|
65
|
+
**Location**: `skills/` directory in plugin root
|
|
66
|
+
|
|
67
|
+
**File format**: Directories containing `SKILL.md` files with frontmatter
|
|
68
|
+
|
|
69
|
+
**Skill structure**:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
skills/
|
|
73
|
+
├── pdf-processor/
|
|
74
|
+
│ ├── SKILL.md
|
|
75
|
+
│ ├── reference.md (optional)
|
|
76
|
+
│ └── scripts/ (optional)
|
|
77
|
+
└── code-reviewer/
|
|
78
|
+
└── SKILL.md
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Integration behavior**:
|
|
82
|
+
|
|
83
|
+
* Plugin Skills are automatically discovered when the plugin is installed
|
|
84
|
+
* Claude autonomously invokes Skills based on matching task context
|
|
85
|
+
* Skills can include supporting files alongside SKILL.md
|
|
86
|
+
|
|
87
|
+
For SKILL.md format and complete Skill authoring guidance, see:
|
|
88
|
+
|
|
89
|
+
* [Use Skills in Claude Code](/en/skills)
|
|
90
|
+
* [Agent Skills overview](https://docs.claude.com/en/docs/agents-and-tools/agent-skills/overview#skill-structure)
|
|
91
|
+
|
|
92
|
+
### Hooks
|
|
93
|
+
|
|
94
|
+
Plugins can provide event handlers that respond to Claude Code events automatically.
|
|
95
|
+
|
|
96
|
+
**Location**: `hooks/hooks.json` in plugin root, or inline in plugin.json
|
|
97
|
+
|
|
98
|
+
**Format**: JSON configuration with event matchers and actions
|
|
99
|
+
|
|
100
|
+
**Hook configuration**:
|
|
101
|
+
|
|
102
|
+
```json theme={null}
|
|
103
|
+
{
|
|
104
|
+
"hooks": {
|
|
105
|
+
"PostToolUse": [
|
|
106
|
+
{
|
|
107
|
+
"matcher": "Write|Edit",
|
|
108
|
+
"hooks": [
|
|
109
|
+
{
|
|
110
|
+
"type": "command",
|
|
111
|
+
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/format-code.sh"
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Available events**:
|
|
121
|
+
|
|
122
|
+
* `PreToolUse`: Before Claude uses any tool
|
|
123
|
+
* `PostToolUse`: After Claude successfully uses any tool
|
|
124
|
+
* `PostToolUseFailure`: After Claude tool execution fails
|
|
125
|
+
* `PermissionRequest`: When a permission dialog is shown
|
|
126
|
+
* `UserPromptSubmit`: When user submits a prompt
|
|
127
|
+
* `Notification`: When Claude Code sends notifications
|
|
128
|
+
* `Stop`: When Claude attempts to stop
|
|
129
|
+
* `SubagentStart`: When a subagent is started
|
|
130
|
+
* `SubagentStop`: When a subagent attempts to stop
|
|
131
|
+
* `SessionStart`: At the beginning of sessions
|
|
132
|
+
* `SessionEnd`: At the end of sessions
|
|
133
|
+
* `PreCompact`: Before conversation history is compacted
|
|
134
|
+
|
|
135
|
+
**Hook types**:
|
|
136
|
+
|
|
137
|
+
* `command`: Execute shell commands or scripts
|
|
138
|
+
* `prompt`: Evaluate a prompt with an LLM (uses `$ARGUMENTS` placeholder for context)
|
|
139
|
+
* `agent`: Run an agentic verifier with tools for complex verification tasks
|
|
140
|
+
|
|
141
|
+
### MCP servers
|
|
142
|
+
|
|
143
|
+
Plugins can bundle Model Context Protocol (MCP) servers to connect Claude Code with external tools and services.
|
|
144
|
+
|
|
145
|
+
**Location**: `.mcp.json` in plugin root, or inline in plugin.json
|
|
146
|
+
|
|
147
|
+
**Format**: Standard MCP server configuration
|
|
148
|
+
|
|
149
|
+
**MCP server configuration**:
|
|
150
|
+
|
|
151
|
+
```json theme={null}
|
|
152
|
+
{
|
|
153
|
+
"mcpServers": {
|
|
154
|
+
"plugin-database": {
|
|
155
|
+
"command": "${CLAUDE_PLUGIN_ROOT}/servers/db-server",
|
|
156
|
+
"args": ["--config", "${CLAUDE_PLUGIN_ROOT}/config.json"],
|
|
157
|
+
"env": {
|
|
158
|
+
"DB_PATH": "${CLAUDE_PLUGIN_ROOT}/data"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"plugin-api-client": {
|
|
162
|
+
"command": "npx",
|
|
163
|
+
"args": ["@company/mcp-server", "--plugin-mode"],
|
|
164
|
+
"cwd": "${CLAUDE_PLUGIN_ROOT}"
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Integration behavior**:
|
|
171
|
+
|
|
172
|
+
* Plugin MCP servers start automatically when the plugin is enabled
|
|
173
|
+
* Servers appear as standard MCP tools in Claude's toolkit
|
|
174
|
+
* Server capabilities integrate seamlessly with Claude's existing tools
|
|
175
|
+
* Plugin servers can be configured independently of user MCP servers
|
|
176
|
+
|
|
177
|
+
### LSP servers
|
|
178
|
+
|
|
179
|
+
<Tip>
|
|
180
|
+
Looking to use LSP plugins? Install them from the official marketplace—search for "lsp" in the `/plugin` Discover tab. This section documents how to create LSP plugins for languages not covered by the official marketplace.
|
|
181
|
+
</Tip>
|
|
182
|
+
|
|
183
|
+
Plugins can provide [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) (LSP) servers to give Claude real-time code intelligence while working on your codebase.
|
|
184
|
+
|
|
185
|
+
LSP integration provides:
|
|
186
|
+
|
|
187
|
+
* **Instant diagnostics**: Claude sees errors and warnings immediately after each edit
|
|
188
|
+
* **Code navigation**: go to definition, find references, and hover information
|
|
189
|
+
* **Language awareness**: type information and documentation for code symbols
|
|
190
|
+
|
|
191
|
+
**Location**: `.lsp.json` in plugin root, or inline in `plugin.json`
|
|
192
|
+
|
|
193
|
+
**Format**: JSON configuration mapping language server names to their configurations
|
|
194
|
+
|
|
195
|
+
**`.lsp.json` file format**:
|
|
196
|
+
|
|
197
|
+
```json theme={null}
|
|
198
|
+
{
|
|
199
|
+
"go": {
|
|
200
|
+
"command": "gopls",
|
|
201
|
+
"args": ["serve"],
|
|
202
|
+
"extensionToLanguage": {
|
|
203
|
+
".go": "go"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**Inline in `plugin.json`**:
|
|
210
|
+
|
|
211
|
+
```json theme={null}
|
|
212
|
+
{
|
|
213
|
+
"name": "my-plugin",
|
|
214
|
+
"lspServers": {
|
|
215
|
+
"go": {
|
|
216
|
+
"command": "gopls",
|
|
217
|
+
"args": ["serve"],
|
|
218
|
+
"extensionToLanguage": {
|
|
219
|
+
".go": "go"
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Required fields:**
|
|
227
|
+
|
|
228
|
+
| Field | Description |
|
|
229
|
+
| :-------------------- | :------------------------------------------- |
|
|
230
|
+
| `command` | The LSP binary to execute (must be in PATH) |
|
|
231
|
+
| `extensionToLanguage` | Maps file extensions to language identifiers |
|
|
232
|
+
|
|
233
|
+
**Optional fields:**
|
|
234
|
+
|
|
235
|
+
| Field | Description |
|
|
236
|
+
| :---------------------- | :-------------------------------------------------------- |
|
|
237
|
+
| `args` | Command-line arguments for the LSP server |
|
|
238
|
+
| `transport` | Communication transport: `stdio` (default) or `socket` |
|
|
239
|
+
| `env` | Environment variables to set when starting the server |
|
|
240
|
+
| `initializationOptions` | Options passed to the server during initialization |
|
|
241
|
+
| `settings` | Settings passed via `workspace/didChangeConfiguration` |
|
|
242
|
+
| `workspaceFolder` | Workspace folder path for the server |
|
|
243
|
+
| `startupTimeout` | Max time to wait for server startup (milliseconds) |
|
|
244
|
+
| `shutdownTimeout` | Max time to wait for graceful shutdown (milliseconds) |
|
|
245
|
+
| `restartOnCrash` | Whether to automatically restart the server if it crashes |
|
|
246
|
+
| `maxRestarts` | Maximum number of restart attempts before giving up |
|
|
247
|
+
| `loggingConfig` | Debug logging configuration (see below) |
|
|
248
|
+
|
|
249
|
+
**Debug logging configuration:**
|
|
250
|
+
|
|
251
|
+
The `loggingConfig` field enables verbose LSP logging when users pass `--enable-lsp-logging`. This helps debug language server issues without impacting normal operation.
|
|
252
|
+
|
|
253
|
+
```json theme={null}
|
|
254
|
+
"loggingConfig": {
|
|
255
|
+
"args": ["--log-level", "4"],
|
|
256
|
+
"env": {
|
|
257
|
+
"TSS_LOG": "-level verbose -file ${CLAUDE_PLUGIN_LSP_LOG_FILE}"
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
| Field | Description |
|
|
263
|
+
| :----- | :----------------------------------------------------------------- |
|
|
264
|
+
| `args` | Additional command-line arguments appended when logging is enabled |
|
|
265
|
+
| `env` | Additional environment variables merged when logging is enabled |
|
|
266
|
+
|
|
267
|
+
The `${CLAUDE_PLUGIN_LSP_LOG_FILE}` variable expands to the log file path. Logs are written to `~/.claude/debug/`.
|
|
268
|
+
|
|
269
|
+
<Warning>
|
|
270
|
+
**You must install the language server binary separately.** LSP plugins configure how Claude Code connects to a language server, but they don't include the server itself. If you see `Executable not found in $PATH` in the `/plugin` Errors tab, install the required binary for your language.
|
|
271
|
+
</Warning>
|
|
272
|
+
|
|
273
|
+
**Available LSP plugins:**
|
|
274
|
+
|
|
275
|
+
| Plugin | Language server | Install command |
|
|
276
|
+
| :--------------- | :------------------------- | :----------------------------------------------------------------------------------------- |
|
|
277
|
+
| `pyright-lsp` | Pyright (Python) | `pip install pyright` or `npm install -g pyright` |
|
|
278
|
+
| `typescript-lsp` | TypeScript Language Server | `npm install -g typescript-language-server typescript` |
|
|
279
|
+
| `rust-lsp` | rust-analyzer | [See rust-analyzer installation](https://rust-analyzer.github.io/manual.html#installation) |
|
|
280
|
+
|
|
281
|
+
Install the language server first, then install the plugin from the marketplace.
|
|
282
|
+
|
|
283
|
+
***
|
|
284
|
+
|
|
285
|
+
## Plugin installation scopes
|
|
286
|
+
|
|
287
|
+
When you install a plugin, you choose a **scope** that determines where the plugin is available and who else can use it:
|
|
288
|
+
|
|
289
|
+
| Scope | Settings file | Use case |
|
|
290
|
+
| :-------- | :---------------------------- | :------------------------------------------------------- |
|
|
291
|
+
| `user` | `~/.claude/settings.json` | Personal plugins available across all projects (default) |
|
|
292
|
+
| `project` | `.claude/settings.json` | Team plugins shared via version control |
|
|
293
|
+
| `local` | `.claude/settings.local.json` | Project-specific plugins, gitignored |
|
|
294
|
+
| `managed` | `managed-settings.json` | Enterprise-managed plugins (read-only, update only) |
|
|
295
|
+
|
|
296
|
+
Plugins use the same scope system as other Claude Code configurations. For installation instructions and scope flags, see [Install plugins](/en/discover-plugins#install-plugins). For a complete explanation of scopes, see [Configuration scopes](/en/settings#configuration-scopes).
|
|
297
|
+
|
|
298
|
+
***
|
|
299
|
+
|
|
300
|
+
## Plugin manifest schema
|
|
301
|
+
|
|
302
|
+
The `plugin.json` file defines your plugin's metadata and configuration. This section documents all supported fields and options.
|
|
303
|
+
|
|
304
|
+
### Complete schema
|
|
305
|
+
|
|
306
|
+
```json theme={null}
|
|
307
|
+
{
|
|
308
|
+
"name": "plugin-name",
|
|
309
|
+
"version": "1.2.0",
|
|
310
|
+
"description": "Brief plugin description",
|
|
311
|
+
"author": {
|
|
312
|
+
"name": "Author Name",
|
|
313
|
+
"email": "author@example.com",
|
|
314
|
+
"url": "https://github.com/author"
|
|
315
|
+
},
|
|
316
|
+
"homepage": "https://docs.example.com/plugin",
|
|
317
|
+
"repository": "https://github.com/author/plugin",
|
|
318
|
+
"license": "MIT",
|
|
319
|
+
"keywords": ["keyword1", "keyword2"],
|
|
320
|
+
"commands": ["./custom/commands/special.md"],
|
|
321
|
+
"agents": "./custom/agents/",
|
|
322
|
+
"skills": "./custom/skills/",
|
|
323
|
+
"hooks": "./config/hooks.json",
|
|
324
|
+
"mcpServers": "./mcp-config.json",
|
|
325
|
+
"outputStyles": "./styles/",
|
|
326
|
+
"lspServers": "./.lsp.json"
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Required fields
|
|
331
|
+
|
|
332
|
+
| Field | Type | Description | Example |
|
|
333
|
+
| :----- | :----- | :---------------------------------------- | :------------------- |
|
|
334
|
+
| `name` | string | Unique identifier (kebab-case, no spaces) | `"deployment-tools"` |
|
|
335
|
+
|
|
336
|
+
### Metadata fields
|
|
337
|
+
|
|
338
|
+
| Field | Type | Description | Example |
|
|
339
|
+
| :------------ | :----- | :---------------------------------- | :------------------------------------------------- |
|
|
340
|
+
| `version` | string | Semantic version | `"2.1.0"` |
|
|
341
|
+
| `description` | string | Brief explanation of plugin purpose | `"Deployment automation tools"` |
|
|
342
|
+
| `author` | object | Author information | `{"name": "Dev Team", "email": "dev@company.com"}` |
|
|
343
|
+
| `homepage` | string | Documentation URL | `"https://docs.example.com"` |
|
|
344
|
+
| `repository` | string | Source code URL | `"https://github.com/user/plugin"` |
|
|
345
|
+
| `license` | string | License identifier | `"MIT"`, `"Apache-2.0"` |
|
|
346
|
+
| `keywords` | array | Discovery tags | `["deployment", "ci-cd"]` |
|
|
347
|
+
|
|
348
|
+
### Component path fields
|
|
349
|
+
|
|
350
|
+
| Field | Type | Description | Example |
|
|
351
|
+
| :------------- | :------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------- |
|
|
352
|
+
| `commands` | string\|array | Additional command files/directories | `"./custom/cmd.md"` or `["./cmd1.md"]` |
|
|
353
|
+
| `agents` | string\|array | Additional agent files | `"./custom/agents/"` |
|
|
354
|
+
| `skills` | string\|array | Additional skill directories | `"./custom/skills/"` |
|
|
355
|
+
| `hooks` | string\|object | Hook config path or inline config | `"./hooks.json"` |
|
|
356
|
+
| `mcpServers` | string\|object | MCP config path or inline config | `"./mcp-config.json"` |
|
|
357
|
+
| `outputStyles` | string\|array | Additional output style files/directories | `"./styles/"` |
|
|
358
|
+
| `lspServers` | string\|object | [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) config for code intelligence (go to definition, find references, etc.) | `"./.lsp.json"` |
|
|
359
|
+
|
|
360
|
+
### Path behavior rules
|
|
361
|
+
|
|
362
|
+
**Important**: Custom paths supplement default directories - they don't replace them.
|
|
363
|
+
|
|
364
|
+
* If `commands/` exists, it's loaded in addition to custom command paths
|
|
365
|
+
* All paths must be relative to plugin root and start with `./`
|
|
366
|
+
* Commands from custom paths use the same naming and namespacing rules
|
|
367
|
+
* Multiple paths can be specified as arrays for flexibility
|
|
368
|
+
|
|
369
|
+
**Path examples**:
|
|
370
|
+
|
|
371
|
+
```json theme={null}
|
|
372
|
+
{
|
|
373
|
+
"commands": [
|
|
374
|
+
"./specialized/deploy.md",
|
|
375
|
+
"./utilities/batch-process.md"
|
|
376
|
+
],
|
|
377
|
+
"agents": [
|
|
378
|
+
"./custom-agents/reviewer.md",
|
|
379
|
+
"./custom-agents/tester.md"
|
|
380
|
+
]
|
|
381
|
+
}
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Environment variables
|
|
385
|
+
|
|
386
|
+
**`${CLAUDE_PLUGIN_ROOT}`**: Contains the absolute path to your plugin directory. Use this in hooks, MCP servers, and scripts to ensure correct paths regardless of installation location.
|
|
387
|
+
|
|
388
|
+
```json theme={null}
|
|
389
|
+
{
|
|
390
|
+
"hooks": {
|
|
391
|
+
"PostToolUse": [
|
|
392
|
+
{
|
|
393
|
+
"hooks": [
|
|
394
|
+
{
|
|
395
|
+
"type": "command",
|
|
396
|
+
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/process.sh"
|
|
397
|
+
}
|
|
398
|
+
]
|
|
399
|
+
}
|
|
400
|
+
]
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
***
|
|
406
|
+
|
|
407
|
+
## Plugin caching and file resolution
|
|
408
|
+
|
|
409
|
+
For security and verification purposes, Claude Code copies plugins to a cache directory rather than using them in-place. Understanding this behavior is important when developing plugins that reference external files.
|
|
410
|
+
|
|
411
|
+
### How plugin caching works
|
|
412
|
+
|
|
413
|
+
When you install a plugin, Claude Code copies the plugin files to a cache directory:
|
|
414
|
+
|
|
415
|
+
* **For marketplace plugins with relative paths**: The path specified in the `source` field is copied recursively. For example, if your marketplace entry specifies `"source": "./plugins/my-plugin"`, the entire `./plugins` directory is copied.
|
|
416
|
+
* **For plugins with `.claude-plugin/plugin.json`**: The implicit root directory (the directory containing `.claude-plugin/plugin.json`) is copied recursively.
|
|
417
|
+
|
|
418
|
+
### Path traversal limitations
|
|
419
|
+
|
|
420
|
+
Plugins cannot reference files outside their copied directory structure. Paths that traverse outside the plugin root (such as `../shared-utils`) will not work after installation because those external files are not copied to the cache.
|
|
421
|
+
|
|
422
|
+
### Working with external dependencies
|
|
423
|
+
|
|
424
|
+
If your plugin needs to access files outside its directory, you have two options:
|
|
425
|
+
|
|
426
|
+
**Option 1: Use symlinks**
|
|
427
|
+
|
|
428
|
+
Create symbolic links to external files within your plugin directory. Symlinks are honored during the copy process:
|
|
429
|
+
|
|
430
|
+
```bash theme={null}
|
|
431
|
+
# Inside your plugin directory
|
|
432
|
+
ln -s /path/to/shared-utils ./shared-utils
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
The symlinked content will be copied into the plugin cache.
|
|
436
|
+
|
|
437
|
+
**Option 2: Restructure your marketplace**
|
|
438
|
+
|
|
439
|
+
Set the plugin path to a parent directory that contains all required files, then provide the rest of the plugin manifest directly in the marketplace entry:
|
|
440
|
+
|
|
441
|
+
```json theme={null}
|
|
442
|
+
{
|
|
443
|
+
"name": "my-plugin",
|
|
444
|
+
"source": "./",
|
|
445
|
+
"description": "Plugin that needs root-level access",
|
|
446
|
+
"commands": ["./plugins/my-plugin/commands/"],
|
|
447
|
+
"agents": ["./plugins/my-plugin/agents/"],
|
|
448
|
+
"strict": false
|
|
449
|
+
}
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
This approach copies the entire marketplace root, giving your plugin access to sibling directories.
|
|
453
|
+
|
|
454
|
+
<Note>
|
|
455
|
+
Symlinks that point to locations outside the plugin's logical root are followed during copying. This provides flexibility while maintaining the security benefits of the caching system.
|
|
456
|
+
</Note>
|
|
457
|
+
|
|
458
|
+
***
|
|
459
|
+
|
|
460
|
+
## Plugin directory structure
|
|
461
|
+
|
|
462
|
+
### Standard plugin layout
|
|
463
|
+
|
|
464
|
+
A complete plugin follows this structure:
|
|
465
|
+
|
|
466
|
+
```
|
|
467
|
+
enterprise-plugin/
|
|
468
|
+
├── .claude-plugin/ # Metadata directory
|
|
469
|
+
│ └── plugin.json # Required: plugin manifest
|
|
470
|
+
├── commands/ # Default command location
|
|
471
|
+
│ ├── status.md
|
|
472
|
+
│ └── logs.md
|
|
473
|
+
├── agents/ # Default agent location
|
|
474
|
+
│ ├── security-reviewer.md
|
|
475
|
+
│ ├── performance-tester.md
|
|
476
|
+
│ └── compliance-checker.md
|
|
477
|
+
├── skills/ # Agent Skills
|
|
478
|
+
│ ├── code-reviewer/
|
|
479
|
+
│ │ └── SKILL.md
|
|
480
|
+
│ └── pdf-processor/
|
|
481
|
+
│ ├── SKILL.md
|
|
482
|
+
│ └── scripts/
|
|
483
|
+
├── hooks/ # Hook configurations
|
|
484
|
+
│ ├── hooks.json # Main hook config
|
|
485
|
+
│ └── security-hooks.json # Additional hooks
|
|
486
|
+
├── .mcp.json # MCP server definitions
|
|
487
|
+
├── .lsp.json # LSP server configurations
|
|
488
|
+
├── scripts/ # Hook and utility scripts
|
|
489
|
+
│ ├── security-scan.sh
|
|
490
|
+
│ ├── format-code.py
|
|
491
|
+
│ └── deploy.js
|
|
492
|
+
├── LICENSE # License file
|
|
493
|
+
└── CHANGELOG.md # Version history
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
<Warning>
|
|
497
|
+
The `.claude-plugin/` directory contains the `plugin.json` file. All other directories (commands/, agents/, skills/, hooks/) must be at the plugin root, not inside `.claude-plugin/`.
|
|
498
|
+
</Warning>
|
|
499
|
+
|
|
500
|
+
### File locations reference
|
|
501
|
+
|
|
502
|
+
| Component | Default Location | Purpose |
|
|
503
|
+
| :-------------- | :--------------------------- | :------------------------------- |
|
|
504
|
+
| **Manifest** | `.claude-plugin/plugin.json` | Required metadata file |
|
|
505
|
+
| **Commands** | `commands/` | Slash command Markdown files |
|
|
506
|
+
| **Agents** | `agents/` | Subagent Markdown files |
|
|
507
|
+
| **Skills** | `skills/` | Agent Skills with SKILL.md files |
|
|
508
|
+
| **Hooks** | `hooks/hooks.json` | Hook configuration |
|
|
509
|
+
| **MCP servers** | `.mcp.json` | MCP server definitions |
|
|
510
|
+
| **LSP servers** | `.lsp.json` | Language server configurations |
|
|
511
|
+
|
|
512
|
+
***
|
|
513
|
+
|
|
514
|
+
## CLI commands reference
|
|
515
|
+
|
|
516
|
+
Claude Code provides CLI commands for non-interactive plugin management, useful for scripting and automation.
|
|
517
|
+
|
|
518
|
+
### plugin install
|
|
519
|
+
|
|
520
|
+
Install a plugin from available marketplaces.
|
|
521
|
+
|
|
522
|
+
```bash theme={null}
|
|
523
|
+
claude plugin install <plugin> [options]
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
**Arguments:**
|
|
527
|
+
|
|
528
|
+
* `<plugin>`: Plugin name or `plugin-name@marketplace-name` for a specific marketplace
|
|
529
|
+
|
|
530
|
+
**Options:**
|
|
531
|
+
|
|
532
|
+
| Option | Description | Default |
|
|
533
|
+
| :-------------------- | :------------------------------------------------ | :------ |
|
|
534
|
+
| `-s, --scope <scope>` | Installation scope: `user`, `project`, or `local` | `user` |
|
|
535
|
+
| `-h, --help` | Display help for command | |
|
|
536
|
+
|
|
537
|
+
**Examples:**
|
|
538
|
+
|
|
539
|
+
```bash theme={null}
|
|
540
|
+
# Install to user scope (default)
|
|
541
|
+
claude plugin install formatter@my-marketplace
|
|
542
|
+
|
|
543
|
+
# Install to project scope (shared with team)
|
|
544
|
+
claude plugin install formatter@my-marketplace --scope project
|
|
545
|
+
|
|
546
|
+
# Install to local scope (gitignored)
|
|
547
|
+
claude plugin install formatter@my-marketplace --scope local
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
### plugin uninstall
|
|
551
|
+
|
|
552
|
+
Remove an installed plugin.
|
|
553
|
+
|
|
554
|
+
```bash theme={null}
|
|
555
|
+
claude plugin uninstall <plugin> [options]
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
**Arguments:**
|
|
559
|
+
|
|
560
|
+
* `<plugin>`: Plugin name or `plugin-name@marketplace-name`
|
|
561
|
+
|
|
562
|
+
**Options:**
|
|
563
|
+
|
|
564
|
+
| Option | Description | Default |
|
|
565
|
+
| :-------------------- | :-------------------------------------------------- | :------ |
|
|
566
|
+
| `-s, --scope <scope>` | Uninstall from scope: `user`, `project`, or `local` | `user` |
|
|
567
|
+
| `-h, --help` | Display help for command | |
|
|
568
|
+
|
|
569
|
+
**Aliases:** `remove`, `rm`
|
|
570
|
+
|
|
571
|
+
### plugin enable
|
|
572
|
+
|
|
573
|
+
Enable a disabled plugin.
|
|
574
|
+
|
|
575
|
+
```bash theme={null}
|
|
576
|
+
claude plugin enable <plugin> [options]
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
**Arguments:**
|
|
580
|
+
|
|
581
|
+
* `<plugin>`: Plugin name or `plugin-name@marketplace-name`
|
|
582
|
+
|
|
583
|
+
**Options:**
|
|
584
|
+
|
|
585
|
+
| Option | Description | Default |
|
|
586
|
+
| :-------------------- | :--------------------------------------------- | :------ |
|
|
587
|
+
| `-s, --scope <scope>` | Scope to enable: `user`, `project`, or `local` | `user` |
|
|
588
|
+
| `-h, --help` | Display help for command | |
|
|
589
|
+
|
|
590
|
+
### plugin disable
|
|
591
|
+
|
|
592
|
+
Disable a plugin without uninstalling it.
|
|
593
|
+
|
|
594
|
+
```bash theme={null}
|
|
595
|
+
claude plugin disable <plugin> [options]
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
**Arguments:**
|
|
599
|
+
|
|
600
|
+
* `<plugin>`: Plugin name or `plugin-name@marketplace-name`
|
|
601
|
+
|
|
602
|
+
**Options:**
|
|
603
|
+
|
|
604
|
+
| Option | Description | Default |
|
|
605
|
+
| :-------------------- | :---------------------------------------------- | :------ |
|
|
606
|
+
| `-s, --scope <scope>` | Scope to disable: `user`, `project`, or `local` | `user` |
|
|
607
|
+
| `-h, --help` | Display help for command | |
|
|
608
|
+
|
|
609
|
+
### plugin update
|
|
610
|
+
|
|
611
|
+
Update a plugin to the latest version.
|
|
612
|
+
|
|
613
|
+
```bash theme={null}
|
|
614
|
+
claude plugin update <plugin> [options]
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
**Arguments:**
|
|
618
|
+
|
|
619
|
+
* `<plugin>`: Plugin name or `plugin-name@marketplace-name`
|
|
620
|
+
|
|
621
|
+
**Options:**
|
|
622
|
+
|
|
623
|
+
| Option | Description | Default |
|
|
624
|
+
| :-------------------- | :-------------------------------------------------------- | :------ |
|
|
625
|
+
| `-s, --scope <scope>` | Scope to update: `user`, `project`, `local`, or `managed` | `user` |
|
|
626
|
+
| `-h, --help` | Display help for command | |
|
|
627
|
+
|
|
628
|
+
***
|
|
629
|
+
|
|
630
|
+
## Debugging and development tools
|
|
631
|
+
|
|
632
|
+
### Debugging commands
|
|
633
|
+
|
|
634
|
+
Use `claude --debug` to see plugin loading details:
|
|
635
|
+
|
|
636
|
+
```bash theme={null}
|
|
637
|
+
claude --debug
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
This shows:
|
|
641
|
+
|
|
642
|
+
* Which plugins are being loaded
|
|
643
|
+
* Any errors in plugin manifests
|
|
644
|
+
* Command, agent, and hook registration
|
|
645
|
+
* MCP server initialization
|
|
646
|
+
|
|
647
|
+
### Common issues
|
|
648
|
+
|
|
649
|
+
| Issue | Cause | Solution |
|
|
650
|
+
| :---------------------------------- | :------------------------------ | :-------------------------------------------------------------------------------- |
|
|
651
|
+
| Plugin not loading | Invalid `plugin.json` | Validate JSON syntax with `claude plugin validate` or `/plugin validate` |
|
|
652
|
+
| Commands not appearing | Wrong directory structure | Ensure `commands/` at root, not in `.claude-plugin/` |
|
|
653
|
+
| Hooks not firing | Script not executable | Run `chmod +x script.sh` |
|
|
654
|
+
| MCP server fails | Missing `${CLAUDE_PLUGIN_ROOT}` | Use variable for all plugin paths |
|
|
655
|
+
| Path errors | Absolute paths used | All paths must be relative and start with `./` |
|
|
656
|
+
| LSP `Executable not found in $PATH` | Language server not installed | Install the binary (e.g., `npm install -g typescript-language-server typescript`) |
|
|
657
|
+
|
|
658
|
+
### Example error messages
|
|
659
|
+
|
|
660
|
+
**Manifest validation errors**:
|
|
661
|
+
|
|
662
|
+
* `Invalid JSON syntax: Unexpected token } in JSON at position 142`: check for missing commas, extra commas, or unquoted strings
|
|
663
|
+
* `Plugin has an invalid manifest file at .claude-plugin/plugin.json. Validation errors: name: Required`: a required field is missing
|
|
664
|
+
* `Plugin has a corrupt manifest file at .claude-plugin/plugin.json. JSON parse error: ...`: JSON syntax error
|
|
665
|
+
|
|
666
|
+
**Plugin loading errors**:
|
|
667
|
+
|
|
668
|
+
* `Warning: No commands found in plugin my-plugin custom directory: ./cmds. Expected .md files or SKILL.md in subdirectories.`: command path exists but contains no valid command files
|
|
669
|
+
* `Plugin directory not found at path: ./plugins/my-plugin. Check that the marketplace entry has the correct path.`: the `source` path in marketplace.json points to a non-existent directory
|
|
670
|
+
* `Plugin my-plugin has conflicting manifests: both plugin.json and marketplace entry specify components.`: remove duplicate component definitions or set `strict: true` in marketplace entry
|
|
671
|
+
|
|
672
|
+
### Hook troubleshooting
|
|
673
|
+
|
|
674
|
+
**Hook script not executing**:
|
|
675
|
+
|
|
676
|
+
1. Check the script is executable: `chmod +x ./scripts/your-script.sh`
|
|
677
|
+
2. Verify the shebang line: First line should be `#!/bin/bash` or `#!/usr/bin/env bash`
|
|
678
|
+
3. Check the path uses `${CLAUDE_PLUGIN_ROOT}`: `"command": "${CLAUDE_PLUGIN_ROOT}/scripts/your-script.sh"`
|
|
679
|
+
4. Test the script manually: `./scripts/your-script.sh`
|
|
680
|
+
|
|
681
|
+
**Hook not triggering on expected events**:
|
|
682
|
+
|
|
683
|
+
1. Verify the event name is correct (case-sensitive): `PostToolUse`, not `postToolUse`
|
|
684
|
+
2. Check the matcher pattern matches your tools: `"matcher": "Write|Edit"` for file operations
|
|
685
|
+
3. Confirm the hook type is valid: `command`, `prompt`, or `agent`
|
|
686
|
+
|
|
687
|
+
### MCP server troubleshooting
|
|
688
|
+
|
|
689
|
+
**Server not starting**:
|
|
690
|
+
|
|
691
|
+
1. Check the command exists and is executable
|
|
692
|
+
2. Verify all paths use `${CLAUDE_PLUGIN_ROOT}` variable
|
|
693
|
+
3. Check the MCP server logs: `claude --debug` shows initialization errors
|
|
694
|
+
4. Test the server manually outside of Claude Code
|
|
695
|
+
|
|
696
|
+
**Server tools not appearing**:
|
|
697
|
+
|
|
698
|
+
1. Ensure the server is properly configured in `.mcp.json` or `plugin.json`
|
|
699
|
+
2. Verify the server implements the MCP protocol correctly
|
|
700
|
+
3. Check for connection timeouts in debug output
|
|
701
|
+
|
|
702
|
+
### Directory structure mistakes
|
|
703
|
+
|
|
704
|
+
**Symptoms**: Plugin loads but components (commands, agents, hooks) are missing.
|
|
705
|
+
|
|
706
|
+
**Correct structure**: Components must be at the plugin root, not inside `.claude-plugin/`. Only `plugin.json` belongs in `.claude-plugin/`.
|
|
707
|
+
|
|
708
|
+
```
|
|
709
|
+
my-plugin/
|
|
710
|
+
├── .claude-plugin/
|
|
711
|
+
│ └── plugin.json ← Only manifest here
|
|
712
|
+
├── commands/ ← At root level
|
|
713
|
+
├── agents/ ← At root level
|
|
714
|
+
└── hooks/ ← At root level
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
If your components are inside `.claude-plugin/`, move them to the plugin root.
|
|
718
|
+
|
|
719
|
+
**Debug checklist**:
|
|
720
|
+
|
|
721
|
+
1. Run `claude --debug` and look for "loading plugin" messages
|
|
722
|
+
2. Check that each component directory is listed in the debug output
|
|
723
|
+
3. Verify file permissions allow reading the plugin files
|
|
724
|
+
|
|
725
|
+
***
|
|
726
|
+
|
|
727
|
+
## Distribution and versioning reference
|
|
728
|
+
|
|
729
|
+
### Version management
|
|
730
|
+
|
|
731
|
+
Follow semantic versioning for plugin releases:
|
|
732
|
+
|
|
733
|
+
```json theme={null}
|
|
734
|
+
{
|
|
735
|
+
"name": "my-plugin",
|
|
736
|
+
"version": "2.1.0"
|
|
737
|
+
}
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
**Version format**: `MAJOR.MINOR.PATCH`
|
|
741
|
+
|
|
742
|
+
* **MAJOR**: Breaking changes (incompatible API changes)
|
|
743
|
+
* **MINOR**: New features (backward-compatible additions)
|
|
744
|
+
* **PATCH**: Bug fixes (backward-compatible fixes)
|
|
745
|
+
|
|
746
|
+
**Best practices**:
|
|
747
|
+
|
|
748
|
+
* Start at `1.0.0` for your first stable release
|
|
749
|
+
* Update the version in `plugin.json` before distributing changes
|
|
750
|
+
* Document changes in a `CHANGELOG.md` file
|
|
751
|
+
* Use pre-release versions like `2.0.0-beta.1` for testing
|
|
752
|
+
|
|
753
|
+
***
|
|
754
|
+
|
|
755
|
+
## See also
|
|
756
|
+
|
|
757
|
+
* [Plugins](/en/plugins) - Tutorials and practical usage
|
|
758
|
+
* [Plugin marketplaces](/en/plugin-marketplaces) - Creating and managing marketplaces
|
|
759
|
+
* [Slash commands](/en/slash-commands) - Command development details
|
|
760
|
+
* [Subagents](/en/sub-agents) - Agent configuration and capabilities
|
|
761
|
+
* [Agent Skills](/en/skills) - Extend Claude's capabilities
|
|
762
|
+
* [Hooks](/en/hooks) - Event handling and automation
|
|
763
|
+
* [MCP](/en/mcp) - External tool integration
|
|
764
|
+
* [Settings](/en/settings) - Configuration options for plugins
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
---
|
|
768
|
+
|
|
769
|
+
> To find navigation and other pages in this documentation, fetch the llms.txt file at: https://code.claude.com/docs/llms.txt
|