Day 9 of 52 · about 20 min · Safety
Decide what Claude may do without asking
Prompts protect you, but approving npm test for the fiftieth time teaches you to click yes without reading. Written rules let safe commands through and keep risky ones in front of you.
You’ll finish with
- A
.claude/settings.jsonthat runs tests freely and guards prices and secrets - Rules confirmed in
/permissionsand seen at work
You’ll need
- Claude Code installed and logged in (Day 1)
- The Day 9 practice kit, or your own project
Before you start
Tell us about your setup and the steps change to fit it. Your answers stay in this browser, and you can change them at any time.
Which system are you on?
Commands differ between systems. Pick the one you’ll run Claude Code on.
The steps
One step at a time. When a step’s check matches, tick it and the next one opens.
Step 1 of 4: Write the rules
Create the shared project settings file.Save this as
.claude/settings.json. In your own project, use your own commands..claude/settings.jsonJSON{ "$schema": "https://json.schemastore.org/claude-code-settings.json", "permissions": { "allow": [ "Bash(npm test *)", "Bash(npm run quote *)" ], "ask": [ "Bash(git push *)", "Edit(/data/rates.json)" ], "deny": [ "Read(./.env)" ] } }.claude/settings.json- permissions.allow: ["Bash(npm test *)", "Bash(npm run quote *)"]
- Runs without asking. A space then
*also matches the bare command. - permissions.ask: ["Bash(git push *)", "Edit(/data/rates.json)"]
- Always asks, even in Auto mode. A leading
/means the folder you started in. - permissions.deny: ["Read(./.env)"]
- Never allowed. Blocks edits to the file too.
Commit it and everyone on the project gets the same rules. Check it worked
The file is at
.claude/settings.json, in strict JSON: no comments, no trailing commas.If it didn’t work
Claude Code shows a Settings Error
The JSON is broken. Pick the option to fix it with Claude, or compare with the file above.
Step 2 of 4: Check them with /permissions
Confirm Claude Code loaded your file.Start Claude Code in the project and accept the trust dialog if it appears: project allow rules wait for it. Deny and ask rules apply at once.
In Claude CodeYou type: /permissions
What happens: Lists every rule and the settings file it comes from.
You can add and remove rules here too. Check it worked
Your five rules are listed, from your project settings file.
Step 3 of 4: Switch to Manual mode
Cycle modes with Shift+Tab and read the status bar.Recent versions start sessions in Auto mode, where a classifier reviews actions instead of you. To watch your own rules decide, press
Shift+Tabuntil Manual is on. On Windows, if nothing changes, pressAlt+M.In order:
⏵⏵ auto mode on
⏸ manual mode on
⏵⏵ accept edits on
⏸ plan mode on
Each press moves one step, then loops. Auto shows only when your account can use it. Check it worked
The status bar under the prompt reads
⏸ manual mode on.Step 4 of 4: Watch the rules decide
Ask for one allowed action and one that must ask.Paste this into Claude CodeRun the tests. Then change the design rate in data/rates.json from 80 to 85.In order:
Claude
Claude wants to act
File
Deny rules
A match blocks it
File
Ask rules
A match asks you
File
Allow rules
A match runs it
If no rule matches
Your permission mode decides
The first match decides, whichever file it is in, so a broad deny beats a narrow allow. Check it worked
npm testruns with no prompt.- The edit to
data/rates.jsonstops at a permission prompt. Decline it.
If it didn’t work
`npm test` still asks for permission
Accept the folder’s trust dialog, then check that
/permissionslists the rule.
Finish · 4 of 4 steps to go
Your rules are written down
What you’ll have checked
/permissionslists your rulesnpm testruns without a prompt in Manual mode- A rate card change asks first
Lesson updates by email
Get lesson updates by email
Leave your email and we’ll tell you when we add or update a lesson.
Claude Code for your team
Want Claude Code set up across your team?
HorizonLux sets up and repairs Claude Code for teams: CLAUDE.md rules, hooks that enforce them and reviewed MCP servers. Book a free call to talk it through.
Related
Questions
Questions about Day 9
Where do my “don’t ask again” answers go?
Into `.claude/settings.local.json`, your personal project file. Claude Code keeps it out of git when it creates it.
Sources
Checked against the official Claude Code docs on .
Independent resource, not affiliated with Anthropic. HorizonLux wrote this lesson; Claude Code is made by Anthropic.