7 pages for command.run.
Titles and paths first, then pages whose text carries it. Each row opens that page as this site last read it.
Use the mods API
Claude Code CLI · in the page
plugins/mods/api
…Add a command A command is for the user. Register it, then handle [`command.run`](https://code.claude.com/docs/en/plugins/mods/reference#commands-and-configuration) for its name. This example adds a…
Create a mod
Claude Code CLI · in the page
plugins/mods/create
…uns when you type /tally, and only then, because of the matcher on('command.run', { command: 'tally' }, async () => { // The text to print in the transcript return { text: 'Claude has made '…
Interface gallery for mods
Claude Code CLI · in the page
plugins/mods/gallery
…description: 'Open the sample pane' }) return next(e) }) on('command.run', { command: 'gallery' }, async ($) => { await $.ui.open({ id: 'gallery', focus: true, closeOnEscape: true })…
Draw in the interface with a mod
Claude Code CLI · in the page
plugins/mods/interface
…ed return next(e) }) // Runs when you type /hello-tabs on('command.run', { command: 'hello-tabs' }, async ($) => { // Open the pane, give it the keyboard, and let Esc close it await…
Mods reference
Claude Code CLI · in the page
plugins/mods/reference
…tion | Event | Fires when | A hook can return | | :- | :- | :- | | [`command.run`](https://code.claude.com/docs/en/plugins/mods/api#add-a-command) | A command is about to run | `{ text }`, `{}`, or `…
Test a mod
Claude Code CLI · in the page
plugins/mods/test
…n /tally and check the text its hook returns const answer = await $.command.run({ command: 'tally', args: '' }) expect(answer.text).toBe('Claude has made 2 tool calls since this mod loaded') }) ``…
Troubleshoot a mod
Claude Code CLI · in the page
plugins/mods/troubleshoot
…ix the error. The debug log has a line for every occurrence. ### `no command.run hook answered it` You run a command your mod added, and the reply names the mod and the command, as in `first-mod reg…