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 searchCLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: disables telemetry, update checks, and other non-essential requestsskipWebFetchPreflight: 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 CommitsAccurate project context significantly cuts token usage and stops Claude Code from repeatedly asking about your structure.
Recommended MCP extensions?
context7: real-time technical documentation lookupdeepwiki: knowledge base accessplaywright: browser automationexa: 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 callafter-tool-use: fires after a tool calluser-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/exitor pressCtrl + Ctwice: quit
What to check before troubleshooting? (general checklist)
- Confirm token group, Base URL, and User-Agent all match (see the 5-item checklist in Integration & Compatibility)
- Check for stale system env vars (
Win + R→sysdm.cpl, or inspect~/.zshrc) - Check
~/.claude.jsonfor OAuth token leftovers (clear withclaude auth logout) - Reconfigure once with CC Switch, then close and reopen the terminal and retry
- For integration scenarios, confirm the 5-item checklist (group, protocol, Base URL, headers, model)