Claude Code — sensible settings.json + hooks
A starting settings.json: safe auto-allow rules, a format-on-save hook, and a guardrail that blocks edits to lockfiles.
ของ lazyyy เอง · อัปเดต 9 ส.ค. 2569
ส่วนประกอบ
Claude Code settings.json (starter)
{
"permissions": {
"allow": ["Bash(git status)", "Bash(git diff:*)", "Bash(pnpm test:*)", "Read"],
"deny": ["Bash(rm -rf:*)"]
},
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [{ "type": "command", "command": "pnpm prettier --write \"$CLAUDE_FILE_PATHS\" 2>/dev/null || true" }]
}
]
}
}
- allow: skips prompts for read-only + test commands you run constantly.
- PostToolUse hook: formats every file the agent touches.
- Keep
rm -rfdenied so nothing nukes your tree by accident.