Skip to content

CodeBuddy Plugin Reference

Overview

The CodeBuddy plugin system allows you to extend the AI assistant's functionality through a standardized plugin mechanism. Plugins can provide custom commands, agents, skills, hooks, MCP servers, and LSP servers.


I. Plugin Component Reference

Plugins can provide six types of components:

1. Commands

Location: commands/ directory in the plugin root Format: Markdown files with frontmatter

Functionality:

  • Add custom slash commands
  • Seamlessly integrate with the CodeBuddy command system

Frontmatter Configuration:

markdown
---
description: Command description
allowed-tools: Read,Write,Bash
argument-hint: Argument hint
model: Model ID or name to use
---

Command prompt content

Command File Organization:

  • Supports nested subdirectory organization
  • Subdirectory paths are converted to command names using colon separators
  • Example: commands/deploy/production.md → command name deploy:production

2. Agents

Location: agents/ directory in the plugin root Format: Markdown files with frontmatter

Frontmatter Configuration:

markdown
---
name: Agent name (optional, defaults to filename)
description: Agent description
model: Model ID or name to use
tools: Read,Write,Bash (comma-separated list of available tools)
color: #FF5733 (agent display color, optional)
---

Agent instruction content

Features:

  • Agents can be invoked as tools by the main agent
  • Support custom tool lists
  • Automatically generate source tags to identify origin

3. Skills

Location: skills/ directory in the plugin root Format: Each skill is a subdirectory containing a SKILL.md file

Directory Structure:

skills/
├── pdf-processor/
│   ├── SKILL.md
│   ├── reference.md (optional)
│   └── scripts/ (optional)
└── code-reviewer/
    └── SKILL.md

SKILL.md Frontmatter Configuration:

markdown
---
name: Skill name (optional, defaults to directory name)
description: Skill description
allowed-tools: Read,Write,Bash (list of allowed tools)
---

Skill instruction content

Features:

  • Skills can include auxiliary files and scripts
  • The skill's baseDirectory points to the skill directory, allowing access to resource files in the same directory

4. Hooks

Location: hooks/hooks.json in the plugin root, or configured via PluginInfo extension fields in plugin.jsonFormat: JSON configuration containing event matchers and actions

Configuration Example:

json
{
  "PostToolUse": [
    {
      "matcher": "Write|Edit",
      "hooks": [
        {
          "type": "command",
          "command": "${CODEBUDDY_PLUGIN_ROOT}/scripts/format-code.sh",
          "timeout": 30000
        }
      ]
    }
  ]
}

Available Events:

  • PreToolUse: Triggered before tool use
  • PostToolUse: Triggered after tool use
  • UserPromptSubmit: Triggered when user submits a prompt
  • Notification: Triggered when sending a notification
  • Stop: Triggered when attempting to stop
  • SubagentStop: Triggered when sub-agent attempts to stop
  • SessionStart: Triggered at session start
  • SessionEnd: Triggered at session end
  • PreCompact: Triggered before conversation history compression

Hook Types:

  • command: Execute a shell command or script

Matcher Rules:

  • Supports regex matching for tool names
  • Example: "Write|Edit" matches Write or Edit tools

5. MCP Servers

Location:

  • .mcp.json configuration file in the plugin root
  • Or configured via PluginInfo extension fields in plugin.json

Configuration Example (.mcp.json):

json
{
  "mcpServers": {
    "plugin-database": {
      "command": "${CODEBUDDY_PLUGIN_ROOT}/servers/db-server",
      "args": ["--config", "${CODEBUDDY_PLUGIN_ROOT}/config.json"],
      "env": {
        "DB_PATH": "${CODEBUDDY_PLUGIN_ROOT}/data"
      }
    },
    "plugin-api-client": {
      "command": "npx",
      "args": ["@company/mcp-server", "--plugin-mode"],
      "cwd": "${CODEBUDDY_PLUGIN_ROOT}"
    }
  }
}

Integration Behavior:

  • MCP servers automatically start when the plugin is enabled
  • Servers appear as standard MCP tools in the toolkit
  • Server functionality seamlessly integrates with existing tools

6. LSP Servers

Tip: Need to use an LSP plugin? Install from the official marketplace—search for "lsp" in the /plugin Discover tab. This section describes how to create LSP plugins for languages not covered by the official marketplace.

Plugins can provide Language Server Protocol (LSP) servers to give the AI assistant real-time code intelligence support when working on codebases.

