Skip to content

Advanced Config & Efficiency

How to reduce token consumption and non-essential traffic?

Merge the following into ~/.claude/settings.json:

json
{
  "ENABLE_TOOL_SEARCH": true,
  "skipWebFetchPreflight": true,
  "env": {
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  }
}
  • ENABLE_TOOL_SEARCH: reduces token leakage from tool-call search
  • CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: disables telemetry, update checks, and other non-essential requests
  • skipWebFetchPreflight: skips the WebFetch preflight (a must for domestic networks)

How to use CLAUDE.md to boost efficiency?

Create a CLAUDE.md in the project root with your stack, directory structure, and dev conventions; Claude Code auto-loads it as context on startup:

markdown
# Project Name

## Stack
- Frontend: React + TypeScript
- Backend: Node.js + Express

## Structure
- src/ — source code
- tests/ — test files

## Conventions
- Use ESLint + Prettier
- Commit messages follow Conventional Commits

Accurate project context significantly cuts token usage and stops Claude Code from repeatedly asking about your structure.

  • context7: real-time technical documentation lookup
  • deepwiki: knowledge base access
  • playwright: browser automation
  • exa: smart search

How to use Hooks?

Create hook scripts under ~/.claude/hooks/ or the project's .claude/hooks/:

  • before-tool-use: fires before a tool call
  • after-tool-use: fires after a tool call
  • user-prompt-submit: fires when the user submits a message

How to create custom commands?

Create a .md file under ~/.claude/commands/ or .claude/commands/. For example, create ~/.claude/commands/review.md, then type /review in a conversation to trigger it.

Handy command cheat sheet

  • /model: switch model (opus / sonnet / haiku)
  • /model sonnet[1m]: switch to the 1M ultra-long-context version
  • /cost: view current token usage
  • /compact: compress context to free up space
  • /resume: resume a past conversation
  • /clear: clear the current conversation
  • /help: list all commands
  • /exit or press Ctrl + C twice: quit

What to check before troubleshooting? (general checklist)

  1. Confirm token group, Base URL, and User-Agent all match (see the 5-item checklist in Integration & Compatibility)
  2. Check for stale system env vars (Win + Rsysdm.cpl, or inspect ~/.zshrc)
  3. Check ~/.claude.json for OAuth token leftovers (clear with claude auth logout)
  4. Reconfigure once with CC Switch, then close and reopen the terminal and retry
  5. For integration scenarios, confirm the 5-item checklist (group, protocol, Base URL, headers, model)