Rules and permissions for Claude Code
Claude Code can read, write and run commands. To work with peace of mind, decide upfront what it may do. There are several layers, from the simplest to the most robust.
1. Instructions in CLAUDE.md
In the project's CLAUDE.md you write rules in plain words: "do not change the legacy/ folder", "do not add dependencies without asking". Claude reads them in every chat. They are guidance, not a block: they can be ignored.
2. Permissions in settings.json
In the project's .claude/settings.json, allow, ask and deny rules decide which tools and commands Claude uses without asking, after asking or never. For example "deny": ["Read(./.env)", "Bash(git push *)"] forbids reading the .env file and pushing.
- Rules are checked in this order:
denyfirst, thenask, thenallow. - A command
denymatches the text: a differently written variant (for examplegit -C . push) can slip through. For a reliable block you need hooks. - The starting mode (for example
acceptEditsorplan) changes how often Claude asks for confirmation.
3. Hooks
Hooks are commands Claude Code runs before or after each tool (for example PreToolUse). A hook can inspect a command and block it: it is the most robust way, but you have to write and maintain it.
How MyHeroStudio does it
MyHeroStudio applies project rules before Claude acts, shell commands included: protected files (.env, keys, package.json) stopped until you press "Allow", folders it may write to, forbidden or confirm-first commands, secrets in code, new dependencies with their licence, per-request limits and required tests at the end of each request. You set them from a tab, without writing JSON.
Download it free, forever, in the standard version (Free). If you like it, upgrade to Pro to get the most out of it. Windows 10 and 11.