Hook#buildwithclaude
0
Root directory guard
/etc, /usr, /bin ve /boot gibi sistem dizinlerini hedefleyen yazma işlemlerini engelleyin
yazan kuscubasiece·8 Eylül 2026
Kaynak: davepoon/claude-code-subagents-collection · MIT
/etc, /usr, /bin ve /boot gibi sistem dizinlerini hedefleyen yazma işlemlerini engelleyin
Kaynak: davepoon/claude-code-subagents-collection · MIT
curl -sL https://www.antrophiclove.com/api/kaynak/root-directory-guard/rawBu içerik mevcut dosyaya elle harmanlanmalı: .claude/settings.json
Blocks file write operations that target system directories (/etc, /usr, /bin, /sbin, /boot, /sys, /proc). Prevents accidental modification of OS-level files that could break the system.
PreToolUseWrite#!/bin/bash
# root-directory-guard.sh — Block writes to system directories
INPUT=$(cat)
FILE=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null)
[ -z "$FILE" ] && exit 0
case "$FILE" in
/etc/*|/usr/*|/bin/*|/sbin/*|/boot/*|/sys/*|/proc/*)
echo "BLOCKED: Write to system directory: $FILE" >&2
exit 2
;;
esac
exit 0
Add to your .claude/settings.json:
{
"hooks": {
"PreToolUse": [{
"matcher": "Write",
"hooks": [{ "type": "command", "command": "~/.claude/hooks/root-directory-guard.sh" }]
}]
}
}