LSP integration provides:

  • Instant diagnostics: AI assistant sees errors and warnings immediately after each edit
  • Code navigation: Jump to definition, find references, and hover information
  • Language awareness: Type information and documentation for code symbols

Location: .lsp.json file in the plugin root, or inline configuration in plugin.json

Format: JSON configuration mapping language server names to their configurations

.lsp.json File Format:

json
{
  "go": {
    "command": "gopls",
    "args": ["serve"],
    "extensionToLanguage": {
      ".go": "go"
    }
  }
}

Inline Configuration in plugin.json:

json
{
  "name": "my-plugin",
  "lspServers": {
    "go": {
      "command": "gopls",
      "args": ["serve"],
      "extensionToLanguage": {
        ".go": "go"
      }
    }
  }
}

Required Fields:

FieldDescription
commandThe LSP binary to execute (must be in PATH)
extensionToLanguageMaps file extensions to language identifiers

Optional Fields:

FieldDescription
argsCommand-line arguments for the LSP server
transportCommunication transport: stdio (default) or socket
envEnvironment variables to set when starting the server
initializationOptionsOptions passed to the server during initialization
settingsSettings passed via workspace/didChangeConfiguration
workspaceFolderWorkspace folder path for the server
startupTimeoutMaximum time to wait for server startup (milliseconds)
shutdownTimeoutMaximum time to wait for graceful shutdown (milliseconds)
restartOnCrashWhether to automatically restart when the server crashes
maxRestartsMaximum restart attempts before giving up
loggingConfigDebug logging configuration (see below)

Warning: You must install the language server binary separately. LSP plugins configure how CodeBuddy connects to a language server but do not include the server itself. If you see Executable not found in $PATH errors in the /plugin Errors tab, install the required binary for your language.

Available LSP Plugins:

PluginLanguage ServerInstallation Command
pyright-lspPyright (Python)pip install pyright or npm install -g pyright
typescript-lspTypeScript Language Servernpm install -g typescript-language-server typescript
rust-lsprust-analyzerSee rust-analyzer installation

Install the language server first, then install the plugin from the marketplace.


II. Plugin Manifest Schema (plugin.json)

Complete Schema Example

json
{
  "name": "plugin-name",
  "version": "1.2.0",
  "description": "Brief plugin description",
  "author": {
    "name": "Author Name",
    "email": "[email protected]",
    "url": "https://github.com/author"
  },
  "homepage": "https://docs.example.com/plugin",
  "repository": "https://github.com/author/plugin",
  "license": "MIT",
  "keywords": ["keyword1", "keyword2"],
  "category": "Development Tools",
  "features": ["Feature 1", "Feature 2"],
  "requirements": {
    "node": ">=16.0.0"
  },
  "commands": ["./custom/commands/special.md"],
  "agents": "./custom/agents/",
  "hooks": "./config/hooks.json",
  "mcpServers": [
    {
      "name": "custom-server",
      "command": "node",
      "args": ["./servers/custom.js"],
      "env": {
        "SERVER_PORT": "3000"
      }
    }
  ],
  "lspServers": "./.lsp.json"
}

Required Fields

FieldTypeDescriptionExample
namestringUnique identifier (kebab-case, no spaces)"deployment-tools"
descriptionstringBrief plugin purpose"Deployment automation tools"

Metadata Fields

FieldTypeDescriptionExample
versionstringSemantic version"2.1.0"
authorobjectAuthor information{"name": "Dev Team", "email": "[email protected]"}
homepagestringDocumentation URL"https://docs.example.com"
repositorystringSource code URL"https://github.com/user/plugin"
licensestringLicense identifier"MIT", "Apache-2.0"
keywordsarrayDiscovery tags["deployment", "ci-cd"]
categorystringPlugin category"Development Tools"
featuresarrayFeature list["Auto-deployment", "Log analysis"]

Component Path Fields (PluginManifest)

FieldTypeDescriptionExample
commandsstring / string[]Additional command file path array["./custom/cmd.md"]
agentsstring / string[]Additional agent file directory path"./custom/agents/"
hooksstring / objectAdditional hook file or configuration"./custom/hooks.json"
mcpServersstring / Record<string,MCPServerConfig>MCP server config file path or config objectSee MCPServerConfig below
lspServersstring / objectLanguage Server Protocol configuration for code intelligence (jump to definition, find references, etc.)"./.lsp.json"

