Back to Skills

creating-plugins

majiayu000
Updated Today
1 views
58
9
58
View on GitHub
Metaaimcpdesign

About

This skill guides developers in creating full Claude Code plugins that bundle multiple components like commands, agents, and MCP servers into distributable extensions. Use it when packaging related functionality together for marketplace distribution or team sharing. It covers manifest setup, namespacing, and testing bundled plugins locally.

Quick Install

Claude Code

Recommended
Plugin CommandRecommended
/plugin add https://github.com/majiayu000/claude-skill-registry
Git CloneAlternative
git clone https://github.com/majiayu000/claude-skill-registry.git ~/.claude/skills/creating-plugins

Copy and paste this command in Claude Code to install this skill

Documentation

Creating Plugins

Create Claude Code plugins that bundle multiple extension types for distribution via marketplaces.

Quick Reference

ElementRequirement
Manifest location.claude-plugin/plugin.json
Required fieldname (kebab-case)
Component dirsAt plugin root, NOT inside .claude-plugin/
Command naming/plugin-name:command (namespaced)
Testingclaude --plugin-dir ./my-plugin

Plugin vs Standalone

Choose the right approach for your use case:

ApproachCommand NamesBest For
Standalone (.claude/)/helloPersonal workflows, single project
Plugin (.claude-plugin/plugin.json)/plugin-name:helloSharing, distribution, reuse

Use standalone when:

  • Customizing for a single project
  • Personal configuration (not shared)
  • Quick experiments before packaging

Use plugins when:

  • Sharing with team or community
  • Same functionality across multiple projects
  • Distributing through marketplace
  • Bundling multiple component types

Plugin Structure

my-plugin/
├── .claude-plugin/           # Metadata directory
│   └── plugin.json           # Required: plugin manifest
├── commands/                 # Slash commands (Markdown files)
│   ├── deploy.md
│   └── status.md
├── agents/                   # Subagent definitions
│   └── reviewer.md
├── skills/                   # Agent Skills
│   └── code-review/
│       └── SKILL.md
├── hooks/                    # Event handlers
│   └── hooks.json
├── .mcp.json                 # MCP server configurations
├── .lsp.json                 # LSP server configurations
├── scripts/                  # Hook and utility scripts
│   └── format.sh
└── README.md

Critical: Place commands/, agents/, skills/, hooks/ at plugin root. Only plugin.json goes inside .claude-plugin/.

Minimal Plugin Example

1. Create Structure

mkdir -p my-plugin/.claude-plugin
mkdir -p my-plugin/commands

2. Create Manifest

// my-plugin/.claude-plugin/plugin.json
{
  "name": "my-plugin",
  "description": "Brief description of plugin purpose",
  "version": "1.0.0"
}

3. Add a Command

<!-- my-plugin/commands/hello.md -->
---
description: Greet the user warmly
---

# Hello Command

Greet the user and ask how you can help today.

4. Test Locally

claude --plugin-dir ./my-plugin

Then run: /my-plugin:hello

Component Types

Plugins can include any combination of:

