Claude Code v2.1.332 adds hook to block skill shell commands
Anthropic released Claude Code v2.1.332 on November 25, introducing a new PreSkillShellCommand hook to address security concerns in skill execution.
Key points
- Claude Code v2.1.332 introduces PreSkillShellCommand hook to block load-time shell commands.
- Tests show PreToolUse hooks fail to stop skill loading commands, while the new hook succeeds.
- Users must set onFailure to block to prevent command execution if the hook script crashes.
The update allows developers to block shell commands prefixed with "!" that run automatically when a skill is loaded, a process that previously bypassed standard PreToolUse hooks. This change is significant because malicious or unintended commands in third-party skills could execute without user awareness if the skill author pre-approves them in the frontmatter.
A technical blog team from Claude Code Laboratory conducted 47 local tests on macOS to verify the new hook's behavior. Their findings show that the new hook successfully blocked unauthorized commands in 7 out of 7 tests, whereas the older PreToolUse hook failed to stop them in all 5 tests where it was applied. The tests also revealed that if the new hook script crashes or times out, the command executes by default unless the configuration explicitly sets onFailure: "block". Additionally, the new hook does not apply to commands executed later in "auto mode," which still rely on PreToolUse.
The article advises users to update their configuration files to include the new hook and set the failure mode to block for maximum security. It also notes that hooks written within the skill's own frontmatter are not invoked, meaning the installing party must define the restrictions. For those who do not want any load-time command execution, the article suggests disabling the feature entirely via disableSkillShellExecution.

The headline, key points and digest above were generated by Digest AI's editorial model from the linked sources. Automated summaries can contain errors: the sources are the record. Spotted a mistake? Tell us. Published by Martin K., who runs Digest AI and handles corrections.
More in Agents & Tools
All →- Anthropic expands Claude Duet to India and launches healthcare suite · 6 src
- OpenAI builds Athena platform to improve AI agent data accuracy · 2 src
- TrueLayer and Lloyds test AI agent cardless pizza purchase in UK · 2 src
- Google releases artemis, an open-source agent for Android testing · 1 src
- OpenAI to unify ChatGPT and Codex usage limits in December 2026 · 1 src
Comments
via GitHub Discussions