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,
.envfiles, 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
- Start with a clear prompt: Specify exactly which files/folders to work with
- Use version control: Commit before long autonomous sessions
- Isolate risky work: Docker or dedicated directories
- 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
- Claude Kit: Save Token with /plan + /code and /cook
Understanding when to use the /plan + /code combo versus the all-in-one /cook command in Claude Kit for optimal development efficiency.
- Claude Kit Installation Guide: Optimizing Workflows with Claude Code
This article introduces the essence of Claude Kit and guides you through the technical installation steps to integrate it into your project.