Skip to content

Claude Code FAQ

How to use TokenFlow in the VS Code CC extension

  1. Make sure you have completed the Environment Check and that your Claude Code CLI is working. If something is wrong, configure it following the guide first.
  2. Press Win + R, type the following and press Enter to open the Claude Code config directory:
%userprofile%\.claude

Open the Claude Code config directory

  1. The directory contents look like the image below. If there is no config.json, create it manually and open it.
    • config.json: configures some behavior of the Claude Code extension for VS Code.

Claude config directory contents

  1. Write the following into config.json and save:
json
{ "primaryApiKey": "TokenFlow" }
  1. Restart VS Code and enjoy!

Common Claude Code commands

CommandDescription
claudeStart an interactive REPL in the current directory and use Claude Code conversationally.
claude "explain this project"Start the REPL with an initial question, so Claude analyzes the project on entry.
claude -p "explain this function"Use print mode for a one-off Q&A: output the result and exit, handy for scripts / CI.
cat logs.txt | claude -p "summarize the errors"Pipe a file or command output into Claude, then use -p to summarize or analyze.
claude -cContinue the most recent session in the current directory, picking up the existing context.
claude -c -p "check type errors"Run a one-off request in the most recent session context, often used for automated checks.
claude -r "abc123" "finish this PR"Resume a specific session by session ID and continue with a new task.
claude updateUpdate the Claude Code CLI to the latest version.
claude mcpManage and configure MCP servers so Claude can access external data sources and tools.
claude --add-dir ../apps ../libAdd extra code directories Claude can access, supporting reads across multiple paths.
claude --agents '{"reviewer":{...}}'Temporarily define sub-agents via JSON, such as code-reviewer, debugger, etc.
claude -p "generate API docs" --output-format jsonOutput the answer in JSON format for easier parsing by scripts.
claude --model sonnetSpecify the model for the session (e.g. sonnet / opus or a specific model name).
claude --verboseEnable verbose logging to show tool calls and internal steps, useful for debugging.
claude --resume abc123 "keep fixing this bug"Resume a session by session ID and continue previous work from any directory.
claude --continueLoad the most recent session in the current directory — equivalent to "continue last conversation".
claude --append-system-prompt "always use TypeScript"Append custom rules after the default system prompt without changing default behavior.
claude --dangerously-skip-permissionsSkip permission prompts so Claude automatically reads/writes files and runs commands (high risk, use only in fully trusted environments).

Claude Code cannot connect to Anthropic services

Note

If this is your first setup and you were redirected here from a link, just follow the commands below.

After installing claude with npm, running claude in the terminal reports an error like this:

Unable to connect to Anthropic services
Failed to connect to api.anthropic.com: ERR BAD REQUEST
Please check your internet connection and network settings.
Note: Claude Code might not be available in your country, Check supported countries at https://anthropic.com/supported-countries

Or you run into the following issues during your first setup.

Claude Code cannot connect to Anthropic services

Claude Code cannot connect to Anthropic services

Claude Code cannot connect to Anthropic services

  1. Press Win + R, type cmd and press Enter to open the command line.
  2. Run the following command and press Enter:
bash
powershell -Command "$f='%USERPROFILE%\.claude.json';$j=Get-Content $f|ConvertFrom-Json;$j|Add-Member -NotePropertyName 'hasCompletedOnboarding' -NotePropertyValue $true -Force;$j|ConvertTo-Json|Set-Content $f"
  1. Restart your Claude CLI.

How to switch Claude Code back to 200K context and disable non-essential traffic

If you want to switch Claude Code from 1M context back to 200K context, and turn off some non-essential requests and terminal title changes, add the following to the env section of settings.json.

  1. Press Win + R, type the following and press Enter:
%userprofile%\.claude
  1. Open or create settings.json.
  2. Make sure env contains the following:
json
{
  "env": {
    "CLAUDE_CODE_DISABLE_1M_CONTEXT": "1",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
    "CLAUDE_CODE_DISABLE_TERMINAL_TITLE": "1"
  }
}
最近更新