CLI wrapper for Claude to load default options from .env files
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-13 15:02:42 +00:00
.env.example Initial commit: CLI wrapper for Claude options management 2026-10-13 15:02:42 +00:00
claude Initial commit: CLI wrapper for Claude options management 2026-10-13 15:02:42 +00:00
README.md Initial commit: CLI wrapper for Claude options management 2026-10-13 15:02:42 +00:00

Claude Wrapper Script

A bash wrapper for the Claude CLI that automatically loads default options from a .env file in your working directory.

Why?

Instead of typing the same flags every time you work in a service-specific folder:

cd ~/workspace/google-service
claude --chrome --dangerously-skip-permissions

You can set defaults once and just run:

cd ~/workspace/google-service
claude

Installation

Copy the claude script to a location in your PATH:

cp ~/workspace/claude/claude-wrapper/claude ~/.local/bin/claude

Or symlink it:

ln -s ~/workspace/claude/claude-wrapper/claude ~/.local/bin/claude

Make sure ~/.local/bin is in your $PATH. You can check with:

echo $PATH | grep -q "$HOME/.local/bin" && echo "✓ in PATH" || echo "✗ not in PATH"

Usage

Set Up Defaults

Create a .env file in your project/service directory:

cd ~/workspace/my-service
echo 'CLAUDE_FLAGS=--chrome --dangerously-skip-permissions' > .env

Run Claude

Now just run claude normally — it will automatically load flags from .env:

claude
# Equivalent to: claude --chrome --dangerously-skip-permissions

Override Defaults

Pass flags on the command line to override .env defaults:

# .env has: CLAUDE_FLAGS=--no-chrome
claude --chrome

# The wrapper passes: --no-chrome --chrome
# Result: --chrome wins (last flag takes precedence)

How It Works

  1. The wrapper looks for a .env file in your current working directory
  2. Extracts the CLAUDE_FLAGS variable
  3. Prepends those flags to any CLI arguments you pass
  4. Calls the real claude command with the merged arguments

Since CLI args come last, they naturally override .env defaults.

Examples

Example 1: Google Service Setup

# ~/workspace/google-service/.env
CLAUDE_FLAGS=--chrome --dangerously-skip-permissions

Example 2: Multiple Flags with Quotes

# .env
CLAUDE_FLAGS=--chrome --model claude-opus-5 --timeout 300

Example 3: No Defaults

# If no .env file exists, wrapper just passes through to claude normally

Troubleshooting

"claude binary not found in PATH"

  • Make sure your actual Claude CLI is installed and in your $PATH
  • Check with: which claude (should show the real binary, not the wrapper)

Flags aren't being picked up

  • Verify the .env file exists in your working directory
  • Check the variable name is exactly CLAUDE_FLAGS (case-sensitive)
  • Verify the format: CLAUDE_FLAGS=value

The wrapper is being called instead of the real claude

  • Make sure ~/.local/bin (where the wrapper lives) comes after the real Claude location in your $PATH
  • Or use an alias: alias claude='command claude' to force the real binary

Notes

  • The wrapper uses CLAUDE_FLAGS (uppercase) as the variable name
  • Flags in .env are space-separated, just like command-line arguments
  • Multi-word arguments should be quoted in .env if needed
  • The wrapper preserves all shell escaping and quoting