Skip to content
86% off$349 $48.86code BF2026

Guides

Claude Code --dangerously-skip-permissions: A Safer Setup

What Claude Code's --dangerously-skip-permissions flag turns off, and a safer setup: worktrees, hooks and rules that ask only before risky commands.

GuideUpdated 10 min read

On this page

Claude Code's --dangerously-skip-permissions flag makes it stop asking before it acts. Every tool call the agent decides to make simply runs. You don't have to choose between that and approving every ls. A safer setup has four layers:

  1. Keep Claude Code's own prompts on, in the least permissive mode you can live with.
  2. Run the agent in its own git worktree, so every edit lands on one branch you can review.
  3. Put a PreToolUse hook in front of the few actions you can't undo: pushes to main, deploys, publishing and sudo.
  4. Cap how much an agent can do without you.

This page covers each layer. It also explains which agents a hook can actually stop and which it can only watch.

What Claude Code's --dangerously-skip-permissions flag does

Normally Claude Code pauses and asks before actions it hasn't been allowed to take. The flag removes those pauses for the whole session.

It does not add a sandbox. The agent runs as your user account, which means it has your files, your SSH keys, your cloud CLI logins and your gh token. Anything your account can do, the agent can now do without stopping, including:

  • git push --force to main
  • rm -rf on a folder outside the project
  • terraform apply or kubectl delete against a real cluster
  • reading ~/.ssh or .env and sending the contents somewhere with curl

The last risk matters even if you trust the model. A coding agent reads issue text, web pages, READMEs and dependency code, and any of those can contain instructions. With prompts off, nothing stands between a planted instruction and the command it leads to. Our explainer on how coding agents work covers that loop in more detail.

The flag is a reasonable choice in one situation: a disposable environment with no secrets and nothing you'd mind losing. Our guide to trying risky software in a throwaway Mac VM covers that setup. On your everyday Mac, use the layers below instead.

Permission modes and allowlists in Claude Code

Claude Code's own prompts are the first gate, so keep them. Instead of turning them all off, pick a permission mode at launch. Sledbot's sled run command, for example, passes one of four modes to the agent: default, acceptEdits, plan or bypass. bypass is the one to keep off your main Mac.

A mode that accepts file edits but still asks about other actions is the usual middle ground. Edits are most of the prompts, and in a worktree they become a diff you can review and throw away.

Claude Code can also allow or deny specific commands in its settings, so routine commands like your test runner stop prompting. The syntax and the exact behavior of each mode have changed between releases. Take them from Anthropic's Claude Code documentation for your version rather than copying a snippet from a blog post.

Claude Code can also run a script of yours before each tool call. This is a PreToolUse hook, and it can block the call. It's the strongest guardrail you can add yourself, but you write and maintain the matching logic. Sledbot's approval rules, covered below, are built on this same hook.

Isolating the agent in a worktree

Permission settings control what the agent may run. A worktree controls what its edits touch. A git worktree is a second checkout of the same repo, on its own branch and in its own folder. The agent edits files there while your main checkout stays as you left it.

With plain git:

bash
git worktree add ../myrepo-agent -b agent/fix-login

This creates the folder ../myrepo-agent on a new branch agent/fix-login. Start Claude Code inside that folder. When you're done, remove the folder:

bash
git worktree remove ../myrepo-agent

The branch stays until you delete it.

A worktree doesn't stop shell commands. An agent in a worktree can still cd .. or push. What it gives you is a clear boundary. Every change sits on one branch you can diff, and "anything outside this folder" becomes something you can block. Our guide to Claude Code worktrees covers the setup in more depth.

Sledbot, our Mac app for running coding agents, creates the worktree for you. On its New task page, Work in a new worktree is on by default for git repos. The checkout goes in <repo>/.sledbot/worktrees/, in a folder named after the branch with / replaced by -. Sledbot also adds .sledbot/ to .git/info/exclude, so these folders stay out of git status.

