Creating Custom Plugins
Package your .claude/ settings into a plugin when you want to share them with team members or deploy them across multiple repositories. This guide walks you through building your first plugin from scratch and migrating existing configurations.
첫 λ²μ§Έ νλ¬κ·ΈμΈ λ§λ€κΈ°β
The simplest example: a plugin with a single skill.
1. λλ ν 리μ λ§€λνμ€νΈ μμ±β
mkdir -p my-first-plugin/.claude-plugin
Create my-first-plugin/.claude-plugin/plugin.json:
{
"name": "my-first-plugin",
"description": "Basic example plugin",
"version": "1.0.0",
"author": {
"name": "Team Name"
}
}
| Field | Required | Description |
|---|---|---|
name | Yes | Unique identifier; also serves as skill namespace |
description | - | Summary displayed in the /plugin view |
version | - | Pins the plugin to this version on updates |
author.name | - | Author name for display |
2. μ€ν¬ μΆκ°β
mkdir -p my-first-plugin/skills/hello
my-first-plugin/skills/hello/SKILL.md:
---
name: hello
description: Greet the user warmly
disable-model-invocation: true
---
Greet the user warmly and ask how you can assist them today.
With disable-model-invocation: true, Claude will not invoke this skill autonomously; the user triggers it manually via /my-first-plugin:hello.
3. μ ν¨μ± κ²μ¬β
claude plugin validate ./my-first-plugin
Validation messages:
Validation passedβ ReadyValidation passed with warningsβ Loads, but fails with--strictValidation failedβ Fix required
4. ν μ€νΈ μ€νβ
Load into a single session without registering a marketplace:
claude --plugin-dir ./my-first-plugin
Inside the session:
/my-first-plugin:hello
--plugin-dir applies only to the current session and does not write to settings files.
νλ¬κ·ΈμΈ λ μ΄μμβ
my-plugin/
βββ .claude-plugin/
β βββ plugin.json # Manifest
βββ skills/ # Skills (SKILL.md files)
βββ commands/ # Legacy commands (.md files; skills/ recommended for new)
βββ agents/ # Subagents (.md files)
βββ hooks/
β βββ hooks.json # Hook handlers
βββ .mcp.json # MCP server configuration
βββ .lsp.json # LSP server configuration
μ»΄ν¬λνΈ ν¨ν€μ§β
Agentsβ
Place Markdown files under agents/:
---
name: security-reviewer
description: Security audit specialist agent
tools: Read, Grep, Glob
model: sonnet
---
Inspect for vulnerabilities based on OWASP Top 10 standards.
Agent names are also namespaced: my-plugin:security-reviewer
Hooksβ
Define event handlers in hooks/hooks.json:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "jq -r '.tool_input.file_path' | xargs npm run lint:fix"
}
]
}
]
}
}
MCP μλ²β
Create .mcp.json at the plugin root or define servers inline in plugin.json:
{
"mcpServers": {
"deploy-api": {
"command": "node",
"args": ["${CLAUDE_PLUGIN_ROOT}/server.js"]
}
}
}
${CLAUDE_PLUGIN_ROOT} automatically resolves to the absolute install path of the plugin.
LSP μλ² (μ½λ μΈν 리μ μ€)β
Bundle language servers for code intelligence:
{
"lspServers": {
"go": {
"command": "gopls",
"args": ["serve"],
"extensionToLanguage": { ".go": "go" }
}
}
}
The required binary (e.g., gopls) must be installed on the user's system.
λ§€λνμ€νΈ μ£Όμ νλβ
Key fields available in plugin.json:
| Field | Description |
|---|---|
defaultEnabled | When true (default), enabled immediately upon installation |
dependencies | List of other plugins this plugin depends on |
userConfig | Prompts users for configuration values upon installation |
skills | Additional directories to scan beyond skills/ |
commands | Overrides default commands/ or provides inline commands |
hooks | Additional hook configs beyond hooks/hooks.json |
μ¬μ©μ μ€μ (userConfig)β
Prompt users for values during installation:
{
"userConfig": {
"api_token": {
"type": "string",
"title": "API Token",
"description": "Authentication token for the deployment API",
"sensitive": true
}
}
}
Setting sensitive: true masks input and stores it securely in system credential storage. Reference it in skills and agents as ${user_config.api_token}.
Evalλ‘ νλ¬κ·ΈμΈ λμ κ²μ¦ (v2.1.269+)β
Validate plugin behavior automatically with claude plugin eval:
# Initialize eval cases interactively
claude plugin eval init
# Run full evaluation (default 3 runs)
claude plugin eval .
# Fail CI if score is below threshold
claude plugin eval . --threshold 0.8 --ci
Evals trigger real model invocations. Use -n to preview expected costs before executing.
κΈ°μ‘΄ .claude/ μ€μ μ νλ¬κ·ΈμΈμΌλ‘ λ³νβ
Migrate existing project-level .claude/ Skills, Hooks, and MCP settings directly into a plugin:
# 1. Create plugin structure
mkdir -p my-plugin/.claude-plugin
# 2. Copy components
cp -r .claude/commands my-plugin/
cp -r .claude/agents my-plugin/
cp -r .claude/skills my-plugin/
Move the hooks object from configuration into my-plugin/hooks/hooks.json.
Test the conversion:
claude --plugin-dir ./my-plugin
Verify skills with namespaced prefixes (e.g., /my-plugin:deploy). Once verified, remove original .claude/ files.
νλ¬κ·ΈμΈ μ΄κΈ°ν μ€μΊν΄λβ
# Scaffold plugin under ~/.claude/skills/ (v2.1.157+)
claude plugin init my-tool
# Scaffold with skills structure included
claude plugin init my-tool --with skills
Plugins under ~/.claude/skills/ load automatically in all sessions without manual installation.
λ€μ λ¨κ³β
μ΄ μ±ν°λ₯Ό μλ£νμ ¨λμ?
νμ΅ μ§λλ₯Ό 체ν¬νμ¬ λμ λ‘λλ§΅ λ¬μ±λ₯ μ λμ¬λ³΄μΈμ.