01-ClaudeCode学习和使用

参考资料:

1. 安装

1
2
3
4
# https://github.com/anthropics/claude-code
irm https://claude.ai/install.ps1 | iex
# or
winget install Anthropic.ClaudeCode
1
2
# 检查版本,确认安装成功
claude --version
1
2
# 手动更新到最新版
claude update

2. 启动

1
claude

报错

Unable to connect to Anthropic services

Failed to connect to api.anthropic.com: ERR_BAD_REQUEST

解决

国内第一次使用claude code的新手,都遇到过这样的报错。而成为了使用claude code的第一道门槛。

解决办法:找到配置文件,在 C:\Users\用户名\.claude.json 下面,打开加入一行(记得上一行的逗号不要落下):

1
"hasCompletedOnboarding": true

重新打开 powershell 进行启动 claude,启动成功。

接下来就是进入到自己的项目目录下,使用 claude 启动 ClaudeCode。

3. API配置与模型切换

参考步骤:https://www.runoob.com/claude-code/claude-code-setup.html

CC Switch下载:https://github.com/farion1231/cc-switch/releases

目前使用免安装版:https://github.com/farion1231/cc-switch/releases/download/v3.13.0/CC-Switch-v3.13.0-Windows-Portable.zip

–> 重启命令行终端,powershell。

常用模型推荐

切换模型

  • 在提示框输入 /model
  • 或启动时用 claude --model sonnet
  • 确认模型配置无误:/status

常见命令汇总

命令 说明 示例
/init 在项目根目录生成 CLAUDE.md 文件,用于定义项目级指令和上下文 /init
/status 查看当前模型、API Key、Base URL 等配置状态 /status
/model <模型名称> 切换模型 /model qwen3-coder-next
/clear 清除对话历史,开始全新对话 /clear
/plan 进入规划模式,仅分析和讨论方案,不修改代码 /plan
/compact 压缩对话历史,释放上下文窗口空间 /compact
/config 打开配置菜单,可设置语言、主题等 /config

真正的重心还是:模型质量提示词工程skills个人认知综合能力


01-ClaudeCode学习和使用
https://janycode.github.io/2026/01/22/22_AI/04_ClaudeCode/01-ClaudeCode学习和使用/
作者
Jerry(姜源)
发布于
2026年1月22日
许可协议