Claude Code

Claude in
your codebase

A command-line tool that reads your code, runs commands, makes changes, runs tests, and iterates. Not a chatbot that talks about code. A colleague that writes it.

Everything else in the handbook is about chatting with Claude. Claude Code is different. You point it at a real codebase, describe what you want, and it does the work: reading files, planning changes, editing code, running tests, committing, and opening pull requests. You stay in control, but the execution is autonomous.

This section is for anyone comfortable with a terminal who wants to understand what Claude Code can do, how to use it well, and where the edges are.


What it feels like

claude-code
$ claude
Claude Code v2.1.62 (Sonnet 4.6)
> The login endpoint is returning a 500 for users with special characters in their email. Here is the stack trace from the logs. Find the bug, fix it, and make sure the existing tests still pass.
I'll start by reading the auth handler and the relevant test file.
Read src/auth/login.ts (142 lines)
Read src/auth/__tests__/login.test.ts (89 lines)
Found it. Line 47 passes the email to the SQL query without escaping. The special characters break the parameterised query. I'll fix the escaping and add a test case for emails with + and ' characters.
Edit src/auth/login.ts (1 line changed)
Edit src/auth/__tests__/login.test.ts (12 lines added)
Run npm test
All 47 tests passed (including the 2 new ones).
Fixed. The issue was unescaped email input in the login query. I've added parameterised binding and two new test cases covering + and ' characters. All tests pass. Want me to commit?

That is a real interaction shape: describe the problem, Claude reads the relevant files, finds the bug, fixes it, adds tests, runs the suite, and confirms everything passes. The whole thing takes about ninety seconds.


What it can do

Read your code

Reads files, understands project structure, traces dependencies across a codebase. Up to 1M tokens of context.

Edit files

Makes targeted changes to existing files with surgical precision. Diffs are reviewable before or after.

Run commands

Executes terminal commands: tests, builds, linters, scripts. Reads the output and adjusts based on results.

Create new files

Scaffolds new features, new test files, new configs. From a single file to a full project skeleton.

Debug

Takes a stack trace or error log, reads the relevant code, identifies likely causes, fixes the most probable one.

Refactor

Renames across a codebase, extracts functions, restructures modules, updates imports. With test verification.

Write tests

Reads a function, understands its behaviour, and generates test cases covering happy path, edge cases, and failures.

Review PRs

Reads a diff, checks for correctness, edge cases, security, and ranks comments by severity.

Commit and push

Creates branches, writes commit messages, pushes to remote, opens pull requests with descriptions.

Explain code

Reads unfamiliar code and explains what it does, how it works, and where the non-obvious bits are.


When to use Claude Code vs the chat

TaskUseWhy
Fix a bug in your codebaseClaude CodeReads the actual files, runs the actual tests
Explain a conceptChatNo code to read, just a conversation
Build a new featureClaude CodeCreates files, edits files, tests, commits
Draft an emailChatText in, text out, no codebase involved
Refactor a moduleClaude CodeNeeds to trace dependencies across many files
Review a PRClaude CodeReads the diff in context of the full repo
Write a one-off scriptEitherChat can write it, Claude Code can write and run it
Learn a new languageChatExploratory, no project to work in
Migrate 200 files to a new patternClaude CodeBulk changes with verification at each step
Generate documentationClaude CodeReads the code to document what actually exists

If the task involves reading or changing real files in a real project, Claude Code. If the task is a conversation, chat.


Who this section is for

Claude Code is for anyone comfortable with a command line. You do not need to be a senior engineer. If you can open a terminal, navigate to a folder, and run a command, you can use Claude Code. The steepest part of the learning curve is not the tool itself, it is learning when to trust it and when to check its work.

This section has six pages, each going deeper than the last:

Start with Getting started if this is your first time.