Skip to content

Claude Code Complete Guide

Automate Claude Code Permission Approval in 2 Clicks: Setup Guide

Target Audience

  • Intermediate users who use Claude Code 3+ times per week and find repeated permission prompts tedious

Key Points

  1. Reduce permission prompt overhead by 95% (30s → 1.5s)
  2. Improve coding focus (80% fewer interruptions)
  3. Shorten project startup time (5min → 30s)

Core Problem

Claude Code is designed with security as a priority, prompting for confirmation on every file read/write or command execution. However, in trusted projects, these prompts disrupt development flow and interrupt your thought process.

Solution

Step 1: Global Permission Settings

The most effective automation method.

export CLAUDE_CODE_AUTO_APPROVE=true
export CLAUDE_CODE_TRUST_MODE=enabled

With this configuration, all file operations and command executions will be auto-approved.

Step 2: Project-Specific Trust Settings

To automate only for specific projects:

{
  "trusted_directories": [
    "/home/user/projects/my-app",
    "/workspace/safe-project"
  ],
  "auto_approve_file_operations": true
}

Save the configuration file to ~/.claude/trust.json.

Step 3: Security Filter Configuration

Exclude critical files to maintain safety:

{
  "excluded_patterns": [
    "*.env*",
    "*.key",
    "id_rsa*",
    "password*"
  ]
}

Files containing sensitive information will be excluded from auto-approval.

Common Issues and Solutions

SymptomCauseSolution
Settings not appliedEnvironment variable not setCheck with echo $CLAUDE_CODE_AUTO_APPROVE
Prompts appear for some filesMatches exclusion patternReview exclusion settings in trust.json
Command execution hangsInsufficient permissionsGrant script execution permission with chmod +x
Advanced Configuration (For Advanced Users - Click to Expand) ### Advanced Trust Policy Settings
{
  "policies": {
    "file_operations": {
      "read": "auto_approve",
      "write": "prompt_sensitive",
      "delete": "always_confirm"
    },
    "command_execution": {
      "safe_commands": ["ls", "cat", "grep"],
      "restricted_commands": ["rm", "sudo", "curl"]
    }
  }
}
### Temporary Full-Trust Mode For emergency use:
claude --trust-all --session-only

Next Steps