Skip to content

First Use: Running Through the First Example

📚 Series Navigation: The previous article 06 Coding Plan: Subscriptions and Billing helped you figure out the money matter. This article is time to get your hands dirty for real—from opening the terminal to running through the first task, letting you "succeed" for the first time.

Brothers, the previous articles were all buildup—installed, logged in, and plans selected.

The tool is sitting there, but you probably still feel a bit empty inside: How exactly do I use this thing? I open the terminal, then what?

Honestly speaking, many people when running Claude Code for the first time, stare at that cursor stunned for almost a minute, not knowing what to type. Deeply afraid that saying one wrong sentence will mess up the code.

Don't be nervous. Today we will walk through the simplest process: create a small project with only a few lines of code, let Claude read and understand it first, then let it help you modify one line. The whole process won't exceed five minutes, and you will get your first successful experience in life of "Claude helped me modify code and did it right". This is enough—once run through once, everything follows naturally later.

After reading this article, you will get:

  • A complete action flow from opening the terminal to running through the first task, just copy and type
  • Understand what every piece of that "Welcome Screen" after Claude Code launches is
  • A runnable hello world level practical exercise that gives expected output
  • A few key reminders that let you "not step on pits the first time" (how to approve permissions, how to undo if changed wrong)

01 First Create a "Toy Project"

Conclusion first: For first time use, don't practice on your official project, create a toy project.

Why? Because official projects have many files and complex dependencies, Claude reads for a long time right off the bat, and you also can't clearly see what it actually did. A toy project just has two or three files, you can see at a glance what it modified—this is what's used for learning.

Analogy: Learning to drive goes to an empty lot first. No one gets on the highway as soon as they get a driver's license. First find an empty lot with no people, familiarize yourself with the gas and brake, know how much the car turns when you turn the steering wheel. The toy project is your empty lot—it doesn't matter if you mess it up, just rebuild one.

For people who have never touched the command line at all, everyone who practices on company projects the first time panics—just the screen scrolling for those few seconds when Claude reads files is enough to make palms sweat. Change the method, first build a small file with three lines of code, run the whole thing in five minutes, and confidence will come instantly.

