What are plugins?
Plugins are packages of Claude Code extensions that can include:- Commands: Custom slash commands
- Agents: Specialized subagents for specific tasks
- Skills: Model-invoked capabilities that Claude uses autonomously
- Hooks: Event handlers that respond to tool use and other events
- MCP servers: External tool integrations via Model Context Protocol
Loading plugins
Load plugins by providing their local file system paths in your options configuration. The SDK supports loading multiple plugins from different locations.Path specifications
Plugin paths can be:- Relative paths: Resolved relative to your current working directory (e.g.,
"./plugins/my-plugin") - Absolute paths: Full file system paths (e.g.,
"/home/user/plugins/my-plugin")
The path should point to the plugin’s root directory (the directory containing
.claude-plugin/plugin.json).Verifying plugin installation
When plugins load successfully, they appear in the system initialization message. You can verify that your plugins are available:Using plugin commands
Commands from plugins are automatically namespaced with the plugin name to avoid conflicts. The format isplugin-name:command-name.
If you installed a plugin via the CLI (e.g.,
/plugin install my-plugin@marketplace), you can still use it in the SDK by providing its installation path. Check ~/.claude/plugins/ for CLI-installed plugins.Complete example
Here’s a full example demonstrating plugin loading and usage:Plugin structure reference
A plugin directory must contain a.claude-plugin/plugin.json manifest file. It can optionally include:
- Plugins - Complete plugin development guide
- Plugins reference - Technical specifications and schemas
Common use cases
Development and testing
Load plugins during development without installing them globally:Project-specific extensions
Include plugins in your project repository for team-wide consistency:Multiple plugin sources
Combine plugins from different locations:Troubleshooting
Plugin not loading
If your plugin doesn’t appear in the init message:- Check the path: Ensure the path points to the plugin root directory (containing
.claude-plugin/) - Validate plugin.json: Ensure your manifest file has valid JSON syntax
- Check file permissions: Ensure the plugin directory is readable
Commands not available
If plugin commands don’t work:- Use the namespace: Plugin commands require the
plugin-name:command-nameformat - Check init message: Verify the command appears in
slash_commandswith the correct namespace - Validate command files: Ensure command markdown files are in the
commands/directory
Path resolution issues
If relative paths don’t work:- Check working directory: Relative paths are resolved from your current working directory
- Use absolute paths: For reliability, consider using absolute paths
- Normalize paths: Use path utilities to construct paths correctly
See also
- Plugins - Complete plugin development guide
- Plugins reference - Technical specifications
- Slash Commands - Using slash commands in the SDK
- Subagents - Working with specialized agents
- Skills - Using Agent Skills