← Back to blog

Add a 'yolo' shortcut for Claude Code's skip-permissions flag

developer-tipsproductivitymacoslinux

Claude Code has a --dangerously-skip-permissions flag that stops it from asking for approval on every file edit and shell command. Useful inside a sandbox or throwaway project — but the flag is long, and I can never be bothered typing it. So I wrapped it in a shell function that lets me type claude yolo instead.


The function

Add this to your ~/.zshrc (or ~/.bashrc if you’re on bash):

claude() {
  local args=()

  for arg in "$@"; do
    if [[ "$arg" == "yolo" ]]; then
      args+=(--dangerously-skip-permissions)
    else
      args+=("$arg")
    fi
  done

  command claude "${args[@]}"
}

Reload your shell:

source ~/.zshrc

Now this:

claude yolo

expands to this:

claude --dangerously-skip-permissions

Why a function instead of an alias?

A plain alias like alias claude-yolo='claude --dangerously-skip-permissions' works, but it forces you to remember a separate command name. The function approach is nicer for a few reasons:

ApproachBehaviour
alias claude-yolo=...Separate command. Can’t mix with other flags naturally.
Shell function (this post)Same claude command you always type. yolo is just swapped in-place, everything else passes through untouched.

Because the function loops over all arguments and only replaces the literal word yolo, everything else keeps working exactly as before:

claude                          # normal, permission prompts intact
claude -c                       # continue last session, untouched
claude yolo -c                  # continue last session, skip permissions
claude yolo "fix the tests"     # prompt passes through as-is

How it works

Three small details make this robust:

  • local args=() — builds a fresh array so we can rewrite arguments without touching $@ directly.
  • command claude — this is the important one. Inside the function, calling claude again would recurse into the function itself forever. command bypasses functions and aliases and calls the real binary on your PATH.
  • "${args[@]}" — quoted array expansion preserves arguments containing spaces, so multi-word prompts survive intact.

Note: The flag is called dangerously-skip-permissions for a reason. With it enabled, Claude Code will edit files and run shell commands without asking. Only use yolo in projects under version control, containers, or environments where a wrong move is cheap to undo. Don’t run it in a directory where rm or a bad migration can hurt you.


Quick reference

# ~/.zshrc or ~/.bashrc
claude() {
  local args=()
  for arg in "$@"; do
    if [[ "$arg" == "yolo" ]]; then
      args+=(--dangerously-skip-permissions)
    else
      args+=("$arg")
    fi
  done
  command claude "${args[@]}"
}

# usage
claude yolo          # skip permission prompts
claude yolo -c       # combine with other flags freely

More developer tips at noukeosombath.com.