Skip to content

Instantly share code, notes, and snippets.

@escherize
Created March 31, 2026 16:04
Show Gist options
  • Select an option

  • Save escherize/d36699fb76b2fdff301d28a1ecdf0907 to your computer and use it in GitHub Desktop.

Select an option

Save escherize/d36699fb76b2fdff301d28a1ecdf0907 to your computer and use it in GitHub Desktop.
claude-allow - Add a permission to Claude Code's allow list
#!/bin/bash
if [[ "$1" == "-h" || "$1" == "--help" || -z "$1" ]]; then
cat <<'EOF'
claude-allow - Add a permission to Claude Code's allow list
Usage: claude-allow <permission>
Appends <permission> to the permissions.allow array in ~/.claude/settings.json.
Permission format: Tool(pattern)
Tool is one of: Bash, Edit, Write, etc.
Pattern uses colon-separated segments with optional * wildcards.
Examples:
claude-allow 'Bash(npm test:*)' # Allow all "npm test" commands
claude-allow 'Bash(git status:*)' # Allow git status
claude-allow 'Edit(/path/to/file.ts)' # Allow editing a specific file
claude-allow 'Read(/src/**)' # Allow reading files under /src
Requires: jq
EOF
exit 0
fi
jq --arg v "$1" '.permissions.allow += [$v]' ~/.claude/settings.json > ~/.claude/settings.json.tmp && mv ~/.claude/settings.json.tmp ~/.claude/settings.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment