React to events with a mod changedplugins/mods/events
Upstream edited this page at 28 Nov 2026 19:16 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 28 Nov 2026 19:37 UTC.
Upstream edited
Recorded here
Lines+17added
Lines−7removed
From line
282
where the diff opens
First seen
1 Oct 2026
this site's first read of the page
Recorded edits34to this page, all time
#### Stop a prompt #### Change command arguments #### Change system prompt, context, or skill text
The whole hunk
from line 282, old and new numbered
/
from line 282
282282
283283When you send a prompt such as `open a PR for this change`, your message looks the same in the transcript, and Claude also reads a line such as `Current branch: feature/auth` after it. A prompt that doesn't mention a pull request goes through unchanged, and `git` doesn't run.
284284
285To change a `/command`'s arguments, return `next({ ...e, args: newArgs })` from a [`command.run`](https://code.claude.com/docs/en/plugins/mods/api#add-a-command) hook. After you add the `command.run` hook, have any `prompt.submit` hook that rewrites `text` skip the rewrite when `e.command` is set. `e.command` requires Claude Code v2.1.299 or later.
285#### Stop a prompt
286286
287To stop a prompt, return `{ drop: 'the reason' }` without calling `next`. The text goes back into the user's prompt input, and they see `Prompt dropped by a hook:` followed by your reason, so address the reason to them. Don't rely on `drop` to stop every prompt. For example, a prompt goes through in these cases:
287To stop a prompt, return `{ drop: 'the reason' }` from your `prompt.submit` hook without calling `next`. The user gets the text back in the prompt input and sees `Prompt dropped by a hook:` followed by your reason.
288288
289* **Your hook returns a `drop` after its `next(e)` call let the prompt through**: the turn still runs, and the hook [fails](#handle-a-hook-that-fails) with a message that includes `a drop after its next() was answered`
290* **Your hook throws or times out**: Claude Code skips it and sends the prompt. [Add a `.catch` handler](#handle-a-hook-that-fails) so that a failure doesn't send a prompt the hook would have stopped.
291* **The prompt is the `/command` for a [skill with `context: fork`](https://code.claude.com/docs/en/skills#run-skills-in-a-subagent)**: your hook doesn't run. To stop the command, return `{ text: 'the reason' }` from a [`command.run`](https://code.claude.com/docs/en/plugins/mods/api#add-a-command) hook without calling `next`.
289Some prompts still go through, for example:
290
291* **Late drop**: if you return `drop` after `next(e)` has let the prompt through, the hook [fails](#handle-a-hook-that-fails) with a message that includes `a drop after its next() was answered`. Decide whether to drop before you call `next`.
292* **Failed hook**: if your hook throws or times out before it calls `next`, Claude Code skips the hook. To stop the prompt instead, [add a `.catch` handler](#handle-a-hook-that-fails).
293* **Forked skill**: your hook doesn't run for the `/command` of a [skill with `context: fork`](https://code.claude.com/docs/en/skills#run-skills-in-a-subagent). To stop the command, return `{ text: 'the reason' }` from a [`command.run`](https://code.claude.com/docs/en/plugins/mods/api#add-a-command) hook without calling `next`.
294
295#### Change command arguments
296
297To change a `/command`'s arguments, return `next({ ...e, args: newArgs })` from a [`command.run`](https://code.claude.com/docs/en/plugins/mods/api#add-a-command) hook.
298
299Then, in any `prompt.submit` hook that rewrites `text`, skip the rewrite for commands, when `e.command` is set. `e.command` requires Claude Code v2.1.299 or later.
300
301#### Change system prompt, context, or skill text
292302
293303[Other events](https://code.claude.com/docs/en/plugins/mods/reference.md#prompts-and-what-claude-reads) cover the rest of what Claude reads: `prompt.section` for each section of the system prompt, `prompt.context` for the context sent with the first message, and `skill.prompt` for a skill's text. To change a section after a conversation has started, see [Send a changed system prompt section or tool description](https://code.claude.com/docs/en/plugins/mods/reference.md#break-prompt-cache). In a `skill.prompt` hook, you can also read [which plugin or file the skill came from](https://code.claude.com/docs/en/plugins/mods/reference.md#skill-prompt-fields).
294304
No line in this hunk matches that.