MCPServerConfig Structure

typescript
{
  "name": "Server name",
  "command": "Execution command",
  "args": ["Array of command arguments"],
  "env": {
    "ENVIRONMENT_VARIABLE": "value"
  }
}

Runtime Extension Fields (PluginInfo)

Plugins extend the following fields at runtime, supporting more flexible configuration:

FieldTypeDescriptionExample
agentsstring[]Agent file or directory paths["./custom/agents/"]
commandsstring[]Command file or directory paths["./custom/commands/"]
skillsstring[]Skill file or directory paths["./custom/skills/"]
hooksRecord<string, any> | stringHook configuration object or file path"./hooks/custom.json"
mcpServersRecord<string, McpConfig> | stringMCP configuration object or file path"./mcp-config.json"
lspServersRecord<string, LspConfig> | stringLSP configuration object or file path"./.lsp.json"

Note:

  • These extension fields are used in marketplace.json to configure how plugins are loaded
  • Support for direct configuration objects or file path strings
  • The loader intelligently merges configured paths with default directory scanning results

Path Behavior Rules

Important: Custom paths are supplementary to default directories, not replacements.

  • If the commands/ directory exists, it will be loaded along with custom command paths
  • All paths must be relative to the plugin root and begin with ./
  • Multiple paths can be specified as arrays for flexibility
  • Paths can point to individual files or directories

Path Resolution Rules:

  • File paths: Must end with .md (for commands/agents) or be SKILL.md (for skills)
  • Directory paths: Recursively scans the directory for all qualifying files

Environment Variables

${CODEBUDDY_PLUGIN_ROOT}: Contains the absolute path to the plugin directory. Use this variable in hooks, MCP servers, and scripts to ensure correct paths regardless of installation location.

Compatibility: Also supports the ${CLAUDE_PLUGIN_ROOT} variable name for compatibility with Claude Code plugins.

json
{
  "hooks": {
    "PostToolUse": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "${CODEBUDDY_PLUGIN_ROOT}/scripts/process.sh"
          }
        ]
      }
    ]
  }
}

III. Plugin Directory Structure

Standard Plugin Layout

enterprise-plugin/
├── .codebuddy-plugin/       # Metadata directory
│   └── plugin.json          # Required: Plugin manifest
├── commands/                # Default commands location
│   ├── status.md
│   └── logs.md
├── agents/                  # Default agents location
│   ├── security-reviewer.md
│   ├── performance-tester.md
│   └── compliance-checker.md
├── skills/                  # Agent skills
│   ├── code-reviewer/
│   │   └── SKILL.md
│   └── pdf-processor/
│       ├── SKILL.md
│       └── scripts/
├── hooks/                   # Hook configuration
│   └── hooks.json           # Hook configuration file
├── .mcp.json               # MCP server definitions
├── .lsp.json               # LSP server configuration
├── scripts/                # Hooks and utility scripts
│   ├── security-scan.sh
│   ├── format-code.py
│   └── deploy.js
├── LICENSE                 # License file
└── README.md               # Plugin documentation

Important:

  • The .codebuddy-plugin/ or .claude-plugin/ directory contains the plugin.json file
  • All other directories (commands/, agents/, skills/, hooks/) must be located in the plugin root
  • The system prioritizes .codebuddy-plugin/ while also supporting .claude-plugin/ for compatibility

File Location Reference

ComponentDefault LocationPurpose
Manifest.codebuddy-plugin/plugin.jsonRequired metadata file
Commandscommands/Slash command markdown files
Agentsagents/Sub-agent markdown files
Skillsskills/Agent skills with SKILL.md files
Hookshooks/hooks.jsonHook configuration
MCP servers.mcp.jsonMCP server definitions
LSP servers.lsp.jsonLanguage server configuration

IV. Marketplace Manifest Schema (marketplace.json)

Complete Schema Example

json
{
  "name": "Enterprise Plugin Marketplace",
  "description": "Internal enterprise plugin collection",
  "version": "1.0.0",
  "owner": {
    "name": "Enterprise Development Team",
    "email": "[email protected]"
  },
  "plugins": [
    {
      "name": "deployment-tool",
      "description": "Automated deployment tools",
      "version": "1.0.0",
      "source": "plugins/deployment-tool"
    },
    {
      "name": "code-review-bot",
      "description": "Code review bot",
      "version": "2.1.0",
      "source": {
        "source": "github",
        "repo": "company/code-review-bot"
      }
    },
    {
      "name": "security-scanner",
      "description": "Security scanning tool",
      "version": "1.5.0",
      "source": {
        "source": "url",
        "url": "https://github.com/company/security-scanner.git"
      }
    }
  ]
}

