なぜ設定するのか
サンドボックス内のコマンドが通信するたびに確認が出るのを減らせます。*.example.com で サブドメイン、:443 のようにポートも絞れます。
設定方法
~/.claude/settings.jsonを開く(なければ作る)- スニペットを JSON の中に統合する。既存の設定は消さず、キーを足す形で入れる
- Claude Code を起動し直す
- 既定値
- 未設定(新しいホストごとに権限モードに従う)
- 書く場所
~/.claude/settings.json- 型
- array of strings, each a domain, wildcard pattern, or IP literal, with an optional
:portsuffix - 置ける場所
- Any file
公式ドキュメントの説明
Pre-allow domains for outbound traffic from sandboxed commands, so the sandbox doesn't prompt for them. Wildcards such as *.example.com match subdomains, and an optional :port suffix limits an entry to one port; an entry without a port matches every port.