What Claude Code plugin executables are
Claude Code plugin executables are the files in a plugin's bin/ folder. While the plugin is enabled, Claude Code adds that folder to the PATH of the shell the Bash tool runs commands in. Claude, or a skill's instructions, can then run the tool by name, the same way it runs git or npm, and the person who installed the plugin never installs anything else.
This is how a plugin ships a command-line tool. A reporting plugin can carry a report command that pulls numbers and prints a summary. A deploy plugin can carry a check command that tells Claude whether a branch is safe to ship. The tool travels with the plugin, updates with the plugin and disappears when the plugin is disabled.
It works in any Claude Code session that has the plugin enabled, whether you use the desktop app or the terminal. The one place it does not work is covered at the end: claude.ai and Cowork will not install a plugin with a top-level bin/ folder.
Add an executable to your plugin in three steps
- Create the file. Save a script at bin/<name> in the plugin root, with a shebang on the first line. The smallest example is a bash script named hello-plugin that starts with #!/bin/bash and runs echo "hello from my-plugin".
- Make it executable. Run chmod +x bin/hello-plugin. If the plugin lives in git, commit the file with its executable bit, because git records it. On Windows, git update-index --chmod=+x bin/hello-plugin sets it in the index.
- Load the plugin and ask Claude to run it. Ask Claude to run hello-plugin. The Bash tool result shows the script's output, which is how you know Claude found it on the PATH.
There is no manifest key to register the tool. The folder location is the whole contract: anything executable in bin/ at the plugin root is on the PATH while the plugin is enabled.
How plugin executables behave
The rules for files in a plugin's bin/ folder
| Question | Answer |
|---|---|
| Where does the file go? | bin/ at the plugin root |
| When is it on the PATH? | While the plugin is enabled |
| Which tool finds it? | The Bash tool's shell. Claude runs it as a bare command |
| Can it shadow a system command? | No. Plugin bin/ folders come after the user's own PATH entries, so git, ls and the user's own tools always win |
| Does the PowerShell tool find it? | Yes when the PowerShell command runs outside the sandbox. A sandboxed PowerShell command does not |
| Are CLAUDE_PLUGIN_ROOT and CLAUDE_PLUGIN_DATA set? | No. The plugin path variables are not in the environment of commands Claude runs through the Bash tool |
| Does claude.ai or Cowork install it? | No. They don't install a plugin that has a top-level bin/ directory |
The variables row is the one that catches people. Hooks, MCP servers and LSP servers receive CLAUDE_PLUGIN_ROOT and CLAUDE_PLUGIN_DATA in their environment. A bin/ tool runs as an ordinary Bash tool command, so it does not. If your tool reads $CLAUDE_PLUGIN_ROOT to find its own files, it works when you test it from a hook and fails when Claude runs it.
Write the tool so it works from any folder
A bin/ tool runs in the session's working directory, usually the user's project, not in the plugin folder. These are the rules I follow so the tool behaves the same everywhere.
- Find your own files from the script's location. In bash, resolve the directory of the script itself and build paths from there. Do not depend on the current directory or on plugin variables that are not set.
- Keep state out of the plugin folder. The plugin root changes when the plugin updates, so anything the tool writes there can disappear. Write to the project, to a path the user configures, or to a location the user can see.
- Print short, plain output. Whatever the tool prints lands in Claude's context as the Bash tool result. A one-screen summary is more useful to Claude than a wall of logs, and it costs less context.
- Use exit codes properly. Exit 0 on success and non-zero on failure, with the reason on stderr, so Claude can tell a failed check from a passing one without parsing text.
- Add a --help flag. Claude can run your-tool --help to learn the options instead of guessing them.
Then tell Claude when to use it. A skill in the same plugin is the natural place: its instructions can say to run acme-report before writing the weekly update. Inside skill content, ${CLAUDE_PLUGIN_ROOT} is substituted inline when the skill loads, so the skill can also point Claude at a file in the plugin if the tool needs one passed in as an argument.
bin/, scripts/, MCP server or hook: which one to use
Choosing where a plugin's code runs
| Use | When the job is | How it runs |
|---|---|---|
| bin/ executable | A command Claude should run on request and read the output of | Claude calls it by name through the Bash tool |
| scripts/ file | Code only your hooks, skills or MCP config call, or a plugin you distribute through claude.ai | Referenced by path, ${CLAUDE_PLUGIN_ROOT}/scripts/<name> |
| MCP server | Structured tools with typed inputs, often talking to an outside system | Claude Code starts it and lists its tools in /mcp |
| Hook | Something that must happen automatically on an event, such as after every edit | Fires on its event whether or not Claude decides to |
My default: if I would type the command myself in a terminal and read what it prints, it belongs in bin/. If it needs typed inputs, auth to an outside API or a long-running connection, it is an MCP server. If it must run every time without anyone asking, it is a hook. For the hook side, Claude Code hooks covers the events.
What a bin/ file means for the people installing your plugin
A bin/ tool runs with the user's own privileges, like any other command Claude runs through the Bash tool. That is the reason it is useful and the reason reviewers read it. When I review someone else's plugin, a compiled binary in bin/ with no source next to it is the first thing I ask about.
- Ship readable scripts where you can. A reviewer can read a bash, Python or Node script in a minute. A binary needs a source link and a build they can reproduce.
- Keep network calls obvious. If the tool calls an outside service, say so in the README and in --help.
- Pin anything the tool installs. If it needs dependencies, see Claude Code plugin dependencies for how plugins handle them.
Because it runs as a Bash tool call, the user's permission settings still decide whether Claude can run it without asking. Your tool does not get a way around their prompts, and it should not need one.
The claude.ai and organization sync rule
If your plugin will be distributed through claude.ai organization settings, do not include a top-level bin/ directory. claude.ai rejects a plugin that has one, whether it arrives by marketplace sync or by direct upload, and the error message starts with Plugin contains a top-level bin/ directory. On a marketplace sync, only that plugin is rejected and the rest of the marketplace still syncs, so it is easy to miss.
The fix is to move the executables into another folder, such as scripts/, and reference them as ${CLAUDE_PLUGIN_ROOT}/scripts/<name> from your skills, hooks or MCP server configs. You lose the bare command name, but the plugin installs everywhere. For a plugin that only ever runs in Claude Code, bin/ is the cleaner choice.
Short, practical drops on skills, MCP, agents, prompts, and more. No spam, unsubscribe anytime.
Frequently asked questions
How do I add an executable to a Claude Code plugin?
Save the script at bin/<name> in the plugin root with a shebang line, run chmod +x on it, and enable the plugin. While the plugin is enabled, bin/ is on the PATH of the Bash tool's shell, so Claude can run it by name.
Can a plugin executable override git or another system command?
No. Plugin bin/ directories come after the user's own PATH entries, so a command the user already has always runs first. Give your tool a unique name, such as one prefixed with the plugin name.
Why can't my bin/ script read CLAUDE_PLUGIN_ROOT?
The plugin path variables are not in the environment of commands Claude runs through the Bash tool, and a bin/ tool runs that way. Resolve paths from the script's own location instead.
Does the PowerShell tool find plugin executables?
Yes when the PowerShell command runs outside the sandbox. A sandboxed PowerShell command does not find them on its PATH.
Why was my plugin rejected by claude.ai organization sync?
claude.ai and Cowork don't install a plugin with a top-level bin/ directory. Move the executables to a folder such as scripts/ and reference them as ${CLAUDE_PLUGIN_ROOT}/scripts/<name> from skills, hooks or MCP configs.
Should I use a bin/ executable or an MCP server?
Use bin/ for a command Claude should run on request and read the output of. Use an MCP server when you need typed tool inputs, auth to an outside system or a long-running connection.
Last reviewed by David Iya on November 30, 2026


