Recently, many friends have been asking me if I could release a beginner's tutorial for Claude Code.
They also want to use the world's most powerful Agent product.
Actually, many people don't realize that Agent products are generally composed of an Agent framework and a model. Claude's models are indeed frequently blocked in China and are very difficult to handle; I have no way to teach everyone how to fix that.
But Claude Code won't be blocked or become unusable because it is actually an Agent framework that can be used with any model.
Although Anthropic can be quite annoying with constant account bans and real-name authentication, I still have to admit that the best Agent framework in the world right now is Claude Code.
That's why I always say, if you can get it right in one step, do it. I know things like OpenClaw and Hermes Agent are very popular now, but I still recommend using Claude Code. Even if you can't use Claude's native models, pairing it with a domestic model still yields excellent results.
Plus, you don't have to worry about account bans, foreign phone numbers, Visa cards, or even using a VPN.
So today, here is a comprehensive beginner's tutorial for Claude Code from scratch. I've prepared instructions for Windows and Mac, with and without a VPN, so everyone can follow the part they need.
The following installation process was tested across five or six computers over an entire weekend by me and my team, through repeated installations and uninstalls.
For example, in scenarios without a VPN, there are other installation methods like npm or using domestic mirror sources via curl. These methods work, but they weren't stable enough across different computers in my tests.
So finally, I chose the method that I believe is the simplest and least likely to fail even on a very "clean" computer.
I just hope everyone can successfully use the world's most powerful Agent framework by following this article.
I will explain every step as clearly and in as much detail as possible. It might be a bit wordy, so please bear with me.
Alright, let's get started.
I. Claude Code Installation
1. Mac
Let's look at Mac first. Windows users can skip this part and find the Windows tutorial below.
First, find the Terminal in your Apps and open it.
Let's install our protagonist today, Claude Code.
I created a brand new macOS account for my computer, which is basically equivalent to a clean computer, for this demonstration.
First, let's talk about the case with a VPN.
The command is just one line:
Paste this command into the terminal and press Enter.
Wait a moment, and you will see a successful installation.
Although it's installed, it might give you a prompt here.

It means Claude Code is installed, but the installation location ~/.local/bin hasn't been added to your PATH environment variable, so typing claude directly might not find the command.
It says to solve this, execute the command provided below.
If you don't understand, it's okay. Just do as it says: copy that long echo command it gave you into the terminal and run it.
Then type claude --version. If a version number is output, the installation was successful.

The situation with a VPN is very simple, but I know many students don't have one.
So, if you don't have a VPN, we can install it via Homebrew.
Homebrew is the most popular command-line package manager on macOS. It allows you to install, update, and uninstall various software and development tools with a single command.
I borrowed a new computer from a colleague; it has no VPN and a very clean environment.
Let's install brew first. It might look complicated, but it's actually very simple if you follow along.
Paste the following command into the command line and press Enter:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After the prompt, just press Enter.
Then it will run for a while.
Wait patiently for a few minutes. When it finishes and says installation successful, you're done.
Next, we need to add Homebrew to the path variables so the terminal can find the command when we use it.

Paste these few lines of commands into the terminal and run them once.

Now we can use Homebrew to manage Mac packages.
Next, use the following command to install Claude Code. Because the editor might auto-format some text, direct copy-pasting might cause errors. Please type it manually or ask Claude to fix the format before pasting it into the terminal:
brew install --cask claude-code@latest

The installation speed here is a bit slow; you can go take a break and come back when it's done.
Once the success message appears, type claude in the terminal, and you'll see the little crab.

However, it will show that it's unusable for now. You can ignore this; I'll teach you how to connect a model in a moment.
Now that we've covered Mac, let's talk about Windows separately. It's slightly different. Mac users who have finished can skip this part.
2. Windows
Now for Windows.
I used a freshly wiped Windows machine to install it.
Since Claude Code executes commands internally using Git Bash on Windows, you must install Git first to use Claude Code on Windows.
So, step one: install Git.
Friends who already have it installed can skip this.
Use WinGet to install it. This is the official Windows package manager, which can be thought of as the Windows version of Homebrew.
Search for "Terminal" in the taskbar and open it.

Paste the following command into the terminal. Installation will be much faster if you don't use a VPN here.
winget install Git.Git
Once it finishes, it will show a successful installation.

Once Git is installed, as usual, let's talk about the case with a VPN.
For friends with a VPN, we still use the official native installation command.
Paste the command into the terminal:
Wait a moment, and it will be installed.
Very convenient.

If you don't have a VPN, we must use WinGet to install it.
Run this command in the terminal:
winget install Anthropic.ClaudeCode
After it installs successfully, you can also type claude to see that it has been installed.

