Claude Code Security Hooks
Ready-to-deploy guardrails for client Claude Code deployments. block-dangerous-commands and protect-secrets are essential safety hooks.
4 production hooks: block-dangerous-commands (blocks rm -rf ~, fork bombs, curl|sh), protect-secrets (prevents reading/modifying sensitive files), auto-stage (git stages after edits), notify-permission (Slack alert when input needed).
- Block known dangerous shell commands across all sessions
- Prevent Claude from reading or changing sensitive config files
- Get instant team alerts when Claude needs human approval
Ready-to-deploy guardrails for client Claude Code deployments. block-dangerous-commands and protect-secrets are essential safety hooks. Transparent bash scripts, auditable implementation.
Any client Claude Code deployment — these hooks are foundational safety guardrails that should be part of every production setup.
https://github.com/karanb192/claude-code-hooks
By karanb192
How to Get It
Claude Code only: Hooks are configured in your project's .claude/settings.json file. They run automatically before or after Claude takes actions. You can ask Claude to set up a hook for you by describing what you want in your conversation. Not available in Claude Cowork or Claude Chat.
git clone https://github.com/karanb192/claude-code-hooks mkdir -p ~/.claude/hooks && cp claude-code-hooks/hook-scripts/pre-tool-use/block-dangerous-commands.js ~/.claude/hooks/ Then add a PreToolUse entry to .claude/settings.json pointing at node ~/.claude/hooks/block-dangerous-commands.js (the repo README shows the exact JSON block), and restart Claude Code. Repeat the copy step for the other hooks you want (protect-secrets, etc.). Requires Node.js.
After installing, paste this into Claude:
Help me block known dangerous shell commands across all sessions
Trust Signals Auto-scanned
Data & Access
Community Pulse Active
Discussed on Hacker News, Reddit
- claude code now have /context hook — Reddit · 647 pts
- Two Claude Code features I slept on that completely changed how I use it: Stop H — Reddit · 519 pts
- Claude Code now supports hooks — Reddit · 480 pts
3 mentions across 1 sources
Reviewer notes
Auto-scanned review. These are observations, not a security certification.
catalog_hygiene stale-eval refresh: Scored from trust signals (evidence-eval-v1): 437 GitHub stars; 1 contributors; last commit 1d ago; license MIT.
Things to check
- Hooks are reactive, not preventative—they block after detection rather than restrict Claude's capability upfront. Effectiveness depends on exact command patterns; sophisticated obfuscation or indirect execution paths may bypass filters.
How to evaluate tools before deploying →
Data shown here comes from public APIs and automated scanning. Reviewer notes reflect one person's experience. This is not a security certification or legal recommendation. Always evaluate tools according to your own organization's policies.
Evaluation
catalog_hygiene stale-eval refresh: Scored from trust signals (evidence-eval-v1): 437 GitHub stars; 1 contributors; last commit 1d ago; license MIT.