ComponentLocationFormat
Commandscommands/Markdown with frontmatter
Agentsagents/Markdown with capabilities
Skillsskills/*/SKILL.mdMarkdown with YAML frontmatter
Hookshooks/hooks.json or inlineJSON configuration
MCP Servers.mcp.json or inlineJSON configuration
LSP Servers.lsp.json or inlineJSON configuration

See COMPONENTS.md for detailed documentation of each type.

Manifest Schema

Required and optional fields:

{
  "name": "plugin-name",
  "version": "1.0.0",
  "description": "What the plugin does",
  "author": {
    "name": "Your Name",
    "email": "[email protected]"
  },
  "homepage": "https://docs.example.com/plugin",
  "repository": "https://github.com/user/plugin",
  "license": "MIT",
  "keywords": ["keyword1", "keyword2"]
}

See MANIFEST.md for the complete schema.

Environment Variables

Use ${CLAUDE_PLUGIN_ROOT} for portable paths in hooks and servers:

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

Distribution

Via Marketplace

  1. Create marketplace.json in repository
  2. Host on GitHub/GitLab
  3. Users add via /plugin marketplace add
  4. Users install via /plugin install plugin-name@marketplace

Team Configuration

Add to .claude/settings.json:

{
  "extraKnownMarketplaces": {
    "team-plugins": {
      "source": {
        "source": "github",
        "repo": "org/claude-plugins"
      }
    }
  },
  "enabledPlugins": {
    "deploy-tools@team-plugins": true
  }
}

Private Repository Support (2.1.5+)

Distribute plugins via private repositories using authentication tokens:

ProviderEnvironment VariableNotes
GitHubGITHUB_TOKEN or GH_TOKENPAT with repo scope
GitLabGITLAB_TOKEN or GL_TOKENToken with read_repository scope
BitbucketBITBUCKET_TOKENApp password or repo access token

Set in shell config or when running Claude Code:

export GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx

See DISTRIBUTION.md for complete distribution guide.

Workflow: Create a Plugin

Prerequisites

  • Claude Code 1.0.33+ installed
  • Clear purpose for plugin
  • Components identified

Steps

  1. Create Structure

    • Create plugin directory
    • Create .claude-plugin/ subdirectory
    • Create component directories as needed
  2. Create Manifest

    • Add plugin.json with name, description, version
    • Add author and metadata
  3. Add Components

    • Create commands in commands/
    • Create agents in agents/
    • Create skills in skills/*/SKILL.md
    • Configure hooks in hooks/hooks.json
    • Configure MCP in .mcp.json
    • Configure LSP in .lsp.json
  4. Test Locally

    • Run claude --plugin-dir ./my-plugin
    • Test each command
    • Verify agents in /agents
    • Confirm hooks fire correctly
  5. Prepare Distribution

    • Add README.md
    • Create marketplace.json
    • Push to repository

Validation

  • Commands appear with namespace prefix
  • All components load without errors
  • Scripts are executable (chmod +x)
  • Paths use ${CLAUDE_PLUGIN_ROOT}

CLI Commands

# Install plugin
claude plugin install plugin-name@marketplace --scope user

# Uninstall plugin
claude plugin uninstall plugin-name@marketplace

# Enable/disable plugin
claude plugin enable plugin-name@marketplace
claude plugin disable plugin-name@marketplace

# Update plugin
claude plugin update plugin-name@marketplace

# Debug loading
claude --debug

Common Mistakes

MistakeFix
Components inside .claude-plugin/Move to plugin root
Absolute paths in hooksUse ${CLAUDE_PLUGIN_ROOT}
Scripts not executableRun chmod +x script.sh
Missing shebangAdd #!/bin/bash first line
Referencing parent dirsUse symlinks or restructure

Reference Files

FileContents
MANIFEST.mdComplete manifest.json documentation
COMPONENTS.mdAll component type specifications
DISTRIBUTION.mdMarketplace and team distribution

GitHub Repository

majiayu000/claude-skill-registry
Path: skills/creating-plugins

Related Skills

content-collections

Meta

This skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.

View skill

creating-opencode-plugins

Meta

This skill provides the structure and API specifications for creating OpenCode plugins that hook into 25+ event types like commands, files, and LSP operations. It offers implementation patterns for JavaScript/TypeScript modules that intercept and extend the AI assistant's lifecycle. Use it when you need to build event-driven plugins for monitoring, custom handling, or extending OpenCode's capabilities.

View skill

sglang

Meta

SGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.

View skill

evaluating-llms-harness

Testing

This Claude Skill runs the lm-evaluation-harness to benchmark LLMs across 60+ standardized academic tasks like MMLU and GSM8K. It's designed for developers to compare model quality, track training progress, or report academic results. The tool supports various backends including HuggingFace and vLLM models.

View skill