304 "repository": "https://github.com/author/plugin",304 "repository": "https://github.com/author/plugin",
305 "license": "MIT",305 "license": "MIT",
306 "keywords": ["keyword1", "keyword2"],306 "keywords": ["keyword1", "keyword2"],
307 "skills": "./custom/skills/",
307 "commands": ["./custom/commands/special.md"],308 "commands": ["./custom/commands/special.md"],
308 "agents": "./custom/agents/",309 "agents": "./custom/agents/",
309 "skills": "./custom/skills/",
310 "hooks": "./config/hooks.json",310 "hooks": "./config/hooks.json",
311 "mcpServers": "./mcp-config.json",311 "mcpServers": "./mcp-config.json",
312 "outputStyles": "./styles/",312 "outputStyles": "./styles/",
342 342
343| Field | Type | Description | Example |343| Field | Type | Description | Example |
344| :------------- | :-------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------- |344| :------------- | :-------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------- |
345| `commands` | string\|array | Custom command files/directories (replaces default `commands/`) | `"./custom/cmd.md"` or `["./cmd1.md"]` |345| `skills` | string\|array | Custom skill directories containing `<name>/SKILL.md` (replaces default `skills/`) | `"./custom/skills/"` |
346| `commands` | string\|array | Custom flat `.md` skill files or directories (replaces default `commands/`) | `"./custom/cmd.md"` or `["./cmd1.md"]` |
346| `agents` | string\|array | Custom agent files (replaces default `agents/`) | `"./custom/agents/reviewer.md"` |347| `agents` | string\|array | Custom agent files (replaces default `agents/`) | `"./custom/agents/reviewer.md"` |
347| `skills` | string\|array | Custom skill directories (replaces default `skills/`) | `"./custom/skills/"` |
348| `hooks` | string\|array\|object | Hook config paths or inline config | `"./my-extra-hooks.json"` |348| `hooks` | string\|array\|object | Hook config paths or inline config | `"./my-extra-hooks.json"` |
349| `mcpServers` | string\|array\|object | MCP config paths or inline config | `"./my-extra-mcp-config.json"` |349| `mcpServers` | string\|array\|object | MCP config paths or inline config | `"./my-extra-mcp-config.json"` |
350| `outputStyles` | string\|array | Custom output style files/directories (replaces default `output-styles/`) | `"./styles/"` |350| `outputStyles` | string\|array | Custom output style files/directories (replaces default `output-styles/`) | `"./styles/"` |
397 397
398### Path behavior rules398### Path behavior rules
399 399
400For `commands`, `agents`, `skills`, and `outputStyles`, custom paths replace the default directory. If the manifest specifies `commands`, the default `commands/` directory is not scanned. [Hooks](#hooks), [MCP servers](#mcp-servers), and [LSP servers](#lsp-servers) have different semantics for handling multiple sources.400For `skills`, `commands`, `agents`, and `outputStyles`, custom paths replace the default directory. If the manifest specifies `skills`, the default `skills/` directory is not scanned. [Hooks](#hooks), [MCP servers](#mcp-servers), and [LSP servers](#lsp-servers) have different semantics for handling multiple sources.
401 401
402* All paths must be relative to the plugin root and start with `./`402* All paths must be relative to the plugin root and start with `./`
403* Components from custom paths use the same naming and namespacing rules403* Components from custom paths use the same naming and namespacing rules
404* Multiple paths can be specified as arrays404* Multiple paths can be specified as arrays
405* To keep the default directory and add more paths for commands, agents, skills, or output styles, include the default in your array: `"commands": ["./commands/", "./extras/deploy.md"]`405* To keep the default directory and add more paths for skills, commands, agents, or output styles, include the default in your array: `"skills": ["./skills/", "./extras/"]`
406* When a skill path points to a directory that contains a `SKILL.md` directly, for example `"skills": ["./"]` pointing to the plugin root, the frontmatter `name` field in `SKILL.md` determines the skill's invocation name. This gives a stable name regardless of the install directory. If `name` is not set in the frontmatter, the directory basename is used as a fallback.406* When a skill path points to a directory that contains a `SKILL.md` directly, for example `"skills": ["./"]` pointing to the plugin root, the frontmatter `name` field in `SKILL.md` determines the skill's invocation name. This gives a stable name regardless of the install directory. If `name` is not set in the frontmatter, the directory basename is used as a fallback.
407 407
408**Path examples**:408**Path examples**:
530enterprise-plugin/530enterprise-plugin/
531├── .claude-plugin/ # Metadata directory (optional)531├── .claude-plugin/ # Metadata directory (optional)
532│ └── plugin.json # plugin manifest532│ └── plugin.json # plugin manifest
533├── commands/ # Default command location533├── skills/ # Skills
534│ ├── status.md
535│ └── logs.md
536├── agents/ # Default agent location
537│ ├── security-reviewer.md
538│ ├── performance-tester.md
539│ └── compliance-checker.md
540├── skills/ # Agent Skills
541│ ├── code-reviewer/534│ ├── code-reviewer/
542│ │ └── SKILL.md535│ │ └── SKILL.md
543│ └── pdf-processor/536│ └── pdf-processor/
544│ ├── SKILL.md537│ ├── SKILL.md
545│ └── scripts/538│ └── scripts/
539├── commands/ # Skills as flat .md files
540│ ├── status.md
541│ └── logs.md
542├── agents/ # Subagent definitions
543│ ├── security-reviewer.md
544│ ├── performance-tester.md
545│ └── compliance-checker.md
546├── output-styles/ # Output style definitions546├── output-styles/ # Output style definitions
547│ └── terse.md547│ └── terse.md
548├── hooks/ # Hook configurations548├── hooks/ # Hook configurations
570| Component | Default Location | Purpose |570| Component | Default Location | Purpose |
571| :---------------- | :--------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------- |571| :---------------- | :--------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------- |
572| **Manifest** | `.claude-plugin/plugin.json` | Plugin metadata and configuration (optional) |572| **Manifest** | `.claude-plugin/plugin.json` | Plugin metadata and configuration (optional) |
573| **Commands** | `commands/` | Skill Markdown files (legacy; use `skills/` for new skills) |
574| **Agents** | `agents/` | Subagent Markdown files |
575| **Skills** | `skills/` | Skills with `<name>/SKILL.md` structure |573| **Skills** | `skills/` | Skills with `<name>/SKILL.md` structure |
574| **Commands** | `commands/` | Skills as flat Markdown files. Use `skills/` for new plugins |
575| **Agents** | `agents/` | Subagent Markdown files |
576| **Output styles** | `output-styles/` | Output style definitions |576| **Output styles** | `output-styles/` | Output style definitions |
577| **Hooks** | `hooks/hooks.json` | Hook configuration |577| **Hooks** | `hooks/hooks.json` | Hook configuration |
578| **MCP servers** | `.mcp.json` | MCP server definitions |578| **MCP servers** | `.mcp.json` | MCP server definitions |
713 713
714* Which plugins are being loaded714* Which plugins are being loaded
715* Any errors in plugin manifests715* Any errors in plugin manifests
716* Command, agent, and hook registration716* Skill, agent, and hook registration
717* MCP server initialization717* MCP server initialization
718 718
719### Common issues719### Common issues
721| Issue | Cause | Solution |721| Issue | Cause | Solution |
722| :---------------------------------- | :------------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------- |722| :---------------------------------- | :------------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------- |
723| Plugin not loading | Invalid `plugin.json` | Run `claude plugin validate` or `/plugin validate` to check `plugin.json`, skill/agent/command frontmatter, and `hooks/hooks.json` for syntax and schema errors |723| Plugin not loading | Invalid `plugin.json` | Run `claude plugin validate` or `/plugin validate` to check `plugin.json`, skill/agent/command frontmatter, and `hooks/hooks.json` for syntax and schema errors |
724| Commands not appearing | Wrong directory structure | Ensure `commands/` at root, not in `.claude-plugin/` |724| Skills not appearing | Wrong directory structure | Ensure `skills/` or `commands/` is at the plugin root, not inside `.claude-plugin/` |
725| Hooks not firing | Script not executable | Run `chmod +x script.sh` |725| Hooks not firing | Script not executable | Run `chmod +x script.sh` |
726| MCP server fails | Missing `${CLAUDE_PLUGIN_ROOT}` | Use variable for all plugin paths |726| MCP server fails | Missing `${CLAUDE_PLUGIN_ROOT}` | Use variable for all plugin paths |
727| Path errors | Absolute paths used | All paths must be relative and start with `./` |727| Path errors | Absolute paths used | All paths must be relative and start with `./` |
773 773
774### Directory structure mistakes774### Directory structure mistakes
775 775
776**Symptoms**: Plugin loads but components (commands, agents, hooks) are missing.776**Symptoms**: Plugin loads but components (skills, agents, hooks) are missing.
777 777
778**Correct structure**: Components must be at the plugin root, not inside `.claude-plugin/`. Only `plugin.json` belongs in `.claude-plugin/`.778**Correct structure**: Components must be at the plugin root, not inside `.claude-plugin/`. Only `plugin.json` belongs in `.claude-plugin/`.
779 779