From a Sledbot terminal, or any terminal once the sled command is installed, you can launch Claude Code in a worktree with a permission mode in one line:

bash
sled run --bg --worktree agent/fix-login --permission-mode acceptEdits -- claude

This starts Claude Code in the background, in a worktree on branch agent/fix-login, in acceptEdits mode.

Rules that ask only for risky actions

The goal is a setup where routine work flows and only a handful of actions wait for you. In Sledbot that layer is a set of approval rules, enforced through Claude Code's PreToolUse hook.

When Sledbot launches Claude Code, it adds its hooks to a settings file for that launch only. Your global Claude config is not changed. A risky call stops and shows up as an approval card in Needs you. From the card you can allow it once, always allow it, edit the command before it runs, or deny it with an optional note to the agent.

Rules are checked in this order, and the first match wins:

  1. A teammate set to Never allow is denied shell commands.
  2. Once the daily unsupervised cap is reached, everything asks.
  3. Your own Ask first rules.
  4. Built-in ask rules, unless one of your allow rules covers the action.
  5. Everything else is allowed. CLI agents still show their own prompts.

Sledbot splits a shell line into simple commands. If any part matches an ask rule, the whole line asks. So npm test && git push origin main waits for you.

Add your own rule

  1. Open Sledbot's settings with ⌘, (Command-Comma).
  2. Choose Approvals.
  3. Under Your rules, click Add rule.
  4. Set the effect to Ask first or Allow automatically.
  5. Enter the command pattern, for example git push * main. You can narrow the rule by tool, path, machine or teammate, and add a note.
  6. Click Save.
Sledbot Settings Approvals with one Ask first rule for the production cluster and the Built in rules

Clicking Always allow on an approval card (⌥⌘↩ on the Needs you page) also adds a rule here.

One trap: an allow rule overrides any built-in ask rule it covers. An Allow automatically rule for git push * would also let pushes to main through. Keep allow rules narrow and ask rules broad. When one of your allow rules and one of your ask rules both match, Ask first wins.

Each approval card shows the command, why the agent wants to run it, the machine and the tool. It can also carry risk tags: "can't be undone", "leaves this machine", "touches production", "outside the worktree" or "over the daily cap". If an untrusted source triggered the action, the card says "Triggered by untrusted input (<source>). Read the command before allowing." The Needs you and approvals docs cover the keyboard flow and undo.

Sledbot approval card for a git push with risk tags and Allow once, Always allow, Edit, Later and Deny buttons

Built-in rules worth copying

Sledbot ships these ask rules, and they are always on. You can use the list without Sledbot. It also works as a checklist for your own Claude Code hook script or deny settings.

