Claude Code practical tutorial, from zero to automated daily workflow

📅 2026-05-13 14:09:57 👤 DouWen Editorial 💬 8 条评论 👁 10

Claude Code is a command-line AI programming assistant launched by Anthropic at the end of 2024 and will explode in mid-2025. The biggest difference from most AI programming tools on the market is that it runs natively on the terminal and can directly read and write local files, execute shell commands, and call git, and the complete process is completed in one go. This article is the latest version of the practical tutorial in 2026, a complete roadmap from installation to automating daily workflow.

The whole article is divided into three parts. The first part is 10 minutes to get started, including installation, initial operation, and login authentication. The second part is five core usage scenarios, writing code, fixing bugs, reading code, running tests, and writing documents. The third part is the advancement of workflow automation, how to hand over daily repetitive operations to Claude.

What is Claude Code and what is its essential difference from Cursor?

Picture

Claude Code is an AI programming agent that runs in the terminal. Open iTerm or Terminal and enter claude to start. The entire interaction is completed on the command line. Cursor is a graphical editor based on VS Code. All operations are done in the window. Both base layers can adjust the Claude model, but they work in completely different ways.

The advantage of the terminal is native toolchain support. Claude Code can directly execute git status, run pytest, and adjust docker commands without leaving the command line. The graphical interface of Cursor is separated by one layer. When calling commands, you need to open an embedded terminal window. For developers who are accustomed to keyboard flow, Claude Code is actually more efficient.

The disadvantage is that there is no graphical interface, and you need to rely on the color highlighting of the terminal to view the code diff. People who like visualization may not be comfortable with it. A compromise solution is to run Claude Code in the integrated terminal of VS Code, which can retain the terminal experience and see the file tree.

Installation from scratch to first conversation in 10 minutes

Picture

The first step is to install Node.js. Claude Code requires Node 18 or above, and it is recommended to use nvm for management. Mac users execute brew install nvm then nvm install 22. Windows users download the installation package from nodejs.org. Linux users can install it with apt or yum.

The second step is to install Claude Code itself. Open a terminal and execute npm install -g @anthropic-ai/claude-code. Wait a few dozen seconds for the installation to complete. Mac users may need sudo. It is recommended to change the global directory of npm to the user directory to avoid permission issues.

The third step is to log in. Enter the project directory you want to work in and execute claude. The first startup will direct the browser to open the authentication page and log in to your Anthropic account. Free accounts have daily quota limits. For heavy users, it is recommended to subscribe to the Claude Pro or Max package. After successful login, you will enter the interactive window and start a conversation.

Practical demonstrations of the 5 most commonly used scenarios

Picture

Scenario one is writing new code. Input: Write a Python script to read all csv files in the logs directory and extract the error field statistics and rankings. Claude will first scan the logs directory, understand the csv format, write the script, and then run the verification results. The whole process takes less than 1 minute.

Scenario 2 is to fix bugs. Enter Run pytest and fix it if it fails. Claude will execute pytest, read the failure information, locate the code, provide a repair plan, modify and rerun the test after confirmation. This self-closing loop is especially useful for older projects.

Scenario three is reading code. I took over a new project with 50,000 lines. Please input and explain the overall architecture of the project, focusing on the data flow. Claude will read the README, key directories, and entry files, and generate an architecture description with file path references. 10 times faster than coding yourself.

Scenario 4 is running tests and CI simulations. Enter to run all checks of CI locally and automatically fix any errors found. Claude reads the .github/workflows configuration, reproduces the CI steps, and fixes each step if it fails. Go through CI locally before pushing to avoid remote red.

Scenario five is writing documents. Input Write docstrings for all public functions in utils.py, following Google style. Claude reads the file, adds comments function by function, and finally runs ruff to check the format. This type of repetitive and boring work is best suited for AI to take over.

Core skills for workflow automation

Picture

The first tip is CLAUDE.md. Create a CLAUDE.md file in the project root directory and write down the key conventions of the project, such as do not use print but use logger for debugging, use ORM for all SQL, and use pytest instead of unittest for testing. Claude will read this file every time it is started and comply with your rules.

The second trick is the slash command. Claude Code supports custom commands, which are written in the .claude/commands directory. For example, create a /test command with the content of running all tests, locating code repairs if they fail, and re-running after repairs until all tests are green. Next time, enter /test to trigger the entire process with one click.

The third tip is plan mode. Enter planning mode before entering complex tasks. Claude will first outline the entire execution plan for you to confirm before starting. Avoid changing files as soon as they come up, which will waste time if the direction goes astray. After the plan is confirmed, exit plan mode and enter execution.

The fourth tip is git integration. Claude Code knows that you are in the git repository and can let it check uncommitted changes and divide them into 3 commits according to the change topic. It will read git diff, automatically group, and separate git add and git commit by commit topic. Much faster than manual sorting.

The fifth tip is headless mode. Add the prompt parameter to claude --print, and it will run in the background without opening an interactive window. You can write it in cron and execute it once a day, such as automatically running CI, generating daily reports, and collecting errors every morning. Completely unattended automation.

MCP allows Claude Code to access more tools

Picture

MCP is Model Context Protocol, a standard launched by Anthropic at the end of 2024. Let Claude access any external tools through the MCP server, including databases, APIs, file systems, office software, etc. It is essentially a plug-in mechanism.

