Skip to main content
πŸ’‘ create claude pluginπŸ’‘ plugin.jsonπŸ’‘ claude plugin create

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"
}
}
FieldRequiredDescription
nameYesUnique 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 β†’ Ready
  • Validation passed with warnings β†’ Loads, but fails with --strict
  • Validation 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" }
}
}
}
LSP Requirements

The required binary (e.g., gopls) must be installed on the user's system.

λ§€λ‹ˆνŽ˜μŠ€νŠΈ μ£Όμš” ν•„λ“œβ€‹

Key fields available in plugin.json:

FieldDescription
defaultEnabledWhen true (default), enabled immediately upon installation
dependenciesList of other plugins this plugin depends on
userConfigPrompts users for configuration values upon installation
skillsAdditional directories to scan beyond skills/
commandsOverrides default commands/ or provides inline commands
hooksAdditional 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
Cost Awareness

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.

λ‹€μŒ 단계​

이 챕터λ₯Ό μ™„λ£Œν•˜μ…¨λ‚˜μš”?

ν•™μŠ΅ 진도λ₯Ό μ²΄ν¬ν•˜μ—¬ λ‚˜μ˜ λ‘œλ“œλ§΅ 달성λ₯ μ„ λ†’μ—¬λ³΄μ„Έμš”.