Overview
Claude Code plugins follow a specific directory structure. Understanding this structure is essential for creating valid plugins.Basic Structure
Every plugin must follow this structure:Plugin Naming
Plugin directory names should follow these conventions:- Format: kebab-case
- Descriptive: Name should indicate purpose
- Avoid vague names:
helper,utils,tools,misc - Avoid reserved words:
anthropic,claude
- ✅
constant-time-analysis - ✅
smart-contract-auditor - ✅
yara-authoring - ❌
helper - ❌
my-plugin
Plugin Metadata (plugin.json)
Every plugin requires aplugin.json file in the .claude-plugin/ directory:
Fields
| Field | Required | Description |
|---|---|---|
name | Yes | Plugin name (kebab-case) |
version | Yes | Semantic version (e.g., 1.0.0) |
description | Yes | What the plugin does |
author.name | Yes | Author or organization name |
author.email | No | Contact email |
author.url | No | Website or GitHub profile |
Version Management
Clients only update plugins when the version number increases. Always increment the version for substantive changes.
plugins/<name>/.claude-plugin/plugin.json- Root
.claude-plugin/marketplace.json
Skills Directory
Skills provide knowledge and guidance to Claude.Structure
SKILL.md Requirements
Every skill needs aSKILL.md file with YAML frontmatter:
Supporting Directories
references/ - Detailed documentation:Commands Directory
Slash commands provide interactive functionality.Structure
Command Definition
Each command is defined in a markdown file:Agents Directory
Agents provide autonomous task execution.Structure
Agent Definition
Hooks Directory
Hooks intercept tool calls to validate or enhance behavior.Structure
Hook Types
pre-tool-use - Runs before tool execution:- Validate parameters
- Prevent dangerous operations
- Suggest safer alternatives
- Process results
- Generate reports
- Update state
Performance Considerations
See Best Practices - Hooks for optimization guidance.Python Scripts
When including Python scripts, follow these conventions:PEP 723 Inline Metadata
Declare dependencies in script headers:Execution with uv
Scripts should be executed withuv run:
Development Files
Includepyproject.toml for development tooling:
Path Handling
Using
Claude automatically replaces{baseDir} with the skill directory path:
Good:
Path Conventions
- Use
{baseDir}for paths relative to the skill directory - Use forward slashes (
/) even on Windows - Claude handles platform-specific path conversion
Example Structures
Basic Plugin (ask-questions-if-underspecified)
Minimal structure with single skill:Intermediate Plugin (constant-time-analysis)
With Python scripts and references:Advanced Plugin (culture-index)
With scripts, workflows, and templates:README.md
Every plugin must have a README.md at the plugin root:File Organization Checklist
Before submitting, verify: Structure:-
.claude-plugin/plugin.jsonexists and is valid JSON - Component directories at plugin root (not in
.claude-plugin/) - All skills have
SKILL.mdwith frontmatter -
README.mdexists at plugin root
- No hardcoded absolute paths
-
{baseDir}used for relative paths - Forward slashes used (even on Windows)
- Scripts use PEP 723 inline metadata
-
pyproject.tomlin scripts/ for development tools - Execution documented with
uv run
- All referenced files exist
- References are one level deep (no chains)
- SKILL.md under 500 lines
Next Steps
Skill Authoring
Learn how to write SKILL.md files
Best Practices
Follow quality standards
Examples
See real-world examples
Getting Started
Start creating your plugin