Claude Code Getting Started Tutorial | Tutorial
Claude Code is Anthropic's official CLI-level agent tool.
Claude Code is not positioned as a chat tool, but rather as a tool for executing high-privilege, context-aware engineering tasks within local code repositories.
Claude Code is an Agent, not a Chat.
Detailed tutorial available at:
Core capabilities:
- Directly read entire project directories
- Understand real code structure
- Execute multi-file modifications
- Strictly follow instructions rather than trying to please in conversation
Installation and Configuration
MacOS/Linux:
curl -fsSL https://claude.ai/install.sh | bash
Homebrew (MacOS):
brew install --cask claude-code
Windows:
irm https://claude.ai/install.ps1 | iex
NPM:
To install using npm, please ensure your system has Node.js installed, version v18 or higher is required.
npm install -g @anthropic-ai/claude-code
Now you can navigate to your project directory and start using Claude Code:
cd your-project
claude
Log in to Your Account
When starting an interactive session using the claude command, you need to log in:
claude # Prompts you to log in on first use
/login # Follow the prompts to log in with your account
If you can use an Anthropic account normally, you can start using it. If not, users in China can use DeepSeek or GLM, etc.
DeepSeek Integration with Claude Code
After installing Claude Code, set the following environment variables in your terminal:
export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
export ANTHROPIC_AUTH_TOKEN=<your DeepSeek API Key>
export ANTHROPIC_MODEL=deepseek-v4-pro
export ANTHROPIC_DEFAULT_OPUS_MODEL=deepseek-v4-pro
export ANTHROPIC_DEFAULT_SONNET_MODEL=deepseek-v4-pro
export ANTHROPIC_DEFAULT_HAIKU_MODEL=deepseek-v4-flash
export CLAUDE_CODE_SUBAGENT_MODEL=deepseek-v4-flash
export CLAUDE_CODE_EFFORT_LEVEL=max
Parameter description:
CLAUDE_CODE_EFFORT_LEVEL: Thinking depth, options include low / medium / maxANTHROPIC_MODEL: Specifies the use of deepseek-v4-pro modelCLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1: Disable non-essential traffic
Then navigate to your project directory and run the claude command to start using it.
cd my-project
claude
Reference documentation: https://api-docs.deepseek.com/zh-cn/guides/anthropic_api
Alibaba Bailian Integration with Claude Code
Alibaba Cloud Bailian's Tongyi Qianwen series models support the Anthropic API compatible interface. By modifying the following parameters, you can call Tongyi Qianwen series models in Claude Code.
- ANTHROPIC_API_KEY (or ANTHROPIC_AUTH_TOKEN): Replace with Bailian API Key, apply at: https://bailian.console.aliyun.com/cn-beijing/?userCode=i5mn5r7m&tab=model#/api-key.
- ANTHROPIC_BASE_URL: Replace with Bailian's compatible endpoint address https://dashscope.aliyuncs.com/apps/anthropic.
- Model name: Replace with Bailian-supported model names (e.g., qwen3-max, qwen3-coder-plus, etc.)
macOS/Linux:
Create and open the configuration file ~/.claude/settings.json.
~ represents the user's home directory. If the .claude directory doesn't exist, you need to create it first. You can run mkdir -p ~/.claude in the terminal to create it.
Edit the configuration file:
vim ~/.claude/settings.json
Replace YOUR_API_KEY with your exclusive API Key.
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
"ANTHROPIC_BASE_URL": "https://dashscope.aliyuncs.com/apps/anthropic",
"ANTHROPIC_MODEL": "qwen3-coder-plus"
}
}
Reopen a new terminal for the environment variable configuration to take effect.
Windows:
Run the following commands in CMD to set environment variables:
setx ANTHROPIC_AUTH_TOKEN "YOUR_API_KEY"
setx ANTHROPIC_BASE_URL "https://dashscope.aliyuncs.com/apps/anthropic"
setx ANTHROPIC_MODEL "qwen3-coder-plus"
Replace YOUR_API_KEY with your plan's exclusive API Key.
Open a new CMD window and run the following commands to check if the environment variables are set correctly.
echo %ANTHROPIC_AUTH_TOKEN%
echo %ANTHROPIC_BASE_URL%
echo %ANTHROPIC_MODEL%
Run the following commands in PowerShell to set environment variables:
# Replace YOUR_API_KEY with your plan's exclusive API Key
::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "YOUR_API_KEY", ::User)
::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://dashscope.aliyuncs.com/apps/anthropic", ::User)
::SetEnvironmentVariable("ANTHROPIC_MODEL", "qwen3-coder-plus", ::User)
Open a new PowerShell window and run the following commands to check if the environment variables are set correctly.
echo $env:ANTHROPIC_AUTH_TOKEN
echo $env:ANTHROPIC_BASE_URL
echo $env:ANTHROPIC_MODEL
Integrating Tongyi Qianwen Series Models in Claude Code
During a conversation, run the /model <model_name> command to switch models.
/model qwen3-coder-plus
You can also create a .claude/settings.json file in the project root directory and write the model configuration information for permanent configuration.
{
"env": {
"ANTHROPIC_MODEL": "qwen3-coder-plus",
"ANTHROPIC_SMALL_FAST_MODEL": "qwen-flash"
}
}
Start Claude, and you can see the configuration information:
Zhipu AI Model Integration with Claude Code
In this section, we use the ~/.claude/settings.json file to configure the large language model. Before starting, you need to get an API key from the official platform: GLM Coding Plan.
Edit or create the Claude Code configuration file ~/.claude/settings.json, and add or modify the env field inside:
# Note: Replace your_zhipu_api_key with the API Key you obtained in the previous step
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "your_zhipu_api_key",
"ANTHROPIC_BASE_URL": "https://open.bigmodel.cn/api/anthropic",
"API_TIMEOUT_MS": "3000000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1
}
}
Run claude to start Claude Code, and enter /status to confirm the model status:
If not working, you can enter /config to switch models.
With so many large language models, configuration can be troublesome. You can use a third-party tool CC Switch to help us easily manage API configurations for these popular tools: https://github.com/farion1231/cc-switch/, supporting Windows / macOS / Linux.
Download links for each platform: https://github.com/farion1231/cc-switch/releases.
Installing Claude Code in VS Code
If you don't like using Claude Code's command-line mode, we can install Claude Code in the VS Code editor.
Open VS Code, go to the extension marketplace, search for Claude Code and install it:
After installation, click the Claude Code icon in the top right corner to enter the Claude Code page:
Users with an account can use /login to log in:
You can also enter /config in the dialog box to access settings, and check the Disable Login Prompt configuration to turn off the login page:
Related Command Reference
Claude Code Built-in Commands List
| Command | Description |
|---|---|
/add-dir |
Add additional working directories |
/agents |
Manage specialized AI sub-agents |
/bashes |
List and manage background tasks |
/bug |
Report a bug (sends conversation to Anthropic) |
/clear |
Clear conversation history |
/compact |
Compress conversation, optionally add focus instructions |
/config |
Open settings interface (configuration tab) |
/context |
Visualize current context usage as a colored grid |
/cost |
Show token usage statistics |
/doctor |
Check Claude Code installation health |
/exit |
Exit REPL |
/export |
Export current conversation to file or clipboard |
/help |
Get usage help, show all available commands |
/hooks |
Manage hook configurations for tool events |
/ide |
Manage IDE integration and display status |
/init |
Initialize project with CLAUDE.md guidelines |
/install-github-app |
Set up Claude GitHub Actions for repository |
/login |
Switch Anthropic account |
/logout |
Log out from Anthropic account |
/mcp |
Manage MCP server connections and OAuth authentication |
/memory |
Edit CLAUDE.md memory file |
/model |
Select or change AI model |
/output-style |
Set output style directly or select from menu |
/permissions |
View or update permissions |
/plugin |
Manage Claude Code plugins |
/pr-comments |
View PR comments |
/privacy-settings |
View and update privacy settings |
/release-notes |
View release notes |
/resume |
Resume conversation |
/review |
Request code review |
/rewind |
Rewind conversation and/or code |
/sandbox |
Enable sandbox bash tool with file system and network isolation |
/security-review |
Perform security review on pending changes in current branch |
/status |
Open settings interface (status tab), display version, model, account and connection status |
/statusline |
Set Claude Code status line UI |
/terminal-setup |
Install Shift+Enter line break key binding (iTerm2 and VSCode only) |
/todos |
List current to-do items |
/usage |
Show plan usage limits and rate limit status (subscription plans only) |
/vim |
Enter vim mode, alternating between insert and command modes |
Custom Command Types
| Command Type | Location | Description |
|---|---|---|
| Project Commands | .claude/commands/ |
Stored in repository, shared with team |
| Personal Commands | ~/.claude/commands/ |
Available across all projects |
| Plugin Commands | Plugin's commands/ directory |
Distributed via plugin marketplace |
| MCP Commands | Provided by MCP servers | Format: /mcp__<server_name>__<prompt_name> |
Shell Commands (Outside Session)
| Command | Description |
|---|---|
claude |
Start Claude Code interactive session |
claude -p "query" |
Non-interactive mode, prints result and exits |
claude --dangerously-skip-permissions |
Skip all permission checks (dangerous mode) |
claude --debug |
Enable debug mode |
claude --mcp-debug |
MCP debug mode |
claude mcp add |
Add MCP server |
claude mcp list |
List MCP servers |
YouTip