Why This Matters#

In previous lessons, we learned how to launch Claude Code and have conversations with it. Now it’s time for the main event — working with code. Claude Code can edit files, search across your project, run commands, and work with Git. In this lesson, you’ll learn how it does all of this.


How Claude Code Edits Files#

When you ask Claude to change code, it:

  1. Finds the right file — on its own, without your help
  2. Shows the changes — in a “before / after” format
  3. Waits for your permission — nothing changes until you say y
  4. Makes the edits — only after confirmation

Example: Adding a Function#

You: add a hello world function to main.py

Claude: I'll edit main.py:

  + def hello():
  +     print("Hello, World!")
  +
  + hello()

Apply changes? [y/n]

Example: Fixing a Bug#

You: users can submit an empty form — fix this

Claude: I found the file form.js. I'll add validation before submission:

  function submitForm(data) {
  +   if (!data.name || !data.email) {
  +     alert("Please fill in all fields");
  +     return;
  +   }
      sendToServer(data);
  }

Apply changes? [y/n]

Claude Code works with any programming language: Python, JavaScript, TypeScript, HTML, CSS, Go, Rust, and many others.


Working with Multiple Files#

Claude Code sees your entire project. This means it can:

  • Change multiple files in a single request
  • Understand relationships between files
  • Create new files

Example#

You: create an "About Us" page with a separate CSS file

Claude: I'll create two files:

1. about.html — the HTML page
2. about.css — styles for the page

[shows the contents of both files]

Apply changes? [y/n]

Searching the Project#

Claude Code can search for information in your project:

You: where in the project is authentication handled?

Claude will analyze files and show exactly which files and lines contain the authentication code.

You: find all places where the calculateTotal function is used
You: what API endpoints exist in the project?

API endpoint — an address where a program accepts requests. For example, /api/users — an address for getting a list of users.


Running Commands#

Claude Code can run terminal commands for you. Before each run, it shows the command and asks for permission.

Examples#

You: run the tests

Claude: I'll execute:
  npm test

Run command? [y/n]
You: install a library for working with dates

Claude: I'll execute:
  npm install dayjs

Run command? [y/n]
You: show which files I've changed

Claude: I'll execute:
  git status

Run command? [y/n]

npm — a package manager for JavaScript. Like an app store, but for code libraries.


Working with Git#

Claude Code works excellently with Git. Here’s what you can do:

View Changes#

You: what have I changed?

Claude will run git status and git diff and show the results.

Create a Commit#

You: make a commit with a description of the changes

Claude will compose a clear commit message and suggest it to you.

Or even simpler — a special command:

claude commit

Commit — a “snapshot” of your changes saved in the project history. Like pressing “Save” with a comment about what exactly you changed.

Create a Branch#

You: create a new branch feature/login

Branch — a parallel version of the project. You can experiment in a branch without touching the main code.

View History#

You: show the last 5 commits

Refactoring Code#

Refactoring — improving code without changing its behavior. Claude Code excels at this:

You: rewrite this code to make it clearer
You: replace callback functions with async/await
You: split this large file into several smaller ones

Documentation and Tests#

Update README#

You: update the README with installation instructions

Write Tests#

You: write tests for the functions in calculator.js

Add Comments#

You: add comments to the code in auth.py

Practice#

Try these in any project:

  1. what does this project do? — Claude will analyze and explain
  2. which files are the most important here? — shows key files
  3. create a file hello.py with a function that prints a greeting — creates the file
  4. run hello.py — runs the script
  5. make a commit — saves changes to Git

Lesson Summary#

✅ Claude Code finds the right files itself and shows changes before applying them
✅ Can work with multiple files simultaneously
✅ Can search the project — code, functions, patterns
Runs commands (tests, package installation) with your permission
✅ Works with Git: commits, branches, history, conflicts
✅ Writes tests, documentation, and performs refactoring


Next lesson: Claude Code in VS Code and JetBrains →