Skip to content
zero2vibecodelearn vibe coding
Level 1 · Permissions and safety 7 min Reviewed by the author · Oct 15, 2026 Verified against Claude Code v2.1.292 · Oct 15, 2026Official docs: Permissions, SettingsSomething out of date? Tell us

Allow and deny rules: where they live

Permission rules live in settings files, and the file decides who a rule applies to — you everywhere, the whole team, or just you in this project. Deny rules are checked first.

Level 1 · 0 / 4 lessons0%
In this lesson

In the last lesson you picked a mode — an overall level of trust. Permission rules are finer: they say which specific actions Claude may take without asking, and which are always off-limits.

What a rule looks like

Rules live in the permissions block of a settings file:

{
  "permissions": {
    "allow": ["Bash(npm test)"],
    "deny": ["Read(./.env)", "Read(./.env.*)"]
  }
}
  • allow — what is fine without asking: here, running npm test;
  • deny — what is never allowed: here, reading .env files, where secrets live.

Inside a session, /permissions shows the rules currently in force, and /status shows which settings files were picked up.

Which file applies to whom

This is the key point. The same rule means different things in different files:

FileApplies toWhat goes here
~/.claude/settings.jsonyou, in every projectyour personal habits
.claude/settings.json (committed)the whole team in the projectshared rules: what must not be read, which commands are allowed
.claude/settings.local.json (not in git)you, in this projectyour exceptions
managed settingsthe whole organizationpolicy that cannot be overridden

When you answer “Yes, and don’t ask again” to a command, the permission is saved in settings.local.json — your personal exception, not a team rule.

Who wins

If one key is set in several files, the higher level wins: managed settings, then the command line, then local, then the shared project file, then user. But rule lists — allow, deny — do not overwrite each other; they add up.

Within the rules, the order is fixed: first deny, then ask, then allow, and the first match decides. That is why a deny cannot be accidentally overridden by an allow in another file.

Quick check

You want nobody on the team to be able to have Claude read .env. Where does the deny rule go?

Careful

Practice in the terminal

Build your own file

Check your understanding

Answered 0/3
Mode:

A rule has to apply to everyone who works on the repository. Which file does it go in?

A command is allowed by an allow rule but also matches a deny rule. Which wins?

You answered "Yes, and don't ask again" to a command. Where was that permission saved?

Finish the task in the terminal and answer the questions to complete the lesson.

📝 My notes

Saved automatically in this browser · shows up on the Notes page.

Task

Block Claude from reading .env files for the whole team, and let it run the tests without asking. The rules go in the project's .claude/settings.json.

Tab complete · ↑ history · Ctrl+L clear · help commands

  • Not done: Team settings file created
  • Not done: Reading .env is denied
  • Not done: Tests are allowed without asking

Lesson Q&A

A rule has to apply to everyone who works on the repository. Which file does it go in?

The project's .claude/settings.json, committed — .claude/settings.json lives in the repository and gets committed — the whole team gets its rules. Personal exceptions go in settings.local.json, your own habits for every project in ~/.claude/settings.json.

A command is allowed by an allow rule but also matches a deny rule. Which wins?

deny — deny rules are checked first, and the first match decides — The order is deny, then ask, then allow; the first match decides. A deny cannot be overridden by an allow.

You answered "Yes, and don't ask again" to a command. Where was that permission saved?

In .claude/settings.local.json — your personal file that stays out of git — Those permissions land in settings.local.json: your exception in this project, not a rule for the team.

You want nobody on the team to be able to have Claude read .env. Where does the deny rule go?

Only the project settings.json goes into the repository and applies to the whole team. Personal files protect only you.

Commands in this lesson

Move between lessons with ← → · search with ⌘K

Written and reviewed by Mikhail Kuzmitskii