When to Use --dangerously-skip-permissions in Claude Code

Introduction

By default, Claude Code asks for permission before executing commands like mkdir, git status, or file operations. This is great for safety but can interrupt longer autonomous tasks. The --dangerously-skip-permissions flag removes these prompts.

What Does the Flag Do?

claude --dangerously-skip-permissions

This allows Claude Code to execute commands without requesting approval. You can create a convenient alias:

alias clauded="claude --dangerously-skip-permissions"

When to Use It

  • Well-scoped tasks: Clear requirements with defined boundaries
  • Extended autonomous sessions: Long coding or analysis tasks (hours)
  • Isolated environments: Docker containers or sandboxed setups
  • Greenfield projects: New codebases where mistakes are reversible

When NOT to Use It

  • Directories with secrets: API keys, .env files, production configs
  • Important data without backups: Datasets, ML models, databases
  • Near system configs: /etc, ~/.ssh, critical dotfiles
  • Open-ended tasks: Vague prompts without clear scope
  • Main development environment: Use dedicated project folders instead

Safety Configuration

Pre-approve specific commands in ~/.claude/settings.json:

{
  "permissions": {
    "allow": [
      "mkdir",
      "git status",
      "git diff",
      "npm install",
      "python"
    ],
    "deny": ["rm -rf", "sudo"]
  }
}

Notice: rm commands are excluded for safety.

Best Practices

  1. Start with a clear prompt: Specify exactly which files/folders to work with
  2. Use version control: Commit before long autonomous sessions
  3. Isolate risky work: Docker or dedicated directories
  4. Review changes after: Check diffs before committing

Conclusion

The --dangerously-skip-permissions flag is powerful for extended autonomous work but requires careful setup. Use it in isolated environments with clear prompts and always have backups ready.

Related Articles