Skip to content

Create Plugins

Plugins let you extend Claude Code with custom slash commands, agents, Skills, Hooks, and MCP servers.

When to Use Plugins vs Standalone

ApproachCommand FormatBest For
Standalone (.claude/)/helloPersonal workflows, quick experiments
Plugins (.claude-plugin/)/plugin-name:helloTeam sharing, community distribution

Quickstart: Create Your First Plugin

Step 1: Create Plugin Directory

mkdir my-first-plugin
mkdir my-first-plugin/.claude-plugin

Step 2: Create Plugin Manifest

Create my-first-plugin/.claude-plugin/plugin.json:

{
  "name": "my-first-plugin",
  "description": "A greeting plugin to learn basics",
  "version": "1.0.0"
}

Step 3: Add a Slash Command

mkdir my-first-plugin/commands

Create my-first-plugin/commands/hello.md:

---
description: Greet the user with a friendly message
---

# Hello Command

Greet the user warmly and ask how you can help today.

Step 4: Test Your Plugin

claude --plugin-dir ./my-first-plugin
> /my-first-plugin:hello

Plugin Structure

DirectoryPurpose
.claude-plugin/Contains plugin.json manifest (required)
commands/Custom slash commands
agents/Custom subagents
skills/Agent Skills
hooks/Event hook configurations
.mcp.jsonMCP server definitions
.lsp.jsonLSP server configurations
Common mistake: Don’t put commands/, agents/, skills/ inside .claude-plugin/. Only plugin.json goes there.

Adding Components

Agents

Create Markdown files in agents/ directory.

Skills

Create subdirectories in skills/, each with SKILL.md.

Hooks

Create hooks/hooks.json:

{
  "hooks": {
    "PostToolUse": [{
      "matcher": "Write|Edit",
      "hooks": [{
        "type": "command",
        "command": "${CLAUDE_PLUGIN_ROOT}/scripts/format.sh"
      }]
    }]
  }
}

MCP Servers

Create .mcp.json at plugin root.


Debugging

claude --debug

Next Steps