Required Fields

FieldTypeDescriptionExample
namestringMarketplace name"Enterprise Plugin Marketplace"
pluginsarrayPlugin listSee below

Metadata Fields

FieldTypeDescriptionExample
descriptionstringMarketplace description"Internal enterprise plugin collection"
versionstringMarketplace version"1.0.0"
ownerobjectOwner information{"name": "Team", "email": "..."}

Plugin Entry (MarketplacePluginEntry)

Each plugin entry contains the following fields:

FieldTypeRequiredDescription
namestringPlugin unique identifier
descriptionstringPlugin description
versionstringPlugin version number
sourcestring | PluginSourcePlugin source configuration
strictbooleanStrict mode (compatible with superpowers-marketplace)

PluginSource Configuration

Plugin sources support three types:

1. Local Relative Path (string)

json
{
  "source": "plugins/my-plugin"
}

2. Local Path (object)

json
{
  "source": {
    "source": "local",
    "path": "plugins/my-plugin"
  }
}

3. GitHub Repository

json
{
  "source": {
    "source": "github",
    "repo": "owner/repo-name"
  }
}

4. Git URL

json
{
  "source": {
    "source": "url",
    "url": "https://github.com/owner/repo.git"
  }
}

Marketplace Types

CodeBuddy supports four marketplace types:

TypeDescriptionsource Field
DirectoryLocal filesystem directorypath: Absolute local directory path
GithubGitHub repositoryrepo: owner/repo format
GitGit repositoryurl: Git repository URL
URLHTTP/HTTPS remoteurl: URL to marketplace.json

V. Plugin Loading Mechanism

Loading Flow

  1. Marketplace Installation:

    • Install marketplace from configured source
    • Read marketplace.json to get plugin list
  2. Plugin Installation:

    • Select appropriate installer (Local/Git) based on source configuration
    • Install plugin content to target location
  3. Plugin Activation:

    • Read the plugin's plugin.json manifest
    • Load components based on manifest configuration
  4. Component Loading:

    • Concurrently load all types of extension components
    • Merge configured paths with default directory scanning results
    • Cache loaded components for performance

Loader Intelligent Merging

Each extension loader intelligently merges content from two sources:

  1. Configured Paths: Paths specified in plugin.json or runtime configuration
  2. Default Scanning: Files in default directories (e.g., commands/, agents/)

Example:

json
{
  "commands": ["./custom/deploy.md"],
  // Actually loads:
  // - ./custom/deploy.md (configured path)
  // - All .md files in commands/ directory (default scanning)
}

Command Name Generation Rules

  • Filename: command.md → command name: command
  • Subdirectory: deploy/prod.md → command name: deploy:prod
  • Plugin prefix: Automatically adds plugin name as prefix, e.g., plugin-name:command

Agent and Skill Tags

All agents and skills loaded from plugins automatically receive the following tags:

  • Source tag: (plugin-name@marketplace-name)
  • Type tag: plugin
  • Custom tags: custom-agent or custom-command

VI. Debugging and Development Tools

View Plugin Loading Logs

Use the --verbose parameter to view detailed plugin loading information:

bash
codebuddy --verbose

Display Content:

  • Which plugins are being loaded
  • Any errors in plugin manifests
  • Command, agent, and skill registration
  • MCP server initialization
  • Hook configuration loading

Common Troubleshooting

IssueCauseSolution
Plugin not loadedInvalid plugin.jsonValidate JSON syntax, check required fields
Command not appearingIncorrect directory structureEnsure commands/ is in plugin root
Hook not triggeringScript not executableRun chmod +x script.sh
MCP server failsMissing environment variablesUse ${CODEBUDDY_PLUGIN_ROOT}
Path errorsUsing absolute pathsAll paths must be relative and start with ./
Metadata directory not recognizedUsing incorrect directory nameUse .codebuddy-plugin/ or .claude-plugin/
LSP Executable not found in $PATHLanguage server not installedInstall the binary (e.g., npm install -g typescript-language-server typescript)

