Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Directory structure and conventions for building Claude Code plugins (from the official Anthropic claude-code repo).
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/manifest-reference.md
1# Plugin Manifest Reference23Complete reference for `plugin.json` configuration.45## File Location67**Required path**: `.claude-plugin/plugin.json`89The manifest MUST be in the `.claude-plugin/` directory at the plugin root. Claude Code will not recognize plugins without this file in the correct location.1011## Complete Field Reference1213### Core Fields1415#### name (required)1617**Type**: String18**Format**: kebab-case19**Example**: `"test-automation-suite"`2021The unique identifier for the plugin. Used for:22- Plugin identification in Claude Code23- Conflict detection with other plugins24- Command namespacing (optional)2526**Requirements**:27- Must be unique across all installed plugins28- Use only lowercase letters, numbers, and hyphens29- No spaces or special characters30- Start with a letter31- End with a letter or number3233**Validation**:34```javascript35/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/36```3738**Examples**:39- ✅ Good: `api-tester`, `code-review`, `git-workflow-automation`40- ❌ Bad: `API Tester`, `code_review`, `-git-workflow`, `test-`4142#### version4344**Type**: String45**Format**: Semantic versioning (MAJOR.MINOR.PATCH)46**Example**: `"2.1.0"`47**Default**: `"0.1.0"` if not specified4849Semantic versioning guidelines:50- **MAJOR**: Incompatible API changes, breaking changes51- **MINOR**: New functionality, backward-compatible52- **PATCH**: Bug fixes, backward-compatible5354**Pre-release versions**:55- `"1.0.0-alpha.1"` - Alpha release56- `"1.0.0-beta.2"` - Beta release57- `"1.0.0-rc.1"` - Release candidate5859**Examples**:60- `"0.1.0"` - Initial development61- `"1.0.0"` - First stable release62- `"1.2.3"` - Patch update to 1.263- `"2.0.0"` - Major version with breaking changes6465#### description6667**Type**: String68**Length**: 50-200 characters recommended69**Example**: `"Automates code review workflows with style checks and automated feedback"`7071Brief explanation of plugin purpose and functionality.7273**Best practices**:74- Focus on what the plugin does, not how75- Use active voice76- Mention key features or benefits77- Keep under 200 characters for marketplace display7879**Examples**:80- ✅ "Generates comprehensive test suites from code analysis and coverage reports"81- ✅ "Integrates with Jira for automatic issue tracking and sprint management"82- ❌ "A plugin that helps you do testing stuff"83- ❌ "This is a very long description that goes on and on about every single feature..."8485### Metadata Fields8687#### author8889**Type**: Object90**Fields**: name (required), email (optional), url (optional)9192```json93{94"author": {95"name": "Jane Developer",96"email": "[email protected]",97"url": "https://janedeveloper.com"98}99}100```101102**Alternative format** (string only):103```json104{105"author": "Jane Developer <[email protected]> (https://janedeveloper.com)"106}107```108109**Use cases**:110- Credit and attribution111- Contact for support or questions112- Marketplace display113- Community recognition114115#### homepage116117**Type**: String (URL)118**Example**: `"https://docs.example.com/plugins/my-plugin"`119120Link to plugin documentation or landing page.121122**Should point to**:123- Plugin documentation site124- Project homepage125- Detailed usage guide126- Installation instructions127128**Not for**:129- Source code (use `repository` field)130- Issue tracker (include in documentation)131- Personal websites (use `author.url`)132133#### repository134135**Type**: String (URL) or Object136**Example**: `"https://github.com/user/plugin-name"`137138Source code repository location.139140**String format**:141```json142{143"repository": "https://github.com/user/plugin-name"144}145```146147**Object format** (detailed):148```json149{150"repository": {151"type": "git",152"url": "https://github.com/user/plugin-name.git",153"directory": "packages/plugin-name"154}155}156```157158**Use cases**:159- Source code access160- Issue reporting161- Community contributions162- Transparency and trust163164#### license165166**Type**: String167**Format**: SPDX identifier168**Example**: `"MIT"`169170Software license identifier.171172**Common licenses**:173- `"MIT"` - Permissive, popular choice174- `"Apache-2.0"` - Permissive with patent grant175- `"GPL-3.0"` - Copyleft176- `"BSD-3-Clause"` - Permissive177- `"ISC"` - Permissive, similar to MIT178- `"UNLICENSED"` - Proprietary, not open source179180**Full list**: https://spdx.org/licenses/181182**Multiple licenses**:183```json184{185"license": "(MIT OR Apache-2.0)"186}187```188189#### keywords190191**Type**: Array of strings192**Example**: `["testing", "automation", "ci-cd", "quality-assurance"]`193194Tags for plugin discovery and categorization.195196**Best practices**:197- Use 5-10 keywords198- Include functionality categories199- Add technology names200- Use common search terms201- Avoid duplicating plugin name202203**Categories to consider**:204- Functionality: `testing`, `debugging`, `documentation`, `deployment`205- Technologies: `typescript`, `python`, `docker`, `aws`206- Workflows: `ci-cd`, `code-review`, `git-workflow`207- Domains: `web-development`, `data-science`, `devops`208209### Component Path Fields210211#### commands212213**Type**: String or Array of strings214**Default**: `["./commands"]`215**Example**: `"./cli-commands"`216217Additional directories or files containing command definitions.218219**Single path**:220```json221{222"commands": "./custom-commands"223}224```225226**Multiple paths**:227```json228{229"commands": [230"./commands",231"./admin-commands",232"./experimental-commands"233]234}235```236237**Behavior**: Supplements default `commands/` directory (does not replace)238239**Use cases**:240- Organizing commands by category241- Separating stable from experimental commands242- Loading commands from shared locations243244#### agents245246**Type**: String or Array of strings247**Default**: `["./agents"]`248**Example**: `"./specialized-agents"`249250Additional directories or files containing agent definitions.251252**Format**: Same as `commands` field253254**Use cases**:255- Grouping agents by specialization256- Separating general-purpose from task-specific agents257- Loading agents from plugin dependencies258259#### hooks260261**Type**: String (path to JSON file) or Object (inline configuration)262**Default**: `"./hooks/hooks.json"`263264Hook configuration location or inline definition.265266**File path**:267```json268{269"hooks": "./config/hooks.json"270}271```272273**Inline configuration**:274```json275{276"hooks": {277"PreToolUse": [278{279"matcher": "Write",280"hooks": [281{282"type": "command",283"command": "bash ${CLAUDE_PLUGIN_ROOT}/scripts/validate.sh",284"timeout": 30285}286]287}288]289}290}291```292293**Use cases**:294- Simple plugins: Inline configuration (< 50 lines)295- Complex plugins: External JSON file296- Multiple hook sets: Separate files for different contexts297298#### mcpServers299300**Type**: String (path to JSON file) or Object (inline configuration)301**Default**: `./.mcp.json`302303MCP server configuration location or inline definition.304305**File path**:306```json307{308"mcpServers": "./.mcp.json"309}310```311312**Inline configuration**:313```json314{315"mcpServers": {316"github": {317"command": "node",318"args": ["${CLAUDE_PLUGIN_ROOT}/servers/github-mcp.js"],319"env": {320"GITHUB_TOKEN": "${GITHUB_TOKEN}"321}322}323}324}325```326327**Use cases**:328- Simple plugins: Single inline server (< 20 lines)329- Complex plugins: External `.mcp.json` file330- Multiple servers: Always use external file331332## Path Resolution333334### Relative Path Rules335336All paths in component fields must follow these rules:3373381. **Must be relative**: No absolute paths3392. **Must start with `./`**: Indicates relative to plugin root3403. **Cannot use `../`**: No parent directory navigation3414. **Forward slashes only**: Even on Windows342343**Examples**:344- ✅ `"./commands"`345- ✅ `"./src/commands"`346- ✅ `"./configs/hooks.json"`347- ❌ `"/Users/name/plugin/commands"`348- ❌ `"commands"` (missing `./`)349- ❌ `"../shared/commands"`350- ❌ `".\\commands"` (backslash)351352### Resolution Order353354When Claude Code loads components:3553561. **Default directories**: Scans standard locations first357- `./commands/`358- `./agents/`359- `./skills/`360- `./hooks/hooks.json`361- `./.mcp.json`3623632. **Custom paths**: Scans paths specified in manifest364- Paths from `commands` field365- Paths from `agents` field366- Files from `hooks` and `mcpServers` fields3673683. **Merge behavior**: Components from all locations load369- No overwriting370- All discovered components register371- Name conflicts cause errors372373## Validation374375### Manifest Validation376377Claude Code validates the manifest on plugin load:378379**Syntax validation**:380- Valid JSON format381- No syntax errors382- Correct field types383384**Field validation**:385- `name` field present and valid format386- `version` follows semantic versioning (if present)387- Paths are relative with `./` prefix388- URLs are valid (if present)389390**Component validation**:391- Referenced paths exist392- Hook and MCP configurations are valid393- No circular dependencies394395### Common Validation Errors396397**Invalid name format**:398```json399{400"name": "My Plugin" // ❌ Contains spaces401}402```403Fix: Use kebab-case404```json405{406"name": "my-plugin" // ✅407}408```409410**Absolute path**:411```json412{413"commands": "/Users/name/commands" // ❌ Absolute path414}415```416Fix: Use relative path417```json418{419"commands": "./commands" // ✅420}421```422423**Missing ./ prefix**:424```json425{426"hooks": "hooks/hooks.json" // ❌ No ./427}428```429Fix: Add ./ prefix430```json431{432"hooks": "./hooks/hooks.json" // ✅433}434```435436**Invalid version**:437```json438{439"version": "1.0" // ❌ Not semantic versioning440}441```442Fix: Use MAJOR.MINOR.PATCH443```json444{445"version": "1.0.0" // ✅446}447```448449## Minimal vs. Complete Examples450451### Minimal Plugin452453Bare minimum for a working plugin:454455```json456{457"name": "hello-world"458}459```460461Relies entirely on default directory discovery.462463### Recommended Plugin464465Good metadata for distribution:466467```json468{469"name": "code-review-assistant",470"version": "1.0.0",471"description": "Automates code review with style checks and suggestions",472"author": {473"name": "Jane Developer",474"email": "[email protected]"475},476"homepage": "https://docs.example.com/code-review",477"repository": "https://github.com/janedev/code-review-assistant",478"license": "MIT",479"keywords": ["code-review", "automation", "quality", "ci-cd"]480}481```482483### Complete Plugin484485Full configuration with all features:486487```json488{489"name": "enterprise-devops",490"version": "2.3.1",491"description": "Comprehensive DevOps automation for enterprise CI/CD pipelines",492"author": {493"name": "DevOps Team",494"email": "[email protected]",495"url": "https://company.com/devops"496},497"homepage": "https://docs.company.com/plugins/devops",498"repository": {499"type": "git",500"url": "https://github.com/company/devops-plugin.git"501},502"license": "Apache-2.0",503"keywords": [504"devops",505"ci-cd",506"automation",507"kubernetes",508"docker",509"deployment"510],511"commands": [512"./commands",513"./admin-commands"514],515"agents": "./specialized-agents",516"hooks": "./config/hooks.json",517"mcpServers": "./.mcp.json"518}519```520521## Best Practices522523### Metadata5245251. **Always include version**: Track changes and updates5262. **Write clear descriptions**: Help users understand plugin purpose5273. **Provide contact information**: Enable user support5284. **Link to documentation**: Reduce support burden5295. **Choose appropriate license**: Match project goals530531### Paths5325331. **Use defaults when possible**: Minimize configuration5342. **Organize logically**: Group related components5353. **Document custom paths**: Explain why non-standard layout used5364. **Test path resolution**: Verify on multiple systems537538### Maintenance5395401. **Bump version on changes**: Follow semantic versioning5412. **Update keywords**: Reflect new functionality5423. **Keep description current**: Match actual capabilities5434. **Maintain changelog**: Track version history5445. **Update repository links**: Keep URLs current545546### Distribution5475481. **Complete metadata before publishing**: All fields filled5492. **Test on clean install**: Verify plugin works without dev environment5503. **Validate manifest**: Use validation tools5514. **Include README**: Document installation and usage5525. **Specify license file**: Include LICENSE file in plugin root553