Explainer · Dec 4, 2026 · 3 min read
PreToolUse guards skip a skill's load-time shell commands, though only ones that pass the permission check. Claude Code 2.1.332 adds the event that sees them.
git reset --hard, unless a skill runs itThe supergraph plugin ships a bash-guard hook that, where python3 is installed, denies git push --force, git reset --hard, DROP TABLE and similar patterns each time Claude calls the Bash tool. It never sees a shell command that a skill or slash command runs while it loads. The skills docs put it plainly: "PreToolUse hooks don't fire for injected commands", and those commands "never prompt for permission while the skill renders". That holds for every guard on PreToolUse, the event hooks use to inspect a tool call before it runs.
The gap is narrower than it sounds. Each injected command still meets your permission rules: a deny rule aborts the skill, and outside auto mode anything short of an allow aborts it too. What slips past the guard is what's already allowed: read-only commands, your own allow rules, and whatever the skill pre-approves in its allowed-tools frontmatter. That last one is the author's choice, not yours. In bypassPermissions mode, most commands slip past.
An injected command is written as !`command` or as a fenced block opened with ```!. Claude Code runs it and pastes the output into the skill text, before Claude reads a word.
Anthropic's ralph-loop uses both halves. Its /ralph-loop command file declares:
allowed-tools: ["Bash(${CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh:*)"]
and its body holds one injected block:
```!
"${CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh" $ARGUMENTS
```
Type the command and the setup script runs with your arguments, no prompt. That's the plugin's own script doing what the command says, and it's a sound design. It's also a shell command your PreToolUse guard never sees.
Claude Code 2.1.332 added a PreSkillShellCommand event that "can refuse a skill or command's inline shell commands as it loads". Per the hooks docs, it runs after the permission check, gets the command in tool_input.command, and can block a command but not approve one. Its invoked_by field reads "claude" when Claude or a session-scoped scheduled task invoked the skill rather than you.
No guard gets it for free. 11,117 plugins in our index hook PreToolUse, though not all of them as guards. supergraph's hooks.json registers bash-guard on PreToolUse with the matcher Bash|bash and has no PreSkillShellCommand entry. The fix is one entry: the docs say a script you already run on PreToolUse works on the new event if its JSON keeps hookEventName as PreToolUse, and bash-guard's does.
claude --version and update if it's below 2.1.332. Older versions run injected commands without calling the hook, and a settings file that names the event opens a warning dialog in each interactive terminal session./hooks, select All events, and open PreSkillShellCommand. If none of your guards is listed, they don't check skill-loaded commands.PreSkillShellCommand with the matcher Bash|PowerShell and "onFailure": "block", so a guard that crashes stops the command instead of letting it through. Keep it on PreToolUse too: in auto mode, a command that needs approval can run later as Claude's own tool call, which fires PreToolUse. If you maintain a guard plugin, add the entry to its hooks.json."disableSkillShellExecution": true in your settings. Each command becomes [shell command execution disabled by policy], so ralph-loop's setup stops running too. Bundled and managed skills aren't affected.11,117 counts plugins in our index whose published hook config names PreToolUse, as of 4 December 2026: config, not installs or runs. We read ralph-loop's command and supergraph's hooks.json and bash-guard script at their indexed refs. We didn't count how many skills use injected commands, and the sources we read report no case of one doing harm.
In the order the post covers them.
ExplainerNov 19, 2026 · 3 min
Claude Code's default 8-in-a-row Stop-hook cap resets whenever Claude runs a tool, so it never ends a loop where Claude keeps using tools.
ExplainerOct 29, 2026 · 3 min
By default its Stop hook sends each turn's diff to Opus on your API key or plan limits, and commits get a second review. How to read the cost and turn it off.
AnalysisNov 27, 2026 · 4 min
Every enabled Claude Code plugin lists its skills, commands and agents at session start. We estimated what each one declares, and what Claude Code trims.