Skip to content
BENIBIX Learn

CLAUDE_PLUGIN_ROOT

AI⌨️ Claude CodeConfiguration

Also known as ${CLAUDE_PLUGIN_ROOT}

The path to the folder a plugin is in, for its hooks.

Think of it like

It is like a label on a toolbox. It says where the box is kept.

Example

Jack ships a plugin with a format script. Its hook calls the script through CLAUDE_PLUGIN_ROOT, so it works on every user's machine.

Why it matters

Each user installs the plugin in a different place. This finds it.

Definition

CLAUDE_PLUGIN_ROOT is a variable that holds the folder a plugin is put in. A plugin's hooks use it to find the scripts that ship with it, wherever it was put. That folder can change when the plugin updates. For data that must last, such as packages, use CLAUDE_PLUGIN_DATA. That is the plugin's own data folder.

Example code

json
{
  "type": "command",
  "command": "\"${CLAUDE_PLUGIN_ROOT}\"/scripts/format.sh"
}
Run a script that ships with the plugin.

Common mistake

Saving data next to the scripts. An update can swap that folder out. Keep data in the data folder.

Key takeaways

  1. 1
    The plugin's folder. Where installed.
  2. 2
    For bundled scripts. In hooks.
  3. 3
    Data goes elsewhere. PLUGIN_DATA.

Compare