Stop Claude Code from running dangerous commands with hooks
Описание и применение
<p>Claude Code asks before it runs most shell commands, so why add anything? Because after the twentieth "Allow?" prompt in a session, most of us start clicking yes without reading, or we switch to a mode that stops asking. Instructions in <code>CLAUDE.md</code> like "never force-push to main" help, but they're text the model can forget or argue its way around.</p> <p>A <strong>hook</strong> is different. It's a program Claude Code runs <em>before every tool call</em>. If it says no, the command never runs, whatever the model was thinking. Claude gets the reason back and usually picks a safer
Задача
<p>Claude Code asks before it runs most shell commands, so why add anything? Because after the twentieth "Allow?" prompt in a session, most of us start clicking yes without reading, or we switch to a mode that stops asking. Instructions in <code>CLAUDE.md</code> like "never force-push to main" help, but they're text the model can forget or argue its way around.</p> <p>A <strong>hook</strong> is different. It's a program Claude Code runs <em>before every tool call</em>. If it says no, the command never runs, whatever the model was thinking. Claude gets the reason back and usually picks a safer
Результат
<p>Claude Code asks before it runs most shell commands, so why add anything? Because after the twentieth "Allow?" prompt in a session, most of us start clicking yes without reading, or we switch to a mode that stops asking. Instructions in <code>CLAUDE.md</code> like "never force-push to main" help, but they're text the model can forget or argue its way around.</p> <p>A <strong>hook</strong> is different. It's a program Claude Code runs <em>before every tool call</em>. If it says no, the command never runs, whatever the model was thinking. Claude gets the reason back and usually picks a safer
Доказательства
Stop Claude Code from running dangerous commands with hooks
- Дата записи: 2026-10-25T21:11:27.909Z