Back to articles
Claude Code Ignores Its Own Tools. Here Are 3 Hooks That Force It to Behave.
How-ToTools

Claude Code Ignores Its Own Tools. Here Are 3 Hooks That Force It to Behave.

via Dev.toYurukusa

I was reviewing GitHub Issues this week and noticed something odd: three of the most-reacted issues (186 reactions combined) are all the same underlying problem — Claude Code fighting its own design. Claude has built-in tools (Read, Edit, Grep, Glob) that are faster and safer than bash equivalents. But it keeps reaching for sed , grep , and cat anyway. And that preference causes a cascade of problems. Here are three hooks that fix it. Each is under 20 lines. 1. The Bash Addiction (Issue #19649, 48 reactions) The problem: Claude uses sed -n '10,20p' instead of the Read tool. It runs grep -r "pattern" instead of the built-in Grep. It creates files with cat <<EOF instead of Write. Every one of these triggers an extra permission prompt that can't be cached. Why it happens: LLM training data is full of bash one-liners. Claude defaults to what it "knows" from Stack Overflow, not what it has available. The fix: A PreToolUse hook that intercepts Bash commands containing these patterns and deni

Continue reading on Dev.to

Opens in a new tab

Read Full Article
6 views

Related Articles