Skip to content

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.json that runs tests freely and guards prices and secrets
  • Rules confirmed in /permissions and 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.

0 of 4 steps done0%
  1. 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.

  2. 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 Code

    You 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.

  3. 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+Tab until Manual is on. On Windows, if nothing changes, press Alt+M.

    In order:

    1. ⏵⏵ auto mode on

    2. ⏸ manual mode on

    3. ⏵⏵ accept edits on

    4. ⏸ 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.

  4. Step 4 of 4: Watch the rules decide

    Ask for one allowed action and one that must ask.
    Paste this into Claude Code
    Run the tests. Then change the design rate in data/rates.json from 80 to 85.

    In order:

    1. Claude

      Claude wants to act

    2. File

      Deny rules

      A match blocks it

    3. File

      Ask rules

      A match asks you

    4. 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 test runs with no prompt.
    • The edit to data/rates.json stops 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 /permissions lists the rule.

Finish · 4 of 4 steps to go

Your rules are written down

Safe commands run quietly and risky ones wait for you, for everyone who clones the project.

What you’ll have checked

  • /permissions lists your rules
  • npm test runs 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.

We’ll email you when we add or update a lesson. We use your email only for this. Privacy policy

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.

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.