At this point, theoretically, typing claude in the terminal should take you to the Claude Code page.
But.
We've only installed the framework; we haven't given it a "brain" yet, so it's not usable.
Next, we need to connect its brain.
II. Connecting the Model
If you have a Claude account, just log in directly. I won't go into detail here.
Because theoretically, if you already have a Claude account, you wouldn't be reading this beginner's tutorial...
So, to ensure all domestic friends can use it, I'll use the domestic model GLM-5.1 as an example.
GLM-5.1 is currently the domestic model I've used that feels closest to the Claude Opus 4.6 experience.
Of course, if you didn't catch their coding plan, MiniMax M2.7 and K2.5 are also good. K2.6 code should be out soon, and I feel Kimi will have a leap forward too; I recommend keeping an eye out.
Regarding GLM-5.1, Zhipu official provides a one-line command to install it, which is very simple:
However, to make it easier for everyone to connect other models and switch freely, I'll teach you a more universal method: using CC Switch.
Again, divided into Mac and Windows.
1. Mac
On Mac, the installation is just two commands. The second command might also error if copy-pasted directly due to formatting. Please type it manually or ask Claude to fix it before pasting:
brew tap farion1231/ccswitch
brew install --cask cc-switch
Paste into the terminal and press Enter.
Once it's installed, you're set.

2. Windows
For Windows, I recommend downloading the installation package directly from the link below:
https://github.com/farion1231/cc-switch/releases

If you can't access GitHub, I've also prepared a local installation package. Reply with "cc" in the official account background, and it will automatically send you the download link.
After downloading, double-click to run, and you can click "Next" all the way to finish the installation.

The subsequent operations are the same for Mac and Windows, so I won't separate them.
After installation, open it.
You can see that this tool is not only for Claude Code; Codex and Xiaolongxia can also use it.
Since we haven't configured it yet, there are currently only official Claude model configurations.
Under the Claude column, click the plus sign in the upper right corner to add a new model configuration.

Then select the model you want to use. Here I chose the GLM domestic version.