Plugin Development Best Practices

  1. Use Relative Paths: All file references use relative paths to ensure cross-environment compatibility
  2. Environment Variables: Use ${CODEBUDDY_PLUGIN_ROOT} in scripts to reference the plugin directory
  3. Error Handling: Add appropriate error handling and timeout settings for hook scripts
  4. Complete Documentation: Provide clear installation and usage instructions in README.md
  5. Semantic Versioning: Follow semantic versioning conventions to manage plugin versions
  6. Test Coverage: Test plugin installation and functionality across different environments

VII. Version Management Reference

Semantic Versioning

Follow semantic versioning for plugin releases:

  • MAJOR version: Incompatible API changes
  • MINOR version: Backwards-compatible feature additions
  • PATCH version: Backwards-compatible bug fixes

Example: 1.2.01.2.1 (fix) → 1.3.0 (new feature) → 2.0.0 (breaking change)

Plugin Update Process

  1. Modify plugin code and resources
  2. Update the version field in plugin.json
  3. Record changes in CHANGELOG.md
  4. Commit to version control system
  5. Users update plugin through marketplace

VIII. CLI Command Reference

Marketplace Management

bash
# Add marketplace
codebuddy plugin marketplace add <source> [--name <name>]

# List marketplaces
codebuddy plugin marketplace list

# Update marketplace
codebuddy plugin marketplace update <name>

# Remove marketplace
codebuddy plugin marketplace remove <name>

Plugin Management

bash
# Install plugin
codebuddy plugin install <plugin-name> <marketplace-name>

# List installed plugins
codebuddy plugin list [--marketplace <name>]

# Enable plugin
codebuddy plugin enable <plugin-name> <marketplace-name>

# Disable plugin
codebuddy plugin disable <plugin-name> <marketplace-name>

# Uninstall plugin
codebuddy plugin uninstall <plugin-name> <marketplace-name>

# Update plugin
codebuddy plugin update <plugin-name> <marketplace-name>

Marketplace Source Formats

Supports the following formats for adding marketplaces:

bash
# Local directory
codebuddy plugin marketplace add /path/to/marketplace

# GitHub shorthand
codebuddy plugin marketplace add owner/repo

# Git URL
codebuddy plugin marketplace add https://github.com/owner/repo.git

# HTTP URL (marketplace.json)
codebuddy plugin marketplace add https://example.com/marketplace.json

IX. Compatibility with Claude Code

The CodeBuddy plugin system is designed to be compatible with the Claude Code plugin specification, with the following differences:

Naming Differences

ConceptClaude CodeCodeBuddy
Metadata Directory.claude-plugin/.codebuddy-plugin/ (priority) or .claude-plugin/ (compatible)
Environment Variable${CLAUDE_PLUGIN_ROOT}${CODEBUDDY_PLUGIN_ROOT} (priority) or ${CLAUDE_PLUGIN_ROOT} (compatible)

Extended Features

CodeBuddy provides the following extensions over Claude Code:

  1. Runtime Configuration: PluginInfo supports runtime extension field configuration
  2. Multiple Metadata Directories: Supports both .codebuddy-plugin/ and .claude-plugin/
  3. Flexible Configuration: Supports both configuration objects and file path configuration methods

Migration Guide

Migrating from Claude Code to CodeBuddy:

  1. Optionally rename .claude-plugin/ to .codebuddy-plugin/
  2. Optionally replace ${CLAUDE_PLUGIN_ROOT} with ${CODEBUDDY_PLUGIN_ROOT} in scripts
  3. If using the mcpServers field, no changes needed (already uses mcpServers)

Note: Keeping the original naming is fully compatible; CodeBuddy will automatically recognize it.


  • Plugin Development Tutorial - How to create custom plugins
  • Marketplace Creation Guide - Creating and managing plugin marketplaces
  • Hooks Deep Dive - Event handling and automation
  • MCP Integration Documentation - External tool integration
  • Settings Configuration - Plugin configuration options

Summary

This document provides the complete technical specification for the CodeBuddy plugin system, covering:

  1. Six plugin component types (Commands, Agents, Skills, Hooks, MCP Servers, LSP Servers)
  2. Complete plugin.json manifest schema and field descriptions
  3. marketplace.json marketplace manifest schema
  4. Standard directory structure and file locations
  5. Plugin loading mechanism and intelligent merging rules
  6. CLI commands and debugging tools
  7. Version management best practices
  8. Compatibility notes with Claude Code

Developers can use this reference document to create fully-featured, well-structured CodeBuddy plugins.