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:
- Finds the right file — on its own, without your help
- Shows the changes — in a “before / after” format
- Waits for your permission — nothing changes until you say
y - 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 usedYou: 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 changesClaude will compose a clear commit message and suggest it to you.
Or even simpler — a special command:
claude commitCommit — 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/loginBranch — a parallel version of the project. You can experiment in a branch without touching the main code.
View History#
You: show the last 5 commitsRefactoring Code#
Refactoring — improving code without changing its behavior. Claude Code excels at this:
You: rewrite this code to make it clearerYou: replace callback functions with async/awaitYou: split this large file into several smaller onesDocumentation and Tests#
Update README#
You: update the README with installation instructionsWrite Tests#
You: write tests for the functions in calculator.jsAdd Comments#
You: add comments to the code in auth.pyPractice#
Try these in any project:
what does this project do?— Claude will analyze and explainwhich files are the most important here?— shows key filescreate a file hello.py with a function that prints a greeting— creates the filerun hello.py— runs the scriptmake 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 →