AIFCC
記事一覧へ
claude-setupharness-designclaude-workflowsettings-json

Claude設定18選:知られていない設定でコストとパフォーマンスを最適化する

856
Anthropicは125個以上のキーをClaude Codeのsettings.jsonに導入しています。公式ドキュメントがカバーしているのは約40個です。 不足している14個はClaude.aiのUIで3クリック奥に潜んでいます。4個はどのドキュメントにも一切掲載されていません。それらを見つけるには、GitHubのIssueを読み、エンジニアがDiscordで漏らすのを見ていたり、深夜1時にClaude Codeバイナリをgrepしたりする必要があります。 ほとんどのClaudeユーザーは、Anthropicが半年前に出荷した設定のままで動かしています。請求額はじわじわ増える。出力はぶれる。彼らはモデルのせいにします。 以下は実際にあなたのClaudeを動かしている18の設定です。 - Claude dot aiで8つ - Claude Codeで7つ - APIとConsoleで3つ それぞれについて:どこにあるか、何をするか、ワンライナーの修正方法。 ## Section 1: Claude(8設定) ### 1. Memory:スコープ、除外リスト、「これを忘れて」コマンド どこにあるか:Settings → Capabilities → Memory 何をするか:Memoryは2026年3月にFreeとProに展開されました。デフォルトではClaudeが保存する価値があると判断したすべてのものを保存します。ほとんどの人が見逃す3つのコントロールがあります:プロジェクトスコープ、除外リスト、インラインの忘れコマンドです。 なぜ重要か:デフォルトのメモリはドリフトします。4〜6週間後には一時的な修正(「Pythonではタブが好み」とあるファイルについて一度言ったもの)、無関係なチャットに漏れ出すプロジェクト固有の事実、古くなったロールコンテキストでいっぱいになります。ClaudeはいまやWrongな「あなた」に最適化しているため、出力品質が低下します。 修正方法: プロジェクトスコープのメモリをオンにする:Settings → Capabilities → Memory → Scope per Project。Projectの中のメモリはそのProjectの中に留まります。これだけでほとんどのドリフトが解消されます。 無関係なチャットに浮上させたくないトピックは除外リストに追加します。例:離婚、医療、給与の数字、クライアント名。これらは除外されない限り、コンテキストに関係なく持続します。 任意のチャットでインラインの忘れコマンドを使用する:`forget what you remembered about [topic]` Claudeはメモリストアに対してそれをパースし、削除したものを確認します。メニューなし、設定ページなし。 ### 2. Extended Thinking:チャットごとのトグル どこにあるか:チャット入力 → モデルセレクタードロップダウン → Extended Thinking: Off / Light / Full 何をするか:Extended Thinkingは回答前に`<thinking>`推論パスを追加します。AnthropicはOpusでデフォルトでオンにして出荷しています。3段階のトグルはチャットごとで、グローバル設定を上書きします。 なぜ重要か:Extended Thinkingは数学、デバッグ、多段階計画に最適です。要約、翻訳、フォーマット、書き直し、クイックルックアップには無駄です。これらのタスクでは、同じ回答に3〜12秒のレイテンシーと20〜40%多いトークンが追加されます。 修正方法:デフォルトをLight(モデルが有用と判断した場合のみ思考を使用)に設定し、困難な作業にはFullに明示的に切り替えます。これを見せるほとんどのユーザーは、最初の週でOpusのトークン支出を18〜25%削減します。 ### 3. Custom Styles:「声」ではなく、実際の出力契約 どこにあるか:チャット入力 → スタイルセレクター → Create New Style 何をするか:Stylesはトーントグル(「Formal / Concise / Explanatory」)として始まりました。Custom Stylesは実際には出力契約です。200〜1500ワードの指示ファイルを貼り付けます。そのスタイルのすべてのレスポンスは、生成前にそれを適用します。 なぜ重要か:ほとんどの人は「短くして」にStylesを使用します。本当の用途は、毎回貼り付けなしにすべてのレスポンスにわたって構造ルールを適用することです。引用形式。禁止ワード。必須セクション。コードフェンス言語。長さの上限。フォローアップの質問をするかどうか。 修正方法:ワークフローごとに1つのStyleを作成します。私のもの: ```markdown # Style: Draft for X Output contract: - Open with one concrete number or named entity. No "I've been thinking..." - Sentences under 18 words where possible. - No em-dashes unless rhythm requires. - No "delve", "leverage", "robust", "unlock", "game-changing". - If listing 3+ items, use a hyphen list, not numbered. - End on a statement, not a question. If a draft exceeds 280 characters and the user didn't ask for a thread, say so before answering. ``` ローテーションでこれを3つ使う(Draft for X、Code review、Summarize PDF)と、保存プロンプトの80%が置き換えられます。 ### 4. Projects:ほとんどの人が空白にしている「instructions」フィールド どこにあるか:任意のProject → 右上の⋯ → Edit project instructions 何をするか:Projectsは永続ワークスペースです。instructionsフィールドは、そのProject内のすべてのチャットに注入されるシステムプロンプト相当です。AnthropicはProjectsをナレッジアップロード機能とともに紹介しています(これが人々が覚えていること)。instructionsフィールドは同じページにあり、目にする実環境のProjectsの70%が空白です。 なぜ重要か:それなしにProjectの全チャットがコールドスタートします。それがあれば、コンテキストの再確立をやめることができます。(「これはPolymarkの調査ワークフローです。デフォルトで懐疑的に。常に確率の計算を表示。取引は推奨しない—EVの組み立てだけ。」) 修正方法:ClaudeのCLAUDE.mdのように扱います。400ワード以内に収めます。ロール、デフォルトの懐疑レベル、フォーマットルール、やってはいけないことを指定します。月に一度読み直してプルーニングします。 ### 5. 過去チャットの検索(Pro+)と実際の検索方法 どこにあるか:Settings → Profile → Search past chats(有効化が必要) 何をするか:関連する場合にClaudeが会話履歴を検索できるようにします。Pro+のみ。 なぜ重要か:Proでも新しいアカウントではデフォルトでオフ。オンにすると、キーワードマッチであってセマンティックではないことを知っておく必要があります。「昨日、中国のロボットについて何を話しましたか」は、過去のチャットに文字通り「中国のロボット」または「中国」と「ロボット」が含まれていない限り何も返しません。 修正方法:オンにする。次に実際のクエリの形を学ぶ。コンテンツ名詞であり、メタワードではない。「Polymarket Iran」は機能する。「先週話したあのこと」は機能しない。 ### 6. Web検索:会話ごとのトグルと引用の挙動 どこにあるか:チャット入力 → + → Web search: On / Off 何をするか:ウェブ検索トグルは会話ごとですが、挙動はSettings → Capabilities → Web search citations: Inline / Footnotes / Hiddenのあまり知られていない設定に基づいて変わります。 なぜ重要か:デフォルトはInlineです。インライン引用はコピー&ペーストを壊します。Claudeのアンサーをどこかにコピーすると、どこにも指し示さないマーカーをコピーすることになります。Footnotesモードはアンサーをクリーンに保ち、最後にソースをリストアップします。 修正方法:ClaudeのWebサーチアンサーを別のドキュメント、メール、またはメッセージにコピーすることがあればFootnotesに切り替えます。Claude内部で全部読む場合のみInlineを維持します。 ### 7. Connectors:Coworkの「このフォルダーを信頼する」トラップ どこにあるか:Settings → Connectors → Cowork → Trusted folders 何をするか:Cowork(2026年4月GA)はClaudeにマシン上のフォルダへのアクセスを与えます。デフォルトでは、AnthropicはCoworkの各セッションでフォルダを信頼するかどうかを尋ねます。信頼済みフォルダリストはバイパスです。 なぜ重要か:フォルダが信頼済みに入ると、ClaudeはプロンプトなしですべてのCoworkセッションでそれから読み込みます。3月のテストでフォルダを追加して忘れていた場合、Claudeはそれ以来のすべてのセッションで静かにそれを読み込んでいます。 修正方法:信頼済みフォルダを開きます。現在アクティブなプロジェクトでないものはすべて削除します。リストは予想より速く増えます。 ### 8. Incognitoモードとその実際にスキップするもの どこにあるか:サイドバー → New incognito chat(またはCmd/Ctrl + Shift + N) 何をするか:Incognitoチャットは保存されず、メモリに記録されず、検索不可で、モデル改善に使用されません。チャットはクローズすると削除されます。 なぜ重要か:IncognitoはチャットをサイドバーからHideするだけだと思われています。実際には4つのシステムをスキップします:メモリの書き込み、チャット履歴、過去チャット検索インデックス、トレーニングデータのオプトイン(オンにしている場合)。 修正方法:機密データのある場合は意図的に使用する:給与、医療、家族、法的ドラフト、クライアント名。3キーストローク、考える必要なし。 ## Section 2: Claude Code(7設定) これらは`~/.claude/settings.json`(ユーザーレベル)または`.claude/settings.json`(プロジェクトレベル)にあります。後者が優先されます。 v2.1.105バイナリには125個以上のキーがあります。以下の7つは実際に差をもたらすものです。 ### 9. enabledPlugins - アンインストールではなく、無効化 どこにあるか:`~/.claude/settings.json` → enabledPlugins 何をするか:セッション起動時にどのインストール済みプラグインがロードされるかを設定します。Pluginマーケットプレイスはインストールを簡単にします。アンインストールは難しく、値をfalseに設定するだけなら不要です。 なぜ重要か:すべてのアクティブなプラグインは、そのフック、SKILL.mdコンテンツ、ツールスキーマをコンテキスト予算にロードします。忘れていた3つのプラグイン = 何も入力する前の3〜8Kトークンの先払い。 このauditを始めた時、14のプラグインが有効でした。今はアクティブが4つ。 修正方法: ```json { "enabledPlugins": { "formatter@acme-tools": true, "deployer@acme-tools": false, "analyzer@security-plugins": false, "old-experiment@personal": false } } ``` falseにするとプラグインはインストールされたままだがアンロードされます。実際に必要な時に`/plugin enable name@marketplace`でセッションごとに再有効化します。 ### 10. permissions.deny - バグについて知っておくべきこと どこにあるか:`~/.claude/settings.json` → permissions.deny 何をするか:Claudeが特定のツールを実行したり特定のファイルにアクセスしたりするのをブロックします。意図:rm -rfの防止、.envの読み取り防止、プロジェクト外への書き込み防止。 なぜ重要か:既知のバグがあります。Denyルールが時々ブロックしないことがあります。複数のGitHub Issueが提出済み。最もよく引用されるもの(anthropics/claude-code#11544)は有効なconfigにもかかわらずフックがロードされないことを記録しています;同様のパターンがdeny実施に影響します。ルールはconfigにあります。デバッグログには「0 matchers found.」と表示されます。Claudeはとにかくファイルを読みます。 修正方法: ```json { "permissions": { "deny": [ "Read(.env)", "Read(.env.*)", "Read(**/*secret*)", "Bash(rm -rf:*)", "Bash(sudo:*)" ] } } ``` ファイルシステムレベルに第2の層を追加します。`chmod 600 .env`で、たとえClaudeが読もうとしてもOSが拒否します。denyリストだけを信頼しないでください。Claude Code内の`/permissions`で確認します。ルールが表示されない場合はセッションを再起動します。 ### 11. hooks.SessionStart - コンテキスト膨張を30%削減した4行 どこにあるか:`~/.claude/settings.json` → hooks.SessionStart 何をするか:SessionStartはClaude Codeをディレクトリで開くと発火します。envの情報を印刷する、gitの状態をlintする、コンテキストファイルを注入する、キャッシュをウォームアップするなど、何でも実行できます。 なぜ重要か:ほとんどの人が注入しすぎます。すべてのプロジェクトルールが入ったためCLAUDE.mdが5Kトークンまで膨れ上がります。SessionStartでは現在のブランチまたはディレクトリに関連するルールだけをロードできます。 修正方法: ```json { "hooks": { "SessionStart": [ { "matcher": "startup", "hooks": [ { "type": "command", "command": "cat .claude/context-$(git branch --show-current).md 2>/dev/null || true" } ] } ] } } ``` mainブランチはcontext-main.mdをロードします。feat/authブランチはcontext-feat-auth.mdをロードします。各ファイルは小さいまま。コンテキスト予算の出血が止まります。 ### 12. disableAllHooks - パニックスイッチ どこにあるか:`~/.claude/settings.json` → disableAllHooks: true 何をするか:1つのトグルですべてのフックを無効にします。2026年3月のアップデートで導入。ほとんどの人がその存在を知りません。 なぜ重要か:Claude Codeが奇妙な挙動をし始めた時(ファントムコマンドが実行される、セッションが起動時にハングする、謎のファイル書き込み)、80%の場合は誤動作するフックが原因です。フックを一つ一つ無効にするのは遅い。これが一度に全部を終わらせてくれるので、問題を切り分けられます。 修正方法:falseのままにしておきます。何かが壊れたらtrueに切り替えて再起動し、問題がなくなるかどうか確認します。そうであれば、フックを一つ一つ再有効化します。そうでなければ、バグは別の場所にあります。 ### 13. プロジェクトごとのモデルオーバーライド どこにあるか:`.claude/settings.json`(プロジェクトルート)→ model 何をするか:そのプロジェクトのデフォルトモデルを設定します。グローバル設定を上書きします。 なぜ重要か:ほとんどの人は難しい作業のためにOpusをグローバルに設定します。次にMarkdown編集やシェルスクリプトが主なプロジェクトを開きます。Haikuが1/20のコストでこなせるタスクにOpus料金を支払っています。 修正方法: ```json // /docs プロジェクト内: { "model": "claude-haiku-4-5-20251001" } // /infra プロジェクト内: { "model": "claude-sonnet-4-6" } // /core-engine プロジェクト内: { "model": "claude-opus-4-7" } ``` プロジェクトレベルのオーバーライドが優先されます。プロジェクトを開いて、正しいモデルを得る。次に進む。 ### 14. enabledフラグ付きのmcpServers どこにあるか:`~/.claude/settings.json` → mcpServers 何をするか:MCPサーバーはClaudeを外部ツールに接続します。接続された各サーバーは完全なツールスキーマをコンテキストにロードします。サーバーごとに800〜6,000トークンです。 なぜ重要か:テストのためにMCPサーバーに接続して、切断しない。3ヶ月後には12個が接続されており、アクティブに使用しているのは3個。9個の未使用サーバーがすべてのセッション開始時に〜25〜40Kトークンのコンテキストスキーマコストをかけています。 修正方法:enabledフラグを使用して接続設定を保持しつつアンロードします。 ```json { "mcpServers": { "github": { "command": "...", "enabled": true }, "postgres": { "command": "...", "enabled": true }, "slack": { "command": "...", "enabled": false }, "linear": { "command": "...", "enabled": false } } } ``` 実際に必要な時にセッションごとにtrueに切り替えます。ほとんどの日は2〜3つがアクティブ。計画日には6つ。 ### 15. cleanupPeriodDays - 誰も言及しないキャッシュ どこにあるか:`~/.claude/settings.json` → cleanupPeriodDays 何をするか:Claude Codeがトランスクリプト、デバッグログ、中間セッションデータを保持する日数を設定します。デフォルトは30。 なぜ重要か:DreamingとPast-chat searchはどちらもこれらのトランスクリプトに依存しています。デフォルトの30日間ウィンドウでは、Dreamingは1ヶ月分の作業からしか学べません。6ヶ月では6倍のシグナルが得られます。ディスクコスト:約200MB。 修正方法: ```json { "cleanupPeriodDays": 180 } ``` 180日分のセッション履歴がDreaming、メモリ統合、そして「3月のあのauth bugについてClaudeに何を言ったか」を探す時の自分のgrepに利用可能になります。 ## Claude Codeアーティファクト:7つの設定が適用された1つのsettings.json これを`~/.claude/settings.json`にコピーします。パスとプラグイン名を自分のものに調整します。Claude Codeを再起動します。`/permissions`と`/hooks`を再実行してすべてがロードされたことを確認します。 ```json { "model": "claude-sonnet-4-6", "enabledPlugins": { "formatter@acme-tools": true, "old-experiment@personal": false }, "permissions": { "deny": [ "Read(.env)", "Read(.env.*)", "Read(**/*secret*)", "Bash(rm -rf:*)", "Bash(sudo:*)" ] }, "hooks": { "SessionStart": [ { "matcher": "startup", "hooks": [ { "type": "command", "command": "cat .claude/context-$(git branch --show-current).md 2>/dev/null || true" } ] } ] }, "disableAllHooks": false, "mcpServers": { "github": { "command": "npx", "args": ["@modelcontextprotocol/server-github"], "enabled": true }, "postgres": { "command": "npx", "args": ["@modelcontextprotocol/server-postgres"], "enabled": false }, "slack": { "command": "npx", "args": ["@modelcontextprotocol/server-slack"], "enabled": false } }, "cleanupPeriodDays": 180 } ``` プロジェクトレベルのオーバーライドはプロジェクトルートの`.claude/settings.json`に入ります。そこに設定する最も有用なもの: ```json // .claude/settings.json(docsプロジェクト内) { "model": "claude-haiku-4-5-20251001" } ``` ## Section 3: APIとConsole(3設定) これらはコードまたはAnthropicConsoleに存在します。記事の中で最もコストに影響する設定です。それぞれが請求を30〜90%変えることができます。 ### 16. cache_controlブレークポイント:どこに置くか どこにあるか:APIリクエストボディ、任意のコンテンツブロックのcache_controlフィールド 何をするか:プロンプトのプレフィックスをキャッシュ可能とマークします。同じプレフィックスを持つ後続のリクエストは、フルレートではなく入力レートの約10%で課金されます。 なぜ重要か:これはAPIの中で最大の単一コストレバーです。人々はその存在を知っています。ほとんどはブレークポイントを間違えて、最大の節約ではなく部分的な節約を得ています。私自身のセットアップでは、ブレークポイントを修正して月340ドルの請求が87ドルになりました。 修正方法:ブレークポイントは静的コンテンツと動的コンテンツの境界に置きます。ブレークポイントより前のものはキャッシュされます。ブレークポイントより後のものは再計算されます。 ```python # 間違い — ブレークポイントがユーザーメッセージの後、何もキャッシュ可能なものがない messages = [ {"role": "system", "content": SYSTEM_PROMPT}, {"role": "user", "content": user_question, "cache_control": {"type": "ephemeral"}} ] # 正しい — ブレークポイントが安定したシステムプロンプトの後、次の呼び出しでフルキャッシュヒット messages = [ {"role": "system", "content": SYSTEM_PROMPT, "cache_control": {"type": "ephemeral"}}, {"role": "user", "content": user_question} ] ``` 2つのTTLが利用可能:5分間のエフェメラル(デフォルト)と1時間。セッション間で変わらないシステムプロンプトには1時間を使用する: ```python {"cache_control": {"type": "ephemeral", "ttl": "1h"}} ``` キャッシュ書き込みは基本入力より25%高くなります。キャッシュ読み取りは基本入力の10%です。クロスオーバー:キャッシュされたプレフィックスはTTLウィンドウ内で2回以上読まれれば元が取れます。 ### 17. inference_geoとデータレジデンシー税 どこにあるか:APIリクエスト → inference_geoパラメータ 何をするか:特定の地理的地域への推論をルーティングします。US専用レジデンシー、EU専用など。 なぜ重要か:US専用データレジデンシーはOpus 4.7以上で10%のプレミアムを追加します。標準的な価格表には載っていません。請求書で見ることになります。 修正方法:コンプライアンス要件が地域的レジデンシーを実際に要求していないなら、inference_geoを設定しないでください。ほとんどのアプリは「安全のため」と法務担当者が「データを米国内に留めることを確認してください」と言ったためにデフォルトで設定しています。要件が契約上のものか願望的なものかを確認してください。願望的であれば、パラメータを省略して全Opus呼び出しで10%節約します。 必要な場合は、モデル選択に10%を織り込みます。Sonnetのベース3ドルは実質的に3.30ドルになり、Opusとの損益分岐点が変わります。 ### 18. ワークスペースレベルのレート制限(午前3時の障害を防ぐもの) どこにあるか:Console → Settings → Workspaces → [あなたのワークスペース] → Per-feature rate limits 何をするか:アカウントレベルの制限とは別に、ワークスペースごと、機能ごとのレート制限を設定します。 なぜ重要か:アカウントレベルの制限はあなたが破産から守ります。ワークスペースレベルの制限は、暴走したバッチジョブが全ITPM許可量を食い尽くそうとするときにインタラクティブな製品を守ります。新機能をリリースし、バグが発生し、ループし、すべてを消費し、顧客向けチャットが429を返し始めます。ワークスペース制限により1つの機能が別の機能を飢えさせることはありません。 修正方法:サーフェスごと(インタラクティブチャット、バッチ処理、内部ツール、実験的)に1つのワークスペースを作成します。各ワークスペースのレート制限をアカウントティアの60〜70%に設定します。バーストが必要なワークスペースのために30%を予約します。 この記事の4番目の未文書化設定:各ワークスペース内にワークスペースの概要ではなく特定の機能カードをクリックした場合にのみ見える機能レベルのキャップがあります。デフォルト=無制限。 1つのワークスペースに3つの機能がある場合、そのうちの1つが他の2つを飢えさせる可能性があり、ワークスペースレベルの制限はそれをキャッチしません。バッチ作業を行うものに対して機能ごとのキャップを設定します。 ## Section 4: 18項目チェックリスト 一度通してみてください。20分。12ヶ月で触れないものは、おそらく永遠に触れません。 ```markdown ## Claude.ai - [ ] #1 Memory: project-scopedオン、除外リスト充填済み - [ ] #2 Extended Thinking: デフォルト = Light - [ ] #3 Custom Styles: 少なくとも1つのワークフロースタイル作成済み - [ ] #4 Project Instructions: すべてのアクティブなProjectに記入済み - [ ] #5 Past-chats search: オン(Pro+) - [ ] #6 Web search citations: Footnotesモード - [ ] #7 Cowork trusted folders: 確認済み、整理済み - [ ] #8 Incognito: キーボードショートカット記憶済み ## Claude Code - [ ] #9 enabledPlugins: アクティブなもののみ = true - [ ] #10 permissions.deny: envファイル + sudo + rm -rfがブロック済み、OSレベルのバックアップあり - [ ] #11 hooks.SessionStart: ブランチ対応コンテキストローダー - [ ] #12 disableAllHooks: false(スイッチの場所を知っておく) - [ ] #13 model: docs/infra/coreプロジェクトにプロジェクトごとのオーバーライド設定済み - [ ] #14 mcpServers: enabledフラグ使用、完全削除ではない - [ ] #15 cleanupPeriodDays: 180 ## API / Console - [ ] #16 cache_control: 安定したシステムプロンプトの後にブレークポイント、日次安定プレフィックスには1h TTL - [ ] #17 inference_geo: コンプライアンスが実際に要求する場合のみ設定 - [ ] #18 ワークスペースレート制限: ワークスペースごとAND機能ごとのキャップ設定済み ``` ## Section 5: 監査スクリプト(週1回実行) これを`~/bin/claude-audit.sh`に入れます。週1回実行します。チェックリストのClaude Code半分とAPI半分のcache_control側をフラグ立てします。 ```bash #!/usr/bin/env bash # claude-audit.sh — 7つのClaude Code + 1つのAPIチェックにわたる設定のドリフトをフラグ立て CLAUDE_DIR="$HOME/.claude" SETTINGS="$CLAUDE_DIR/settings.json" echo "=== 有効なプラグイン ===" jq '.enabledPlugins // {} | to_entries | map(select(.value==true)) | length' "$SETTINGS" 2>/dev/null echo "目標: 3-5アクティブ。残りはセッションごとに再有効化。" echo echo "=== 有効なMCPサーバー ===" jq '.mcpServers // {} | to_entries | map(select(.value.enabled==true)) | length' "$SETTINGS" 2>/dev/null echo "目標: 常時3つ。残りはセッションごとに有効化。" echo echo "=== permissions.denyルール存在確認 ===" jq '.permissions.deny // [] | length' "$SETTINGS" 2>/dev/null echo "目標: >=5ルール。.env / sudo / rm -rf 最低限。" echo echo "=== SessionStartフック設定確認 ===" jq '.hooks.SessionStart // [] | length' "$SETTINGS" 2>/dev/null echo "目標: >=1エントリ。" echo echo "=== cleanupPeriodDays ===" jq '.cleanupPeriodDays // 30' "$SETTINGS" 2>/dev/null echo "目標: 180。" echo echo "=== プロジェクトごとのモデルオーバーライド ===" find . -maxdepth 3 -name "settings.json" -path "*/.claude/*" 2>/dev/null | while read f; do model=$(jq -r '.model // "—"' "$f") echo " $f → $model" done echo "目標: docs → haiku、infra → sonnet、core → opus。" echo echo "=== APIのcache_controlチェック(実行するにはAPI_KEYを設定) ===" if [ -n "$ANTHROPIC_API_KEY" ]; then echo "手動チェック: 1Kトークン以上のすべてのsystem_promptには1h TTLのcache_controlが必要です。" else echo "スキップ — 有効化するにはANTHROPIC_API_KEYを設定してください。" fi ``` `chmod +x ~/bin/claude-audit.sh`で保存し、各行がターゲットになるまで週1回実行します。 ## Section 6: カットされたもの 公開前に4つの候補を削除しました。追いかけて時間を無駄にしないように名前を挙げておきます。 **Adaptive Reasoningトグル。** Anthropicはこれをデフォルトオンでリリースしました。オーバーライドはSettings → Capabilities → Reasoning modeにあります。30日間の比較でオーバーライドが結果を意味のある形で変えたワークフローを見つけられませんでした。デフォルトを信頼して先に進む。 **スキルの自動アクティベーション。** 関連性検出に基づいてClaudeがスキルを自動ロードするか、明示的な呼び出しが必要かをトグルできます。これが重要だと思っていました。重要ではありませんでした。プログレッシブディスクロージャー付きの自動アクティベーション(SKILL.mdメタデータのみを必要になるまでロードする)は十分にチューニングされています。そのままにします。 **モバイル→デスクトップコントロールのDispatch。** 便利な機能ですが、設定監査項目ではありません。このワークフローが合うかどうかは自分次第です。隠しトグルで結果は変わりません。 **ワークスペースごとのmax_tokens上限。** すべてのレスポンスを800、2000、または4000でトランケートするよう強制できます。おしゃべりなワークフローで実際のお金を節約しますが、長い出力が必要なコード生成を壊します。ワークスペースごとにテストする価値あり。デフォルトとして推奨する価値なし。 --- T H E _ E N D 今夜チェックリストを確認してください。ほとんどの人は6〜8個を修正するでしょう。一部の人は14個以上修正するでしょう。請求ダッシュボードと使用量グラフの数字が20分の価値があったかどうかを教えてくれます。 ブックマークして今夜チェックリストを確認してください。これで1ヶ月分の「Claudeが馬鹿になった」フラストレーションが節約できるなら、シェアしてください。 Telegram(AIの日々のヒント): https://t.me/+_ZWrQN7GuDA3ZDEy
原文を表示 / Show original
Anthropic shipped 125+ keys to Claude Code's settings.json. The official docs cover roughly 40. 14 of the missing ones live 3 clicks deep in the Claude.ai UI. 4 of them don't appear in any documentation at all. You find them by reading GitHub issues, watching engineers leak them in Discord, or grepping the Claude Code binary at 1am. Most Claude users run with whatever Anthropic shipped six months ago. Their bill creeps. Their output drifts. They blame the model. Below: 18 settings that actually run your Claude. 8 in Claude dot ai. 7 in Claude Code. 3 in API and Console. For each: where it lives, what it does, the one-line fix. Section 1: Claude (8 settings) 1. Memory: scope, exclusions, and the "forget this" command Where: Settings -> Capabilities -> Memory What it does: Memory rolled out to Free and Pro in March 2026. By default it stores everything Claude decides is worth storing. Three controls most people miss: per-project scope, exclusion list, and the on-the-fly forget command. Why it matters: the default memory drifts. After 4-6 weeks it's full of one-off corrections ("I prefer tabs in Python" you said this once about one file), project-specific facts that leak into unrelated chats, and stale role context. Output quality degrades because Claude is now optimizing for the wrong "you." The fix: Turn on project-scoped memory: Settings -> Capabilities -> Memory -> Scope per Project. Memories from inside a Project stay in that Project. This alone fixes most drift. Add to the exclusion list any topic you don't want surfacing in unrelated chats. Examples: divorce, medical, salary numbers, client names. These persist regardless of context unless excluded. Use the inline forget command in any chat: forget what you remembered about [topic] Claude parses it against your memory store and confirms what it removed. No menu, no settings page. 2. Extended Thinking: per-chat toggle Where: chat input -> model selector dropdown -> Extended Thinking: Off / Light / Full What it does: Extended Thinking adds a <thinking> reasoning pass before the answer. Anthropic ships it on by default for Opus. The three-state toggle is per-chat and overrides the global setting. Why it matters: Extended Thinking is great for math, debugging, multi-step planning. It's wasted on summarization, translation, formatting, rewrites, and quick lookups. On those tasks it adds 3-12 seconds of latency and 20-40% more tokens for the same answer. The fix: set the default to Light (uses thinking only when the model judges it useful), and explicitly switch to Full for hard work. Most users I show this to drop their Opus token spend by 18-25% in week one. 3. Custom Styles: not "voice", but actual output contracts Where: chat input -> style selector -> Create New Style What it does: Styles started as a tone toggle ("Formal / Concise / Explanatory"). Custom Styles are actually an output contract. You paste a 200-1500 word instruction file. Every response in that style applies it before generation. Why it matters: most people use Styles for "make it shorter." The real use is enforcing structural rules across every response without re-pasting them. Citation format. Banned words. Required sections. Code-fence languages. Length caps. Whether to ask follow-up questions. The fix: create one Style per workflow. Mine: markdown # Style: Draft for X Output contract: - Open with one concrete number or named entity. No "I've been thinking..." - Sentences under 18 words where possible. - No em-dashes unless rhythm requires. - No "delve", "leverage", "robust", "unlock", "game-changing". - If listing 3+ items, use a hyphen list, not numbered. - End on a statement, not a question. If a draft exceeds 280 characters and the user didn't ask for a thread, say so before answering. Three of these in rotation (Draft for X, Code review, Summarize PDF) replaces 80% of my saved prompts. 4. Projects: the "instructions" field most people leave empty Where: any Project -> top-right ⋯ -> Edit project instructions What it does: Projects are persistent workspaces. The instructions field is a system-prompt-equivalent injected into every chat in that Project. Anthropic introduces Projects with the knowledge upload feature, which is what people remember. The instructions field is on the same page and 70% of Projects I see in the wild have it blank. Why it matters: every chat in a Project starts cold without it. With it, you stop re-establishing context. ("This is a Polymarket research workflow. Default to skeptical. Always show probability math. Never recommend a trade — only frame the EV.") The fix: treat it like a CLAUDE.md for Claude. Keep it under 400 words. Specify role, default skepticism level, formatting rules, what to never do. Re-read it once a month and prune. 5. Search past chats (Pro+) and how to actually search Where: Settings → Profile → Search past chats (must be enabled) What it does: lets Claude search your conversation history when relevant. Pro+ only. Why it matters: off by default for new accounts even on Pro. Once on, the trick is knowing it does keyword match, not semantic. "What did we discuss about Chinese robots yesterday" returns nothing unless your past chat literally contained "Chinese robots" or "China" and "robots". The fix: turn it on. Then learn the actual query shape. Content nouns, not meta-words. "Polymarket Iran" works. "That thing we talked about last week" doesn't. 6. Web search: per-conversation toggle and the citation behavior Where: chat input -> + -> Web search: On / Off What it does: the web search toggle is per-conversation, but the behavior changes based on a less-known setting in Settings -> Capabilities -> Web search citations: Inline / Footnotes / Hidden. Why it matters: the default is Inline. Inline citations break copy-paste. When you copy Claude's answer somewhere else, you copy markers that point nowhere. Footnotes mode keeps the answer clean and lists sources at the end. The fix: switch to Footnotes if you ever copy Claude's web-search answers into another doc, email, or message. Keep Inline only if you read everything inside Claude. 7. Connectors: the "trust this folder" trap in Cowork Where: Settings -> Connectors -> Cowork -> Trusted folders What it does: Cowork (GA April 2026) gives Claude access to a folder on your machine. By default, Anthropic asks before each session whether to trust the folder. The trusted-folders list is the bypass. Why it matters: once a folder is in trusted, Claude reads from it on every Cowork session without prompting. If you added a folder during a test in March and forgot, Claude has been silently reading it on every session since. The fix: open trusted folders. Remove anything that isn't a current active project. The list grows faster than you expect. 8. Incognito mode and what it actually skips Where: sidebar -> New incognito chat (or Cmd/Ctrl + Shift + N) What it does: an Incognito chat is not saved, not memorized, not searchable, not used for model improvements. The chat is deleted when you close it. Why it matters: people assume Incognito just hides the chat from the sidebar. It actually skips four systems: memory write, chat history, past-chats search index, training data opt-in (if you have it on). The fix: use it deliberately for anything with sensitive data: salary, medical, family, legal drafts, client names. Three keystrokes, no thinking. Section 2: Claude Code (7 settings) These live in ~/.claude/settings.json (user-level) or .claude/settings.json (project-level). The latter takes precedence. There are 125+ keys total in the v2.1.105 binary. The seven below are the ones that actually move the needle. 9. enabledPlugins - disable, don't uninstall Where: ~/.claude/settings.json -> enabledPlugins What it does: sets which installed plugins are loaded on session start. The Plugin marketplace makes installation easy. Uninstallation is harder, and unnecessary if you just set the value to false. Why it matters: every active plugin loads its hooks, SKILL.md content, and tool schemas into your context budget. Three plugins you forgot about = 3-8K tokens of pre-charge before you've typed anything. I had 14 plugins enabled when I started this audit. 4 are active now. The fix: json { "enabledPlugins": { "formatter@acme-tools": true, "deployer@acme-tools": false, "analyzer@security-plugins": false, "old-experiment@personal": false } } false keeps the plugin installed but unloaded. Re-enable per-session with /plugin enable name@marketplace when you actually need it. 10. permissions.deny - what to know about the bug Where: ~/.claude/settings.json -> permissions.deny What it does: blocks Claude from running specific tools or accessing specific files. The intent: prevent rm -rf, prevent reading .env, prevent writing outside the project. Why it matters: there's a known bug. Deny rules sometimes don't block. Multiple GitHub issues filed. The most-cited (anthropics/claude-code#11544) documents hooks not loading despite valid config; a similar pattern affects deny enforcement. The rule is in your config. The debug log shows "0 matchers found." Claude reads the file anyway. The fix: json { "permissions": { "deny": [ "Read(.env)", "Read(.env.*)", "Read(**/*secret*)", "Bash(rm -rf:*)", "Bash(sudo:*)" ] } } Add a second layer at the filesystem level. chmod 600 .env so even if Claude tries to read it, the OS refuses. Don't trust the deny list alone. Verify with /permissions inside Claude Code. If your rules don't appear, restart the session. 11. hooks.SessionStart - the 4 lines that cut my context bloat by 30% Where: ~/.claude/settings.json -> hooks.SessionStart What it does: SessionStart fires when you open Claude Code in a directory. You can run anything: print env info, lint the git state, inject a context file, warm the cache. Why it matters: most people inject too much. CLAUDE.md grows to 5K tokens because every project rule went in. SessionStart lets you load only the rules relevant to the current branch or directory. The fix: json { "hooks": { "SessionStart": [ { "matcher": "startup", "hooks": [ { "type": "command", "command": "cat .claude/context-$(git branch --show-current).md 2>/dev/null || true" } ] } ] } } Your main branch loads context-main.md. Your feat/auth branch loads context-feat-auth.md. Each file stays small. Context budget stops bleeding. 12. disableAllHooks - the panic switch Where: ~/.claude/settings.json -> disableAllHooks: true What it does: disables every hook in one toggle. Shipped in the March 2026 update. Most people don't know it exists. Why it matters: when Claude Code starts behaving weirdly (phantom commands running, sessions hanging on start, mysterious file writes), 80% of the time it's a misfiring hook. Disabling hooks one by one is slow. This kills them all at once so you can isolate. The fix: keep it false. When something breaks, flip to true, restart, see if the problem goes away. If yes, re-enable hooks one by one. If no, the bug is elsewhere. 13. model per-project override Where: .claude/settings.json (project root) -> model What it does: sets the default model for that project. Overrides your global setting. Why it matters: most people set Opus globally because they want it for hard work. Then they open a project that's mostly markdown editing or shell scripts. They pay Opus rates for tasks Haiku does at 1/20 the cost. The fix: json // In your /docs project: { "model": "claude-haiku-4-5-20251001" } // In your /infra project: { "model": "claude-sonnet-4-6" } // In your /core-engine project: { "model": "claude-opus-4-7" } Project-level overrides win. Open the project, get the right model. Move on. 14. mcpServers with the enabled flag Where: ~/.claude/settings.json -> mcpServers What it does: MCP servers connect Claude to external tools. Each connected server loads its full tool schema into your context. Anywhere from 800 to 6,000 tokens per server. Why it matters: people connect MCP servers to test, never disconnect. After three months you have 12 connected, of which you actively use 3. The 9 unused servers cost you ~25-40K tokens of context schema on every session start. The fix: use the enabled flag to keep connection configured but unloaded. json { "mcpServers": { "github": { "command": "...", "enabled": true }, "postgres": { "command": "...", "enabled": true }, "slack": { "command": "...", "enabled": false }, "linear": { "command": "...", "enabled": false } } } Toggle true per session when you actually need them. Most days I have 2-3 active. On planning days, 6. 15. cleanupPeriodDays - the cache nobody mentions Where: ~/.claude/settings.json -> cleanupPeriodDays What it does: sets how many days Claude Code keeps transcripts, debug logs, and intermediate session data. Default is 30. Why it matters: Dreaming and past-chat search both rely on these transcripts. With the default 30-day window, Dreaming can only learn from one month of work. Six months gives it 6× the signal. Disk cost: roughly 200MB. The fix: json { "cleanupPeriodDays": 180 } 180 days of session history available to Dreaming, to memory consolidation, and to your own grep when you're hunting "what did I tell Claude about that auth bug back in March." The Claude Code artifact: one settings.json with all 7 settings applied Copy this into ~/.claude/settings.json. Adjust paths and plugin names to yours. Restart Claude Code. Re-run /permissions and /hooks to verify everything loaded. json { "model": "claude-sonnet-4-6", "enabledPlugins": { "formatter@acme-tools": true, "old-experiment@personal": false }, "permissions": { "deny": [ "Read(.env)", "Read(.env.*)", "Read(**/*secret*)", "Bash(rm -rf:*)", "Bash(sudo:*)" ] }, "hooks": { "SessionStart": [ { "matcher": "startup", "hooks": [ { "type": "command", "command": "cat .claude/context-$(git branch --show-current).md 2>/dev/null || true" } ] } ] }, "disableAllHooks": false, "mcpServers": { "github": { "command": "npx", "args": ["@modelcontextprotocol/server-github"], "enabled": true }, "postgres": { "command": "npx", "args": ["@modelcontextprotocol/server-postgres"], "enabled": false }, "slack": { "command": "npx", "args": ["@modelcontextprotocol/server-slack"], "enabled": false } }, "cleanupPeriodDays": 180 } Project-level overrides go in .claude/settings.json at the project root. The most useful one to set there: json // .claude/settings.json (in a docs project) { "model": "claude-haiku-4-5-20251001" } Section 3: API and Console (3 settings) These live in code or in the Anthropic Console. They're the most cost-impactful settings in the article. Each one can change your bill by 30-90%. 16. cache_control breakpoints: where to put them Where: API request body, cache_control field on any content block What it does: marks a prefix of your prompt as cacheable. Subsequent requests with the same prefix get charged at roughly 10% of the input rate instead of full rate. Why it matters: this is the single biggest cost lever in the API. People know it exists. Most place the breakpoint wrong and get partial savings instead of full. On my own setup, fixing the breakpoint cut a $340/month bill to $87. The fix: the breakpoint goes at the boundary between static and dynamic content. Anything before the breakpoint is cached. Anything after is recomputed. python # WRONG — breakpoint after user message, nothing reusable cached messages = [ {"role": "system", "content": SYSTEM_PROMPT}, {"role": "user", "content": user_question, "cache_control": {"type": "ephemeral"}} ] # RIGHT — breakpoint after stable system prompt, full cache hit on next call messages = [ {"role": "system", "content": SYSTEM_PROMPT, "cache_control": {"type": "ephemeral"}}, {"role": "user", "content": user_question} ] Two TTLs are available: 5-minute ephemeral (default) and 1-hour. Use 1-hour for system prompts that don't change between sessions: python {"cache_control": {"type": "ephemeral", "ttl": "1h"}} Cache writes cost 25% more than base input. Cache reads cost 10% of base input. The crossover: a cached prefix pays off if you read it 2+ times within the TTL window. 17. inference_geo and the data residency tax Where: API request -> inference_geo parameter What it does: routes inference to a specific geographic region. US-only residency, EU-only, etc. Why it matters: US-only data residency adds 10% premium on Opus 4.7 and above. It's not on the standard pricing card. You see it on the invoice. The fix: if your compliance regime doesn't actually require regional residency, don't set inference_geo. Most apps default to setting it "to be safe" because someone in legal said "make sure data stays in the US." Verify whether the requirement is contractual or aspirational. If aspirational, omit the parameter and save 10% on every Opus call. If you do need it, factor the 10% into your model selection. Sonnet at $3 base becomes effectively $3.30, which moves the Opus-vs-Sonnet break-even. 18. Workspace-level rate limit (the one that prevents the 3am outage) Where: Console -> Settings -> Workspaces -> [your workspace] -> Per-feature rate limits What it does: sets a rate limit per workspace, per feature, separate from your account-level limits. Why it matters: an account-level limit protects you from going broke. A workspace-level limit protects your interactive product when a runaway batch job tries to eat your entire ITPM allowance. You ship a new feature, it bugs, it loops, it consumes everything, your customer-facing chat starts returning 429s. Workspace limits keep one feature from starving another. The fix: create one workspace per surface (interactive chat, batch processing, internal tools, experimental). Set each workspace's rate limit to 60-70% of your account tier. Reserve 30% for whichever workspace needs to burst. The fourth undocumented setting in this article: there's a feature-level cap inside each workspace that's only visible if you click into a specific feature card, not the workspace overview. Default = unlimited. If you have three features in one workspace, one of them can starve the other two and the workspace-level limit won't catch it. Set per-feature caps for anything that does batch work. Section 4: The 18-point checklist Walk through it once. 20 minutes. Anything you don't touch in 12 months, you probably never will. markdown ## Claude.ai - [ ] #1 Memory: project-scoped on, exclusion list populated - [ ] #2 Extended Thinking: default = Light - [ ] #3 Custom Styles: at least one workflow style created - [ ] #4 Project Instructions: filled for every active Project - [ ] #5 Past-chats search: on (Pro+) - [ ] #6 Web search citations: Footnotes mode - [ ] #7 Cowork trusted folders: reviewed, pruned - [ ] #8 Incognito: keyboard shortcut memorized ## Claude Code - [ ] #9 enabledPlugins: only active ones = true - [ ] #10 permissions.deny: env files + sudo + rm -rf blocked, OS-level backup in place - [ ] #11 hooks.SessionStart: branch-aware context loader - [ ] #12 disableAllHooks: false (know where the switch is) - [ ] #13 model: per-project override set for docs/infra/core projects - [ ] #14 mcpServers: enabled flag used, not full deletion - [ ] #15 cleanupPeriodDays: 180 ## API / Console - [ ] #16 cache_control: breakpoint after stable system prompt, 1h TTL for daily-stable prefixes - [ ] #17 inference_geo: only set if compliance actually requires it - [ ] #18 Workspace rate limits: per-workspace AND per-feature caps set Section 5: The audit script (run it weekly) Drop this into ~/bin/claude-audit.sh. Run weekly. It flags the Claude Code half of the checklist plus the cache_control side of the API half. bash #!/usr/bin/env bash # claude-audit.sh — flags settings drift across the 7 Claude Code + 1 API checks CLAUDE_DIR="$HOME/.claude" SETTINGS="$CLAUDE_DIR/settings.json" echo "=== Plugins enabled ===" jq '.enabledPlugins // {} | to_entries | map(select(.value==true)) | length' "$SETTINGS" 2>/dev/null echo "Target: 3-5 active. Re-enable per session for the rest." echo echo "=== MCP servers enabled ===" jq '.mcpServers // {} | to_entries | map(select(.value.enabled==true)) | length' "$SETTINGS" 2>/dev/null echo "Target: 3 always-on. Per-session enable rest." echo echo "=== permissions.deny rules present ===" jq '.permissions.deny // [] | length' "$SETTINGS" 2>/dev/null echo "Target: >=5 rules. .env / sudo / rm -rf at minimum." echo echo "=== SessionStart hook configured ===" jq '.hooks.SessionStart // [] | length' "$SETTINGS" 2>/dev/null echo "Target: >=1 entry." echo echo "=== cleanupPeriodDays ===" jq '.cleanupPeriodDays // 30' "$SETTINGS" 2>/dev/null echo "Target: 180." echo echo "=== Per-project model overrides ===" find . -maxdepth 3 -name "settings.json" -path "*/.claude/*" 2>/dev/null | while read f; do model=$(jq -r '.model // "—"' "$f") echo " $f → $model" done echo "Target: docs → haiku, infra → sonnet, core → opus." echo echo "=== API cache_control check (set API_KEY to run) ===" if [ -n "$ANTHROPIC_API_KEY" ]; then echo "Manual check: every system_prompt over 1K tokens should have cache_control with 1h TTL." else echo "Skipped — set ANTHROPIC_API_KEY to enable." fi Save, chmod +x ~/bin/claude-audit.sh, run weekly until each line is in target. Section 6: What didn't make the cut I removed four candidates before publishing. Worth naming so you don't waste time chasing them. Adaptive Reasoning toggle. Anthropic shipped this default-on. The override exists in Settings → Capabilities → Reasoning mode. In 30 days of comparison I couldn't find a workflow where overriding it changed outcomes meaningfully. Trust the default. Move on. Skill auto-activation. You can toggle whether Claude auto-loads skills based on relevance detection vs requiring explicit invocation. I expected this to matter. It didn't. Auto-activation with progressive disclosure (loading only SKILL.md metadata until needed) is well-tuned. Leave it on. Dispatch mobile-to-desktop control. Useful feature, not a settings audit item. Either you have a workflow where this fits or you don't. No hidden toggle changes the outcome. Per-workspace max_tokens ceiling. You can force every response to truncate at 800, 2000, or 4000. It saves real money on chatty workflows but corrupts code generation that needs long outputs. Worth testing per-workspace. Not worth recommending as a default. T H E _ E N D Walk the checklist tonight. Most of you will fix 6-8 things. A few will fix 14+. The numbers in your billing dashboard and your usage graph will tell you whether it was worth the 20 minutes. Bookmark and walk the checklist tonight. If this saves you a month of "Claude got dumber" frustration, repost. Telegram for daily AI tips: https://t.me/+_ZWrQN7GuDA3ZDEy

AIFCC — AI Fluent CxO Club

読み書きそろばん、AI。経営者が AI を自分で動かせるようになるコミュニティ。

Claude設定18選:知られていない設定でコストとパフォーマンスを最適化する | AIFCC