Next, you only need to fill in two parts: the API key (if you don't know what an API Key is, you can ask any AI you have access to, and they will help you) and the model configuration. Everything else will be filled in automatically.

After filling it in, click "Add" in the bottom right corner.
It will switch to the model we configured.
At this point, the installation of Claude Code and the connection of GLM-5.1 are complete.
III. Starting Claude Code
Go back to the terminal, type claude, and press Enter.

You can now start Claude Code normally.
For the first use, there will be some initialization settings.
For example, the color mode. There is a code preview below the modes; choose according to your preference and press Enter.
If you want to change it later, run /theme inside Claude Code.
Next is the security prompt.

Two main points:
One is that Claude can make mistakes. You should review the code it generates and the commands it wants to execute before letting them through.
One is to only use Claude Code in codebases you trust to avoid prompt injection attacks.
Press Enter to go to the next step.
It asks if we want to use Claude Code's terminal settings.

Here, just use the recommended terminal settings.
Actually, it wants to help you enable two things:
Shortcut keys to achieve line breaks in the terminal.
The other is Visual Bell, a visual prompt.
That is, when Claude finishes a task or needs your confirmation, the terminal window will flash, and the Dock icon will bounce to remind you.
The final step is to confirm whether the current directory can be trusted.

Select "Yes" and press Enter.
We have finally arrived at the dialogue interface of Claude Code connected to GLM-5.1.
If you want to switch models later, configure them in CC Switch and use /model in Claude Code to switch.

At this point, all installation and connection operations are complete.
For future use, just type claude in the terminal.
I recommend using the following command, especially during development, otherwise clicking "Allow" repeatedly will make you question your life choices:
claude --dangerously-skip-permissions
When we start it, because of the context design, we need to start it against a folder to keep it constrained and focused, rather than starting Claude Code directly in the root directory.
I've divided my directories; "Documents" is where I do knowledge creation.

There is also a "code" folder, which contains various products I've developed myself.
Starting Claude Code for a specific folder in the command line is also very simple.
It's the cd command, which is the same for Mac and Windows.
For example, if I want to enter the "Knowledge Base" folder to create content:
Open the terminal, type cd, then remember to press the space bar once, and then drag your folder directly into it.
Press Enter, and you've entered that folder.
Then use the command to start Claude Code.
You will enter that folder, and it will work only within that folder by default, reading all files within it.

This actually results in less context pollution and more focus—in other words, it's smarter.
IV. Writing CLAUDE.md
After learning how to start it, you can officially start the dialogue and let it work.
But there is a standard and a very important habit you need to set before deep use. Don't fall into the old traps I did: define your CLAUDE.md file first.
In my opinion, this is even the first thing you should do after learning how to start Claude Code.
Before getting into the specific writing style, let me talk about what CLAUDE.md is.
This thing is not just a file; it is a top-down hierarchical constraint system.
Like this image I used before.
After installation, the two layers we should manage are the global CLAUDE.md and the project CLAUDE.md.
The global CLAUDE.md is placed in the Claude Code root directory of the user's home directory: ~/.claude/CLAUDE.md.

As long as you open Claude Code, no matter which project you enter, it will be automatically loaded and followed.
This is its top-level specification.
It solves problems like who you are, your principles of doing things, and how you want it to collaborate with you.
The project-level CLAUDE.md is placed in the root directory of each project: project_directory/CLAUDE.md.
It is only loaded when you open that project.
It solves the problem of how this specific project should be done and what special agreements exist at this level.
Let's talk about the global CLAUDE.md first, which is the first thing that needs to be settled. But many people aren't clear about what to write, how to write it, how long it should be, or where to put it. For non-developers, I'll share my experience.
Regarding length, CLAUDE.md is not better if it's longer; instead, it should be as concise as possible.
If your CLAUDE.md is too long, it will simply ignore the content in the latter half.
The specific red line is this: beyond 80 lines, Claude starts to miss some content. At most, never exceed 200 lines.
In a previous article, I showed you what's in my global CLAUDE.md file.
Based on my content, I've iterated and prepared a template for you.
It contains things I think a good global CLAUDE.md should have.
You just need to write your own content in the "About Me" section; the rest can basically be reused directly.
About Me [Your name / identity / professional background, if you're not a programmer, you must state it]. I use Claude Code for [Specific Use 1] and [Specific Use 2].
Thinking Principles: All decisions start from the essence of the problem, do not copy just because "this is the convention." Go back to the problem itself: What needs to be solved? What is the most direct path? How would it be designed from scratch? Do not flatter. Do not praise my ideas, do not say "this is a very good question," do not add "of course" at the beginning. Give me real judgments; if there's a problem with the plan, point it out directly. If you find a better way, say it directly without waiting for me to ask.
Constraints First: Whether it's a development project or a knowledge management project, the first step is always to establish rules: write CLAUDE.md for new projects first, and define structural conventions for new directories (what goes where, how to name, when to clean up). Do not work in a workspace without specifications. For projects with existing specifications, strictly abide by the agreements in their CLAUDE.md. When adjusting specifications, change the document first, then the practice, not the other way around.
Communication Style - Default to Chinese, use English for code, commands, and variable names - Conclusion first, then reasons, do not pave the way with background - Encountering vague requirements, give the most reasonable plan first, then ask if adjustments are needed - Do not ask "are you sure you want to do this" unless it hits the red lines below
Autonomous Boundaries (Red lines, must ask me first) The following operations must stop and ask me even in auto-accept mode: - Deleting files, directories, or git history - Modifying .env, keys, tokens, CI/CD configurations - Database schema changes or data migrations - git push, git rebase, git reset --hard, force push - Installing new global dependencies or modifying system configurations - Public release (npm publish, deploy to production, publish articles, etc.)
General Engineering Discipline - Actively run verification after changes (see each project's CLAUDE.md for specific commands), do not just change without verifying - Do not comment out errors or add bypass markers just to make the code run; find the root cause - Keys, tokens, and passwords do not enter code, commits, or logs - Before major changes, provide a plan in Plan Mode; only proceed after my confirmation
A total of about 30 lines, divided into six parts.
These six blocks have a common feature: they are universal across projects.
Once the global CLAUDE.md is set, we have our top-level specifications.
As for the next layer, the project CLAUDE.md.
Take myself as an example.
I mainly use Claude Code for development and knowledge management.
For example, there is a CLAUDE.md in my code/my directory. Its role is mainly because the things I often code in the my folder are often one-off or experimental messy things, which are actually very small, so I'm really too lazy to create a new folder under my every time.
So my current common practice is to cd directly to the my folder to start, and then happily start stating my requirements to help me code. With this CLAUDE.md file, it will judge for itself whether this is a new product. If it is, it will directly help me create a new folder to start, so the entire file management becomes organized.
And you don't even have to write this file yourself. Just open that folder and chat with Claude Code. Directly discuss your requirements and the things you care about with it, and let it write one for you.

I've also been working hard with my Claude Code these past few days to establish various specifications and organize the various "shitty mountains" of code I left behind before.
If you have nothing on your computer right now, it's even more convenient.
This is one of the reasons I've always emphasized constraints first and specifications first.
Once the constraints are set, you can really start playing.
As for skills, plugins, common commands, and functions.
I won't expand on them here. I've written many related articles; interested friends can search for the corresponding keywords.
Final Words
I've finally finished this long-overdue beginner's Claude Code tutorial.
Claude Code is the "graduation tool" of the current AI era that I recommend to you.
You don't need to use all those messy Agents. Use Claude Code well, and you will truly feel what the most powerful Agent is.
I hope everyone can create happily.
And make works that belong to you in this era.
Your own works.





