Skip to main content
If you maintain a CLI or SDK and have a plugin in the official Anthropic marketplace, your tool can prompt Claude Code users to install that plugin. Your CLI writes a one-line marker to stderr when it detects it is running inside Claude Code. Claude Code reads the marker, strips it from the output, and shows the user a one-time install prompt. The protocol requires no extra commands and does not change what your CLI prints for users outside Claude Code. This page is for CLI and SDK maintainers. If you are looking to install plugins, see Discover and install plugins.

How it works

Claude Code sets the CLAUDECODE environment variable to 1 for every command it runs through the Bash and PowerShell tools, and for hook commands. From v2.1.172 it also sets CLAUDE_CODE_CHILD_SESSION to 1 in those same subprocesses. When your CLI sees one of these variables, it writes a self-closing <claude-code-hint /> tag to stderr. In hook commands the hint tag is stripped and ignored. Only Bash and PowerShell tool output triggers the install prompt. When Claude Code receives the command output, it:
  1. Scans for hint lines and removes them before the output reaches the model
  2. Checks that the hint targets a plugin in an official Anthropic marketplace
  3. Checks that the plugin is not already installed and has not been prompted before
  4. Shows the user an install prompt that names the command that emitted the hint
Claude Code never installs a plugin automatically. The user always confirms.

Emit the hint

Hint prompts only fire for plugins listed in the official Anthropic marketplace. See Get your plugin into the official marketplace before you ship the integration. Gate emission on an environment variable so the marker is unlikely to appear when a human runs your CLI directly, then write the tag to stderr on its own line. Choose which variable to check:
  • CLAUDECODE: set on every Claude Code version, so it reaches the most sessions. It is also set in tmux sessions and stdio MCP server subprocesses that Claude Code starts. IDE extensions also set it in their integrated terminals, where a human may be running your CLI directly.
  • CLAUDE_CODE_CHILD_SESSION: set only in subprocesses Claude Code itself spawns, such as tool calls, hook commands, and status line commands, so the tag does not normally reach a human terminal. A long-lived process that was started inside a session, such as a tmux server, captures the variable, so shells later launched from that process still show the raw tag. Requires Claude Code v2.1.172 or later, so sessions on older versions miss the hint.
The following examples gate on CLAUDECODE for maximum reach and emit a hint for a plugin named example-cli in the official marketplace:
Replace example-cli with your plugin’s name in the official marketplace.

Choose where to emit

You control which code paths emit the hint. Claude Code deduplicates by plugin, so emitting on every invocation has no downside. Touchpoints that work well include: