Skip to main content

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:
Component directories (skills/, commands/, agents/, hooks/) must be at the plugin root, NOT inside .claude-plugin/. Only plugin.json belongs in .claude-plugin/.

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
Examples:
  • constant-time-analysis
  • smart-contract-auditor
  • yara-authoring
  • helper
  • my-plugin

Plugin Metadata (plugin.json)

Every plugin requires a plugin.json file in the .claude-plugin/ directory:

Fields

Version Management

Clients only update plugins when the version number increases. Always increment the version for substantive changes.
Version must be updated in two places:
  1. plugins/<name>/.claude-plugin/plugin.json
  2. Root .claude-plugin/marketplace.json
Both version numbers must match for the plugin to be recognized properly.

Skills Directory

Skills provide knowledge and guidance to Claude.

Structure

SKILL.md Requirements

Every skill needs a SKILL.md file with YAML frontmatter:
See Skill Authoring for detailed guidance.

Supporting Directories

references/ - Detailed documentation:
workflows/ - Step-by-step guides:
scripts/ - Executable utilities:
templates/ - File templates:

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
post-tool-use - Runs after tool execution:
  • Process results
  • Generate reports
  • Update state

Performance Considerations

Hooks run on EVERY tool invocation. Performance is critical.
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 with uv run:
This automatically handles dependency installation.

Development Files

Include pyproject.toml for development tooling:

Path Handling

Never hardcode absolute paths. Always use {baseDir} for portability.

Using

Claude automatically replaces {baseDir} with the skill directory path: Good:
Bad:

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.json exists and is valid JSON
  • Component directories at plugin root (not in .claude-plugin/)
  • All skills have SKILL.md with frontmatter
  • README.md exists at plugin root
Paths:
  • No hardcoded absolute paths
  • {baseDir} used for relative paths
  • Forward slashes used (even on Windows)
Python:
  • Scripts use PEP 723 inline metadata
  • pyproject.toml in scripts/ for development tools
  • Execution documented with uv run
Documentation:
  • 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