Skip to content
Claude Code Mods

PreSkillShellCommand lets a hook refuse a skill's inline shell commands (v2.1.332)

Claude Code v2.1.332 adds PreSkillShellCommand, a hook that can refuse the inline shell commands a skill runs as it loads. What it does and its limits.

Published . Checked against Claude Code v2.1.332. This site is unofficial; the sources under each section are Anthropic's own pages.

Why a new event

A skill can run shell commands as it loads with the ! placeholder syntax, and the output replaces the placeholder before Claude sees the skill. The skills docs say PreToolUse hooks do not fire for these injected commands. Claude Code v2.1.332 (November 25, 2026) added PreSkillShellCommand, a hook event that runs before such a command, so you can log it or block it.

Warning

On v2.1.331 and older, a settings file that names this event opens a dialog at start. Upgrade before adding it to shared settings.

Source: Claude Code changelog (opens in a new tab), Extend Claude with skills (opens in a new tab)

What the docs say it does

  • The hooks reference lists it as a blocking event that runs before a shell command in a loading skill.
  • The matcher filters on the tool that runs the command: Bash or PowerShell.
  • The if field is evaluated for this event, as it is for PreToolUse.
  • Exit code 2 blocks the command, and the skill loads without its output.
  • On Windows without Git Bash, only exit code 0 or 2 counts as the hook's verdict, and "onFailure": "continue" lets the command proceed on failure.

Read the hooks reference for the input fields and any JSON output; this article restates only what the pages state about matching and exit codes.

Source: Hooks reference (opens in a new tab), Claude Code changelog (opens in a new tab)