Open your terminal (on Mac it's "Terminal", on Windows recommend using Git Bash or PowerShell), type these few lines below:

bash
mkdir hello-claude
cd hello-claude

The meaning of these two lines is: create a new folder called hello-claude, and then enter it. mkdir = make directory, cd = change directory.

Next, create the simplest Python file. Mac / Linux use:

bash
echo 'def add(a, b):
    return a + b' > main.py

In Windows PowerShell writing multiple lines with echo is slightly troublesome, you can directly use Notepad to create a new main.py, paste the two lines below into it and save:

python
def add(a, b):
    return a + b

💡 One-sentence summary: First time using Claude Code, first create a toy project of two or three lines as a "practice yard", if you mess it up just rebuild, heart doesn't panic and hands don't shake.


02 Launch Claude, Understand the Welcome Screen

The project is created, now launch Claude Code in the same folder. Confirm that your terminal is currently in the hello-claude directory (if you cded into it just now, it's still there), type:

bash
claude

Note: You must launch claude in the project directory, do not launch it nakedly on the desktop or home directory. Because Claude Code treats the directory you are currently in as the workspace—wherever you launch it, it reads the files there. This is the first pitfall beginners step on most often: launching in the home directory, then asking "what does this project do", Claude is totally confused, because the home directory is not a project at all.

Analogy: Inviting a renovation worker over, you must first lead him to the apartment to be renovated. You can't gesture for a long time at the community gate, he has to stand in the room to know which wall to smash and where to run wires. cding into the project directory and then launching claude is "leading the worker through the door".

After launching you will see a Welcome Screen, according to official docs' statement, on it are your session information, recent conversations, and latest update prompts. For a beginner, you only need to recognize three things:

What you seeWhat it isWhat you need to do
Input box / Cursor at the very bottomWhere you talk to ClaudeType directly, press Enter to send
/help in the promptsView all available commandsType it when you can't remember commands
/resume in the promptsResume a certain previous conversationIgnore for the first time

The input box is the main battlefield. You don't need to learn any special syntax, just treat it as a chat box that can read your code—just raise requirements in plain language.

Want to confirm you've entered the right place, you can first type the most plain question:

text
What does this project do?

Claude will go read the files under the current directory itself (here it's main.py), and then tell you what this project is for. You don't have to manually "feed" the file to it throughout the process—official docs explicitly state: Claude Code will read project files itself as needed, you do not need to manually add context.

💡 One-sentence summary: Type claude in the project directory to launch, recognizing "Input box + /help" those two things is enough to start working; it will read files itself, you just raise requirements in plain language.


03 Let Claude Read and Understand Code First

The first real task, is not letting it modify code, but letting it explain code.

Why explain first? Two reasons: one is to let you confirm Claude indeed read your file (and is not making things up blindly); two is that explanation tasks are zero risk—it only reads and speaks, won't touch a single word of yours, most suitable for testing the waters the first time.

Analogy: First day of a new colleague onboarding, you won't throw the core module directly at him to refactor, but first let him "read the code, tell me what this part does". Listening to him talk once, you'll know whether he understood it and whether he's reliable. Letting Claude explain code is this "first day onboarding" action.

Type in the input box:

text
Explain what the file main.py is doing, explain it in a way a beginner can understand

Enter. Claude will read main.py, then give you an explanation in plain language, roughly: A function add is defined here, taking two parameters a and b, and returning the result of their addition.

Running through this step means two things are established: Claude Code is installed correctly, login state is normal, and it is indeed reading your real files. With a solid foundation, only then dare you let it act to modify.

Divide commands to Claude Code into three categories to remember, and you will have a clear idea when using it later:

Command TypeDoes WhatExampleRisk
ExplanatoryLet it read & understand, explain to you"Explain this code"Zero risk, doesn't touch files
ModificationLet it change existing code"Refactor this function"Will touch files, needs approval
GenerativeLet it write new things"Add a test case"Will create/modify files, needs approval

💡 One-sentence summary: For the first task use "Explanatory" to test waters first—confirm it read your file, foundation is solid, then let it act.


04 Let Claude Modify a Line of Code (Crucial: It Will Ask You First)

Now reaching the climax: Let Claude truly modify code once.

Following the conversation above, type directly:

text
Add type annotations to this function, and supplement basic error handling

At this time, the most crucial scene arrives—Claude will not directly change your file away. It will:

  1. Find the file to change (here it is main.py)
  2. Present what it plans to change it to, in the form of a diff (difference comparison), for you to see
  3. Stop, and wait for your approval
  4. Only after you click "Yes" will it truly land on disk

This is an iron rule repeatedly emphasized in official documentation:

Claude Code always requests permission before modifying files. You can approve individual changes, or enable an "accept all" mode for the current session.

Analogy: The intern asking you before taking action. A reliable intern won't modify production code without your consent—he'll come over with the revised draft: "Boss, I want to change it like this, what do you think?" You nod, then he moves. By default, Claude Code is this kind of "ask first then act" intern.

You will see a prompt letting you choose, usually the meaning of these options:

Your ChoiceEffectWhen to use
YesApply this single changeUnderstood the diff, think no problem
Yes, don't ask again this sessionSubsequent changes auto-appliedYou already trust it, want to speed up
No, and tell it whyDon't change, you can supplement reqsSomething in the diff you don't want

For the first time, strongly recommend you honestly just choose "Yes", don't rush to turn on "accept all". Honestly speaking, when just starting out it's easiest to take the easy way out, loosening permissions to the maximum right away (--dangerously-skip-permissions which will be discussed in later chapters, as the name implies "dangerously skip permissions"), resulting in it consecutively changing five or six files while you didn't look carefully, by the time you react, you can no longer distinguish which changes were what you wanted, and which were added on its own initiative. The lesson is just one: The less familiar you are, the more you should let it stop at every step.

A small trick to understand diffs: Red / starting with - are deleted old lines, green / starting with + are added new lines. Your main.py will probably go from:

python
def add(a, b):
    return a + b

To something like this (exact phrasing Claude uses might slightly differ, meaning consistent is fine):

python
def add(a: float, b: float) -> float:
    if not isinstance(a, (int, float)) or not isinstance(b, (int, float)):
        raise TypeError("a and b must be numbers")
    return a + b

Added type annotations (a: float), also added basic error handling (errors if passed in is not a number). At this moment, you completed your first "Human-Machine Collaborative Code Modification".

💡 One-sentence summary: Before Claude modifies a file it always asks you first—first time honestly select "Yes", nod after understanding the diff, don't seek speed and turn on full auto.


05 What to Do If Modified Wrong: Two "Regret Medicines"

The biggest fear of beginners is: What if it modifies it wrong, messes it up, and I can't tell, how do I clean up the mess?

Rest assured, there are two regret medicines, and they are very easy to use.

First one: Directly say "Change it back" in the conversation. Claude remembers what it did in this session, if you are dissatisfied, directly tell it in plain language:

text
I am not satisfied with the change just now, help me change it back to how it was originally

It will revert the change. Analogy: Saying to a colleague "That version of yours just now won't do, still follow the original one" —no need for you to manually pick it back line by line yourself.

Second one: Use Checkpoint rewind. This is Claude Code's "game save" mechanism—it automatically records the state before each file edit, you can jump back with one click.

Analogy: Save and load in gaming. You saved before the Boss fight, if you lose you don't have to start over from the beginning, just load the save point. Checkpoints are the saves Claude quietly makes for you before taking action.

How to trigger? According to official docs:

text
/rewind

Or when the input box is empty, press the Esc key twice consecutively, and the rewind menu will pop up.

⚠️ A detail (explicitly mentioned in official docs): If there is text in the input box, pressing Esc twice consecutively clears the text, not opening the rewind menu. So to rewind, first ensure the input box is empty.

One more point to clarify—Checkpoints can only undo file modifications Claude made through its editing tools, it does not equal Git. The official advice is very on point:

Think of checkpoints as "local undo", and Git as "permanent history".

That is to say, checkpoints are suitable for immediate regret like "Oops, modified this step wrong, jump back"; truly important progress, still has to rely on Git commits to save (how to use Git, a later article will specifically discuss).

Regret MedicineHow to UseSuitable ScenarioLimitation
Say "Change it back" in convoType directly telling ClaudeJust finished changing, just one or two places dissatisfiedRelies on its understanding of your meaning
Checkpoint /rewindType /rewind or double Esc on empty inputWant to jump back precisely to a certain stateOnly governs files modified by Claude, not Git

💡 One-sentence summary: Don't panic if modified wrong, one sentence "Change it back" + Checkpoint /rewind to catch the bottom; but real progress, should be handed over to Git to save.


06 Hands-on: Five Minutes to Run Through Your First Task

Just reading and not practicing is a fake trick. Below, we string the previous sections into a complete process that you can copy and type, with expected output. Open the terminal, follow along.

Step One: Create toy project (Mac / Linux)

bash
mkdir hello-claude
cd hello-claude
echo 'def add(a, b):
    return a + b' > main.py

Windows Users: mkdir hello-claude and cd hello-claude copy exactly, use Notepad to create new main.py and paste those two lines of Python in.

Expected: There is a main.py in the hello-claude folder, content is those two lines of add function. Can type ls (Windows use dir) to confirm the file is there.

Step Two: Launch Claude Code

bash
claude

Expected: Welcome screen appears, bottom has input box and cursor. If it prompts you to log in, means login step from previous articles not completed, go back and run through login in Article 02.

Step Three: Let it explain code

Type in the input box:

text
Explain what the file main.py is doing, explain it in a way a beginner can understand

Expected: Claude reads main.py, tells you in plain language this is a function to "add two numbers". Seeing it accurately state the purpose of the add function = Success.

Step Four: Let it modify code, and approve

text
Add type annotations to this function, and supplement basic error handling

Expected: Claude gives a piece of diff (red - old line, green + new line), then stops and waits for you to select. Select "Yes" after understanding.

Step Five: Confirm changes landed

Exit Claude (type exit or press Ctrl+D), back in terminal view file:

bash
cat main.py

(Windows PowerShell use type main.py)

Expected: Type annotations (like a: float) and error handling (raise TypeError(...)) appeared in main.py. Matches the diff you just approved = Full process run through, congratulations!

⚠️ In case you get stuck on a permission error (seeing Error: EACCES: permission denied etc on Mac / Linux), specific fix varies by scenario, later "Common Questions" article will detail, just know there is such a pitfall here for now.

💡 One-sentence summary: Run through the five steps once, running through is more important than reading through—getting the first successful experience of "Claude helped me fix it right", everything follows naturally later.


07 Summary

In this article you did one thing: Completely ran through the first task of Claude Code—from creating a project, launching, explaining code, to modifying code and approving.

Stringing the core actions to review once:

StepActionKey Point
Create Projectmkdir + cd + create fileFirst use toy project to practice
LaunchType claude in project directoryWhere you launch, it reads there
Explain"Explain xxx file"Zero risk, first confirm it read the file
ModifyUse plain language to raise requirementsIt first gives diff, waits for approval then acts
Regret"Change it back" / /rewindCheckpoints are local undo, Git is permanent history

You should now be able to: Open the terminal, launch Claude in the correct directory, use natural language to let it read & understand and modify a piece of code, understand the diff it gives, and know how to go back if modified wrong. This set of actions is the minimal core of all your Claude Code usage going forward—the fancier features later are essentially additions on top of this "Raise requirements → View diff → Approve / Regret" loop.


Next article 08 "VS Code Integration"—the command line is run through, but you might be more accustomed to writing code in the editor, seeing diffs more clearly. The next article teaches you to install Claude Code into VS Code, letting it sit side-by-side with your code to work.

Five-step flowchart of using Claude Code for the first time

This image strings the five steps of this article into a vertical flow: Create toy project → Launch claude in project directory → Let it explain code (Green · Read-only zero risk) → Let it modify code (Amber highlight · Gives diff first wait for your approval, i.e., "ask first then act") → If modified wrong use /rewind to backtrack (Magenta highlight · Catch-all "regret medicine"), the two highlights are precisely the safety guardrails beginners should remember most.