Claude Code Permission Modes: 4 Modes and allow/deny Rules (2026)

Blog / Developer tools

Claude Code Permission Modes: 4 Modes and allow/deny Rules (2026)

Claude Code's permission mode decides whether it has to ask you before it edits a file or runs a command. If you're new, start with the default mode and confirm each action. Once you're comfortable, put commands you know are safe into allow and sensitive files into deny, rather than switching off confirmations altogether. This article covers how the modes differ, how to write rules, and a starter config.

Mode names, keyboard shortcuts, and config fields change between versions. This article sticks to general concepts; for exact syntax, go by Anthropic's official documentation.

What permission modes does Claude Code have?

There are four common ones, from strictest to loosest:

ModeBehaviorGood for
Default (default)Reads files without asking; asks before editing files or running commandsBeginners, unfamiliar projects
Accept edits (acceptEdits)File edits are approved automatically; commands still need confirmationYou already trust it to edit code but want to gate commands
Plan mode (plan)Read-only analysis; proposes a plan and doesn't touch filesSeeing the approach before a big change
Bypass permissions (bypassPermissions)Essentially stops asking; corresponds to --dangerously-skip-permissionsIsolated environments, such as a throwaway container

In the interactive UI you can usually cycle through modes with Shift+Tab, and the current mode is shown near the input box. For command-line flags, which modes are available, and any newly added modes, check the official docs and claude --help.

Why is default mode a good fit for beginners?

Because you don't yet know what commands it will run. In default mode, every shell command or file write triggers a prompt, so you can see what it wants to do before deciding. That's a learning process in itself: you find out which commands it reaches for often and which ones you don't understand.

At the prompt there are usually two choices: allow this once, or always allow this kind of command. The second one writes a rule into your config, so check the scope of the command first. Never click "always allow" on things like rm or curl ... | sh.

How do you write allow and deny rules?

Rules go under permissions in settings.json, in three groups: allow (run without asking), ask (ask every time), and deny (forbidden). deny takes precedence over allow. A rule has the basic form ToolName(pattern).

Here is a starter config for the project's .claude/settings.json (an example; rule syntax may change between versions, so verify it against the official docs):

{
  "permissions": {
    "allow": [
      "Bash(git status)",
      "Bash(git diff:*)",
      "Bash(npm run test:*)",
      "Bash(npm run lint)"
    ],
    "deny": [
      "Read(./.env)",
      "Read(./.env.*)",
      "Read(./secrets/**)",
      "Bash(rm -rf:*)",
      "Bash(curl:*)"
    ]
  }
}

The idea behind this config: allow read-only and repeatable commands (checking status, viewing diffs, running tests), and deny reading secret files, bulk deletion, and arbitrary network downloads. For how config files are layered and how user-level and project-level settings override each other, see Claude Code settings.json layers, precedence, and env config.

Type /permissions in a session to view and adjust the rules currently in effect. For a command reference, see Claude Code commands cheat sheet.

Which commands need extra caution?

In any mode, it's worth reading these kinds of commands yourself before approving them:

  • Deletion: rm -rf, git clean -fd, git reset --hard, git push --force.
  • Download-and-execute: curl ... | sh, or wget followed by running the script.
  • Permissions and system changes: sudo, chmod -R, editing shell config files.
  • Global package operations: npm install -g, pip install into the system environment.
  • Commands that read or print secrets: cat .env, printenv, debug statements that print tokens.
  • Database and deployment commands: migrations against a production database, terraform apply, kubectl delete.

Keep wildcards in allow rules as narrow as possible. Bash(git:*) would also allow git push --force; it's better to list git status and git diff:* one by one.

When is bypass permissions mode acceptable?

Only when the environment itself is isolated: a throwaway container or VM with none of your secrets and no production credentials, and a project directory under version control or backed up. On your everyday dev machine, turning it on in a directory that contains .env files, SSH keys, and cloud credentials means you bear the cost if something goes wrong.

Even in an isolated environment, keep your deny rules as a second line of defense, and commit a clean starting point with git so you can roll back.

Getting-started checklist

  1. Stay in default mode for the first week and watch which commands it asks to run.
  2. Add the read-only commands you keep confirming (status, diff, tests, lint) to allow, one by one.
  3. Add .env and secrets directories to deny.
  4. Switch to plan mode when you want to see the approach before it acts.
  5. Put your project's test and build commands in CLAUDE.md so it is less likely to guess at commands; see What is CLAUDE.md and how to write one that helps Claude Code.
  6. If you're unsure about the syntax of a rule, go by the official docs and confirm it took effect in /permissions.

Can you use Claude Code without a Claude account?

Claude Code itself is just a command-line tool. Permission modes and the rules above have nothing to do with how you connect to a model. Which services it can connect to depends on whether you use an official account, an API key, or a compatible endpoint. Official accounts and the API each have their own supported regions and terms of service; please use them as those terms require.

If you don't have a Claude account, or paying with an overseas credit card is inconvenient (a common situation for developers in China), you can look at AGI Plan. It is a multi-provider LLM aggregation gateway with monthly subscriptions, billed in RMB, with no overseas credit card needed. Tools like Claude Code and Codex only need a changed endpoint URL, and a single quota can be switched across multiple capability groups. Some models are marked "overseas only"; see the AGI Plan models page for specifics. The site also states that it is not an officially authorized channel. AGI Plan is a commercial partner of cdnping. Setup steps are in AGI Plan getting started, and general endpoint configuration is covered in Custom API endpoints for Claude Code, Codex, and OpenCode.

After you change the endpoint, permission modes and your allow/deny rules keep working as before.

Next steps

Get comfortable with default mode first, then add allow and deny rules following the checklist above. If you haven't finished installing or haven't run your first task, start with How to use Claude Code: from install to your first code change. If it suddenly stops responding mid-task, check the Claude Code status page to see whether it's a server-side problem before digging into your local config.

Related articles

Keep reading