{"version":"2.1.332","anchor":"preskillshellcommand-hook-event-gates-shell-commands-inside","canonical_anchor":"preskillshellcommand-hook-event-gates-shell-commands-inside","heading":"New PreSkillShellCommand hook can block shell commands inside skills","tier":"use","area":"Hooks","scope":"both","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.332\/e\/preskillshellcommand-hook-event-gates-shell-commands-inside","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.332","markdown":"### New PreSkillShellCommand hook can block shell commands inside skills\n\nA new PreSkillShellCommand hook runs before each shell command a skill or slash command runs, and can block it or stop the skill\n\n**Unclear.** It is not confirmed whether the hook settings accept `PreSkillShellCommand` as an event name in this build.\n\n**What**\n\nHooks are scripts you set up to run at certain points in Claude Code. A new hook event, `PreSkillShellCommand`, runs before each shell command that a skill or slash command includes. A skill is a packaged set of instructions Claude can use.\n\n- The hook's input carries `hook_event_name`, `tool_name`, `tool_input`, `command_name`, `command_source` and `invoked_by`. Hooks are matched on `tool_name`.\n\n- Exit code 0 lets the command run, unless the hook's JSON output denies, asks, defers or changes it.\n\n- Exit code 2 blocks the command and shows the error output to Claude and to you.\n\n- Other exit codes show the error output to you only, and the command still runs.\n\n- A blocked command is reported as \"[not run: blocked by hook ...]\". A hook can also stop the whole skill with a stop reason.\n\n- A skill can't wait for approval, so a hook that asks for approval, defers, changes the input or changes permissions is treated as a block, with a reason such as \"the hook asked for approval, which a skill can't wait for\".\n\n- If the hooks give no answer, the command runs anyway and you are told. Messages include \"Not run in\" and \"Ran anyway in\".\n\n- Only command-type hooks run for this event: \"prompt and agent hooks don't run on PreSkillShellCommand\".\n\n- It accepts permission-style decisions like `PreToolUse` and `PermissionRequest`.\n\n**Why**\n\nUsers and admins can now check, block or log the shell commands built into skills before they run. A missing answer lets the command through, so a policy hook that must block things needs to answer every time.\n\n- Area: Hooks\n- Names: `PreSkillShellCommand`\n- Tier: Use it now\n- Useful: 5\/5\n- Signal: 3\/5\n- Scope: both\n- Heads-up: no"}