squidbrake

Guide

Claude Code --dangerously-skip-permissions: how to use it safely

Claude Code's --dangerously-skip-permissions flag, often called YOLO mode, stops it asking before it runs commands and edits files. It is the fastest way to work, and it is how a developer lost their home folder in December 2025. You don't have to choose between speed and safety. Here is what the flag turns off, what it doesn't, and how to keep it on without betting the machine.

In short

  • The flag skips Claude Code's permission prompts. It does not skip hooks.
  • A PreToolUse hook can still refuse a call, or hold it for a person, with the flag on.
  • Let reads, tests and git-tracked edits run freely; hold deletes, force pushes and cloud changes; block the few catastrophic commands.
  • On a team, managed settings can turn the flag off and make the hook mandatory.

What the flag does

By default Claude Code asks before it runs a shell command, edits a file or calls an MCP tool you haven't allowed. Start it with claude --dangerously-skip-permissions and it stops asking: the session runs in bypassPermissions mode and every tool call goes straight through. People use it for long refactors, overnight runs and anything where approving 200 prompts would take longer than the work.

The name is honest. With no prompts, the only thing between the model and rm -rf is the model's own judgement, and that judgement can be wrong or can be steered by text it read in an issue, a README or a web page.

What still runs with the flag on

What --dangerously-skip-permissions skips, and what still runs A tool call goes to the PreToolUse hook, which still runs, then to the permission prompt, which the flag skips, then to the tool. The hook can allow, hold for a teammate, or block. Claude Codewants to run a tool PreToolUse hookstill runs with the flag Permission promptSKIPPED BY THE FLAG Tool runs Allowreads, tests, edits in git Holda teammate approves Blockrm -rf ~, wiping a drive ONE TOOL CALL, WITH --dangerously-skip-permissions ON
The flag removes Claude Code's own "may I?" prompts. Hooks are a separate layer that Claude Code calls before every tool, and it tells them the session is in bypassPermissions mode, so a hook can still refuse the call or send it to a person.

Hooks are commands Claude Code runs at fixed points. A PreToolUse hook runs before every tool call, receives the tool name and its input as JSON, and answers. Claude Code passes it the current permission_mode, including bypassPermissions, and the hook can still return "permissionDecision": "deny". That makes hooks the right place for a safety net in YOLO mode: they don't depend on the prompts the flag removes.

# ~/.claude/settings.json: a PreToolUse hook on every tool
{
  "hooks": {
    "PreToolUse": [
      { "matcher": "*", "hooks": [{ "type": "command", "command": "squidbrake hook", "timeout": 600 }] }
    ]
  }
}

Check this on your own version before you rely on it: run a session with the flag, ask for a command your hook denies, and watch it get refused. squidbrake doctor does that check for you.

What goes wrong in YOLO mode

These are public incidents we replay in our benchmark, none with a rule written for the occasion:

IncidentWhat the agent ranResult
Claude Code deletes a home folder (Dec 2025)rm -rf tests/ patches/ plan/ ~/Blocked
Antigravity wipes a D: drive (Dec 2025)rmdir /s /q d:\ in auto-executeBlocked
An agent deletes a production volume and its backups (Apr 2026)Found a token, called Railway's volumeDeleteHeld
A Slack message rewrites Cursor's MCP config (CVE-2025-54135)Edits ~/.cursor/mcp.jsonHeld

Note the first row. A trailing ~/ on an otherwise reasonable cleanup command. No prompt-level instruction would reliably catch that; a parser that reads the command does.

Five ways to keep YOLO mode safe

  1. Run it somewhere disposable. A dev container, a VM or a fresh clone with no production credentials. This is the strongest control and the one most people skip because it's inconvenient.
  2. Keep credentials out of reach. The Railway incident started with a token sitting in the repo. Tokens the agent can read are tokens the agent can use.
  3. Put a checkpoint in a PreToolUse hook. Let reads, searches, builds, tests and edits inside git run on their own. Hold what can't be taken back for a person: deletes outside git, destructive SQL, git push --force, terraform destroy, cloud API deletes, changes to the agent's own settings. Block the handful nobody should approve in the moment: deleting a home folder or a drive.
  4. Keep an undo. Squidbrake copies files, and the git state, right before an approved delete, git reset or git clean runs, so squidbrake undo puts them back.
  5. Look at the session, not just the step. Reading .env is fine. Reading .env and then curl-ing it to an address from a web page the agent fetched is not.

Doing it with Squidbrake

pipx install squidbrake
squidbrake connect claude-code     # adds the PreToolUse hook
claude --dangerously-skip-permissions

Routine work keeps flowing. When Claude Code reaches for something it can't take back, the call waits and a teammate sees what it will change ("deletes 4,312 rows of 10,240 in orders") on Slack, their phone or the dashboard. The rules are one YAML file; the check takes a few milliseconds and uses no LLM.

On a team: turn the flag off centrally

For a company, the better answer is often "nobody runs with the flag and nobody can remove the hook". Claude Code reads a managed settings file that users can't override. squidbrake lockdown --url https://gateway.yourcompany.com writes that file for Claude Code (and the equivalents for Codex, Gemini CLI and Cursor): Squidbrake's hook, only managed hooks allowed, and --dangerously-skip-permissions disabled. IT pushes it with the MDM you already use. See the docs for paths per OS.

FAQ

Is --dangerously-skip-permissions the same as YOLO mode?

Yes, informally. Claude Code calls it bypassPermissions mode; people call it YOLO mode, the same name Cursor and Gemini CLI use for their auto-run settings.

Do Claude Code hooks run with --dangerously-skip-permissions?

Yes. Hooks are a separate layer from permission prompts. A PreToolUse hook receives permission_mode "bypassPermissions" and can still deny the call. Test it on your version before relying on it.

Is auto mode safer than --dangerously-skip-permissions?

Auto mode decides each step with a classifier, which is a real improvement, but the same person running the agent is still the only one who can say yes. For the small set of irreversible actions, a rule-based hold for a second person is stronger.

Can I block rm -rf in Claude Code?

Yes, with a PreToolUse hook that parses the command. Matching the text "rm -rf" is not enough: the December 2025 incident hid ~/ at the end of a normal-looking cleanup, and variations like find -delete or a script do the same thing.

Can a team stop developers using the flag?

Yes. Claude Code's managed settings file can disable bypassPermissions mode and allow only managed hooks. squidbrake lockdown generates it.

Try it on your own agents. pipx install squidbrake, then squidbrake connect all. Start in shadow mode: nothing is blocked in week one, you see what would have been. Quickstart · Benchmark · Book a demo