Anatomy of Plugins
Plugin anatomy, types, security, and distribution patterns.

Package, distribute, and standardize your Claude Code superpowers across teams and repos.
TL;DRโ
- A plugin bundles skills + commands + hooks + agents + templates + docs into one shareable unit.
- Distributed via npm, Git, or your internal registry.
- Versioned with SemVer; installs with one command.
- Best for org-wide standards and community packs.
Why this mattersโ
Plugins are App Store apps for your AI workflow. Instead of every repo reinventing hooks and skills, install a plugin and inherit a proven setup.
Bottom line: Plugins turn local hacks into reusable assets.
The Big Pictureโ
Bottom line: Bundle once, install everywhere.
Plugin Structureโ
plugins/my-plugin/
โโโ manifest.json # Plugin metadata
โโโ README.md # Overview & setup
โโโ skills/
โ โโโ code-review/ # Bundled skills
โโโ commands/
โ โโโ review.md # Slash commands
โโโ hooks/
โ โโโ pre-tool.sh
โ โโโ post-tool.sh # Hook scripts
โโโ agents/
โ โโโ code-reviewer.yml
โโโ templates/
โ โโโ pr-template.md
โโโ scripts/
โโโ install.sh
โโโ post-install.sh
โโโ uninstall.sh
manifest.json Exampleโ
{
"name": "acme-dev-tools",
"version": "1.2.0",
"description": "Essential dev tools for Claude Code at Acme",
"author": "Acme Engineering",
"license": "MIT",
"category": "developer-tools",
"dependencies": {
"claude-code": ">=0.6.0"
},
"includes": {
"skills": ["code-review", "test-writer"],
"commands": ["review", "deploy"],
"hooks": ["pre-tool", "post-tool"],
"agents": ["code-reviewer"]
},
"hooks": {
"install": "./scripts/install.sh",
"post_install": "./scripts/post-install.sh",
"uninstall": "./scripts/uninstall.sh"
}
}
Step-by-Step Setupโ
1. Scaffold the pluginโ
mkdir -p plugins/my-plugin/{skills,commands,hooks,agents,templates,scripts}
touch plugins/my-plugin/{manifest.json,README.md}
2. Write manifest.json (see example above)โ
3. Add the install scriptโ
cat > plugins/my-plugin/scripts/install.sh <<'EOF'
#!/usr/bin/env bash
echo "Installing my-plugin..."
mkdir -p .claude/commands
cp -r commands/* .claude/commands/
chmod +x hooks/*.sh
echo "โ
Done!"
EOF
chmod +x plugins/my-plugin/scripts/install.sh
4. Publish (one of):โ
# npm
npm publish
# Private Git registry
git tag v1.2.0 && git push --tags
5. Install in another repoโ
claude plugin install acme-dev-tools
Variants for Different Team Settingsโ
๐ค Soloโ
Keep plugins as local folders; no publishing needed.
๐ฅ Small teamโ
Host on a private GitHub repo + tag releases.
claude plugin install github:acme/my-plugin#v1.2.0
๐ข Enterpriseโ
- Private npm registry (Verdaccio / Artifactory).
- Sign packages & verify SHA before install.
- Pin versions in every repo's
.claude/plugins.json. - Run plugin install in CI to catch drift.
๐ Open-sourceโ
- Publish on npm with clear README.
- Provide a demo repo showing usage.
- Use SemVer; document breaking changes.
Bottom line: Same package, escalating distribution rigor.
Publishing Checklistโ
- โ
manifest.jsonis valid - โ
README.mdwith clear setup - โ No secrets in any file
- โ All paths are relative
- โ Version follows SemVer
- โ License included
- โ Tested in clean environment
Example: Simple Plugin (skeleton)โ
my-plugin/
โโโ manifest.json
โโโ README.md
โโโ commands/
โ โโโ review.md
โโโ hooks/
โ โโโ pre-tool.sh
โโโ scripts/
โโโ install.sh
scripts/install.sh:
#!/usr/bin/env bash
echo "Installing my-plugin..."
mkdir -p .claude/commands
cp -r commands/* .claude/commands/
chmod +x hooks/*.sh
echo "โ
Done!"
Common Plugin Use Casesโ
| Use case | What it bundles |
|---|---|
| Team standards | Shared CLAUDE.md, hooks, conventions |
| Security guardrails | Pre-commit secret scans, audit hooks |
| Automation pipelines | CI/CD scripts, deploy commands |
| Domain workflows | E.g. healthcare HIPAA checks |
| Starter kits / templates | Boilerplate for a new service |
| Organization toolbox | Catch-all of common helpers |
Common Patterns & Recipesโ
Pattern 1 โ Idempotent installโ
[ -d .claude/commands ] || mkdir -p .claude/commands
cp -n commands/* .claude/commands/ # -n = no clobber
Pattern 2 โ Plugin with auto-updateโ
"hooks": { "update": "./scripts/update.sh" }
Pattern 3 โ Plugin compositionโ
"dependencies": {
"@acme/security-pack": "^1.0.0",
"@acme/devops-pack": "^2.0.0"
}
Pattern 4 โ Uninstall safelyโ
rm -rf .claude/commands/{review,deploy}.md
echo "โ
Cleaned up."
Best Practices โ โ
- Bundle only what you need.
- Pin compatible versions.
- Make install idempotent.
- Document everything.
- Test in a clean environment before publishing.
- SemVer religiously.
Anti-Patterns โโ
- Plugins that silently overwrite user files.
- Hard-coded absolute paths.
- Secrets baked into the manifest.
- No uninstall script.
- Mixing unrelated capabilities into one "kitchen-sink" plugin.
Troubleshootingโ
| Symptom | Cause | Fix |
|---|---|---|
| Install fails | Missing dependency | Check manifest.json deps |
| Files not appearing | Wrong relative path | Use ./ everywhere |
| Conflicts with existing config | No conflict check | Use cp -n or merge logic |
| Breaks on update | Non-SemVer bump | Tag a major version |
| Can't uninstall | No uninstall.sh | Add one; list every file created |
Starter Templateโ
{
"name": "my-plugin",
"version": "0.1.0",
"description": "What it does",
"includes": { "skills": [], "commands": [], "hooks": [] },
"hooks": { "install": "./scripts/install.sh" }
}
๐ก Tip: Ship value fast. Iterate based on adoption.
Glossaryโ
- Plugin โ A bundled, distributable Claude Code extension.
- Manifest โ
manifest.jsondescribing the plugin. - SemVer โ Semantic Versioning (
MAJOR.MINOR.PATCH). - Idempotent โ Safe to run multiple times with same result.
Further Readingโ
- Search: "Claude Code plugins documentation"
- Search: "npm publish private registry"
- Search: "SemVer specification"