Built-in ruleWhat it catches
git push to a protected branchmain, master, release/*, release-*, production, prod
Merging a pull requestAlso gh release create and gh repo delete
Deploy commandsvercel --prod, fly deploy, kubectl apply/delete, terraform apply, helm
Package publishingnpm/yarn/pnpm publish, cargo publish, pod trunk push, twine upload, gem push, docker push
rm -r outside the worktreeRecursive deletes beyond the agent's checkout
File writes outside the worktreeTemp folders excepted
Anything run with sudoAlso doas
Cloud CLI mutationsaws create/delete/put/update, gcloud create/delete/deploy, az create/delete
Outbound writescurl/wget POST, PUT, PATCH or DELETE to a non-localhost host, and any call to a production host

You can't edit the protected-branch list or the production hosts in Sledbot's interface. If you need more, add your own Ask first rules on top.

Capping unsupervised actions

Even well-chosen allow rules add up over a long run. In Sledbot, each teammate (a named, persistent agent) has two settings that bound this:

  • Running commands: Ask every time (default), Always allow or Never allow.
  • Unsupervised actions per day: 40 by default, adjustable from 0 to 1000. After the cap, everything waits for your approval, with the reason "Daily unsupervised cap reached".

Agents on remote machines have one more layer. The machine's Agents may run policy defaults to Ask every time, which sends commands to Needs you before they run there. An allow is remembered for 30 minutes per machine and terminal, and an unanswered card times out after 10 minutes.

Without Sledbot, the closest equivalent is a habit: keep prompts on for long or unattended runs, and save the skip flag for disposable environments.

What other CLI agents can and can't be stopped from doing

Only agents that run a hook before each action can be stopped. In Sledbot, blocking works for three things: Claude Code (through PreToolUse), Sledbot's own native agent, and scripts that call sled approve.

Every other CLI agent Sledbot runs is detect-and-answer. That includes Codex CLI, Gemini CLI, GitHub Copilot CLI, Cursor CLI, OpenCode and Aider. Sledbot sees the agent's own on-screen permission prompt, shows it as a card and answers it by typing the agent's keys. It cannot stop an action the agent runs without asking. Sledbot's settings say it directly: "Agents without hooks can only be watched, not stopped."

In practice:

  • For agents other than Claude Code, keep the agent's own approval prompts on. They are the only gate.
  • Don't run any agent in a "skip all approvals" mode on your main Mac and count on a dashboard to catch mistakes afterwards.
  • Sledbot's hooks only apply to agents it launches. A claude session you start in a plain Terminal window, outside sled run, doesn't get Sledbot's rules.

Which approach to use

ApproachStops risky commandsIsolates editsCost (as of November 2026)Limit
Claude Code's prompts and permission settingsAsks for anything not allowedNoIncluded with Claude CodeYou configure it per project
Your own PreToolUse hookYes, for whatever your script matchesNoFreeYou write and maintain it
Manual git worktreeNoYesFreeSetup and cleanup by hand
Sledbot rules + worktreesYes for Claude Code; watch-only for other CLIsYes, on by defaultPart of MacSuite, $349 one-timeHard blocking only where hooks exist

If you run one Claude Code session at a time, a permission mode that still asks about commands, plus a worktree, is enough. Sledbot helps when several agents run at once and you want one inbox for the few actions that need a person. Sledbot is part of MacSuite, and you can try it free for 7 days.

If it doesn't work

  • Claude Code still prompts in the terminal even though a Sledbot rule allows the action. Sledbot's allow rules don't turn off Claude Code's own prompts. Those follow Claude Code's permission mode and settings.
  • A Sledbot allow rule doesn't stop the card. An Ask first rule probably matches too, and ask wins. The teammate may also have reached its daily cap. If the teammate's Running commands is Never allow, shell commands are denied outright rather than asked.
  • A risky command ran with no card. The agent may not be Claude Code, so it was detect-and-answer and never asked. It may have been started outside Sledbot. Or one of your allow rules covered it.
  • Settings ▸ Approvals says "Approval rules need a newer Sled Core". Click Restart core in Settings ▸ General, or run sled update in a terminal.
  • There's no worktree option, or Compare agents refuses to start. The folder isn't a git repository. Make it one with at least one commit, then try again.
  • An approval from a scheduled routine shows "Expired". Routine cards expire after the routine's Approvals expire after setting (30 minutes by default), and the run is marked "waiting for you". Raise the setting in the routine's editor.

FAQ

Is --dangerously-skip-permissions ever fine to use? Yes, in a disposable environment with no credentials and nothing you'd mind losing, such as a throwaway VM. On a Mac with your SSH keys and cloud logins, keep prompts on and add a worktree and a hook instead.

Does Sledbot change my Claude Code settings? No. Its hooks go into a settings file for that one launch, and your global Claude config is left as it is.

Can I use Claude Code's permission settings and Sledbot's rules together? Yes. Claude Code's settings decide which prompts it shows in the terminal. Sledbot's hook runs before each tool call and sends the risky ones to Needs you.

If you want to know when an agent is waiting on one of these approvals, read how to get notified when Claude Code needs you.

Every app.
One purchase.