Claude Code rules: CLAUDE.md is context, not enforcement — use deny rules and PreToolUse hooks
shoumikgoswami · reddit · 2026-10-30
Putting "never do X" in CLAUDE.md isn't enforcement — Anthropic's docs describe it as context, not enforced configuration. The author lays out three layers:
- Guidance: CLAUDE.md for conventions, structure, test commands.
- Restrictions: permissions.deny rules, enforced by the client to block specific tools, commands, or file paths.
- Pre-execution checks: PreToolUse hooks that run before tool calls and can block them (exit code 2), per the docs' protected-file example.
Suggested test: in a disposable repo, protect a dummy file and ask Claude to edit it — verify execution is actually blocked, not just verbally declined. Takeaway: use prompt files for workflow, enforcement controls for boundaries that must hold even when the model errs.
More from coding & agent
- Vercel quietly launches "Agentic Infrastructure", positioning itself as the deploy target for coding agents — evilrabbit_ · 2026-10-30
- Mollick on Opus 5.5: prompt less, build in checkpoints instead of one-shotting — eldonredwards · 2026-10-30
- Hugging Face Spaces' Agents button lets your AI agent use any demo for free — victormustar · 2026-10-30
- Atelico launches fully on-device game AI engine with LLMs, voice, and NPC behavior — nathanbenaich · 2026-10-30
- Hooking Kimi up to bloodwork via MCP: a Redditor mined years of lab results in one evening — Local-Parking5561 · 2026-10-30
- Heretic-v2 quant of Qwen3 Swift 1.5 Flash ships with reverse-engineering-tuned imatrix for 96GB VRAM — jjusko20 · 2026-10-30