Mainstream MCP servers include filesystem (read and write local files), github (operate GitHub warehouse), slack (send messages), postgres (query database), puppeteer (control browser). After installing an MCP server, Claude Code will have an additional set of tools that it can call.

For example, after installing the postgres MCP server, Claude can directly help me check the active user data in the last seven days and draw a line chart. It will query the database using SQL and save the results as a chart locally. There is no manual intervention in the whole process.

Advanced usage of integrating with IDE

Claude Code can be run in the integrated terminal of VS Code. The advantage of VS Code is file tree and graphical diff, and the advantage of Claude Code is AI execution. Put them together and use the file tree to view the project and let Claude actually operate it. The experience is very smooth.

The JetBrains family is also supported. Open the Terminal toolbar of IntelliJ or PyCharm and enter claude. Claude Code does not depend on the IDE type, as long as the terminal can run. Some companies also integrate Claude Code into their own IDE plug-ins.

Vim users can run Claude Code in split screen. Use tmux with split screen to edit code and talk to Claude at the same time. This keyboard-only stream is a favorite among terminal fundamentalists. Cursor's mouse-drag method is completely useless in this scenario.

Common pitfalls and troubleshooting

The first common problem is API credit exhaustion. Free accounts have limited daily conversations, and it’s easy to hit the limit when running big projects. The solution is to subscribe to Pro ($20 per month) or Max ($100 per month). Or use the API key to pay directly and charge by token. The latter is cheaper for heavy users.

The second problem is the network. Anthropic's service is occasionally unstable when accessed domestically. It is recommended to install a proxy or deploy Claude Code on an overseas server. Direct access using domestic IP will time out randomly.

The third problem is accidentally deleting files. Claude occasionally rms the wrong file when executing the shell command. The preventive method is to use git to manage the project and commit before each major change. Set read-only permissions for important folders. Never let Claude directly manipulate production data.

The fourth problem is that the context is too long. Claude will slow down and drift after a conversation is too long. The solution is to periodically enter /clear to restart the conversation. Have a new conversation for each independent task, don't cram everything into one session.

Practical project case sharing

The first case is to use Claude Code to reconstruct an old PHP project. The original project had 8,000 lines without any documentation, so Claude was asked to write the architecture diagram while reading the code. It took 3 days to read the entire project and generate a complete document. After the refactoring plan came out, I used Claude to actually perform the refactoring. It took 5 days to complete the originally estimated one-month work.

The second case is contributing code to an open source project. I picked an issue of the Python library and asked Claude to read the code, write patches, run tests, and generate PR descriptions. The entire process from issue to PR took less than 40 minutes, and the PR was merged.

The third case is daily operation and maintenance. I wrote a /daily command to execute with one click every morning: check the health status of all servers, collect error logs, generate daily reports, and send emails. What was supposed to be 30 minutes is now over in 30 seconds.

FAQ

What is the relationship between Claude Code and Claude web version?

Both use the same Claude model, but Claude Code is an agent that can execute commands, read and write local files, and run shells. The web version can only have conversations and cannot directly operate your computer. The two subscriptions are connected, and the Pro or Max plans can be used on both sides.

Does Claude Code support Chinese?

Fully supported. You can ask questions in Chinese, request the generation of Chinese comments, and write Chinese documents. The code itself is generally in English, but the dialogue and documentation are all in Chinese. Claude 4.x series' understanding and output of Chinese are close to native language level.

Who owns the copyright of the code written with Claude Code?

Be yours. Anthropic's terms of service clearly state that the copyright for code output belongs to the user. This is similar to GitHub Copilot. But be aware that Claude may output open source code snippets in the training data. If it is under a highly contagious license such as GPL, be careful to quote it.

Can companies use Claude Code?

able. Anthropic has an enterprise version that supports SSO, private deployment, and data is not used for training. Small and medium-sized companies go straight to the Team plan ($30 per seat per month). Large companies can use enterprise sales. Code is not used for model training with Anthropic, giving businesses more peace of mind than some other AI tools.

Will Claude Code replace programmers?

Not in the short term, but it will change the way things work. Simple and repetitive tasks will be replaced, such as boilerplate code, unit testing, and document generation. Complex system design, product decision-making, and collaboration with people are still inseparable from programmers. Future programmers will be more like architects plus AI operators.

What Claude Code really changes is the pace of development. Originally, a one-hour job could be completed in 10 minutes, but needs assessment and verification still require people. Learning to collaborate with AI is the most important new skill for developers in 2026. I hope this tutorial can help you get started quickly and gradually automate your daily workflow.

📝 本文来自抖文 www.douwen.me ,转载请保留出处。

💬 评论 (8)

C
ContentDev 2026-05-12 16:50 回复

Easy to follow.

S
SEOFan 2026-05-13 05:23 回复

Best summary I've read on this.

D
DataNerd 2026-05-13 02:12 回复

Step-by-step is gold.

D
DigitalNomad 2026-05-12 22:38 回复

Loved the FAQ section.

T
TechReader 2026-05-13 09:43 回复

Solid breakdown, very useful.

R
ResearcherJ 2026-05-12 16:33 回复

Great resource.

S
SEOFan 2026-05-12 19:56 回复

Clear and to the point.

D
DigitalNomad 2026-05-13 10:00 回复

Thanks for the detailed comparison.