Claude Code 101
Learning Objectives
- explain how Claude Code differs from the browser interface and when to use it
- install and authenticate Claude Code and initialize a project with CLAUDE.md
- use core CLI commands and slash commands to control a session
- direct Claude Code to read, edit, and work across files in a real codebase
- connect Claude Code to VS Code or JetBrains for in-editor use
- run an agentic workflow using /plan to complete a multi-step task
Business Context
Most engineers who adopt Claude use it through the browser: paste code in, read a response, paste it back. That works, but it leaves most of the value untouched.
Claude Code puts Claude directly in your terminal. It has access to your filesystem, can read and write files, run commands, and complete multi-step tasks across your codebase without copy-pasting. Engineers who have built this into their daily workflow ship faster, write fewer tests by hand, and spend less time on the mechanical parts of the job.
This lesson covers everything you need to go from zero to productive in Claude Code.
Core Concepts
What Claude Code Is and How It Differs from the Browser
Claude Code is a command-line tool that runs Claude inside your terminal. The core difference from the browser is filesystem access: Claude Code can read your files directly, write changes back, and execute shell commands.
| Interface | How it works |
|---|---|
| Browser (claude.ai) | You describe what to change, Claude responds, you apply changes manually |
| Claude Code (CLI) | Claude reads your files, writes changes, and runs commands directly in your environment |
This changes the type of task that becomes practical. In the browser, you are limited to what you can copy and paste. In Claude Code, you can say "refactor all error handling in the API layer to use the new AppError class" and Claude will find the files, make the changes, and run the tests.
Setting Up Claude Code
Prerequisites: Node.js 18 or higher.
Install and authenticate:
- Run
npm install -g @anthropic-ai/claude-code - Run
claude login(opens browser authentication tied to your Anthropic account) - Navigate to your project:
cd your-project - Start a session:
claude - Run
/initto generate aCLAUDE.mdfile
The CLAUDE.md file is the most important setup step. Claude reads it at the start of every session to understand your project: architecture decisions, naming conventions, what patterns to follow, what to avoid. Write it once and it applies to every future session in that project.
What to put in CLAUDE.md:
- How the repo is structured (key directories and what lives where)
- Naming conventions and code style rules
- Patterns to follow (and anti-patterns to avoid)
- How to run tests and common build commands
- Any constraints (libraries not to use, APIs to avoid calling directly)
The Claude Code CLI: Core Commands and Slash Commands
Claude Code runs as a REPL: you type, Claude responds and acts. Three modes of invocation:
| Mode | How to invoke | When to use |
|---|---|---|
| Interactive session | claude |
Multi-turn work, exploring a codebase |
| One-shot prompt | claude "your prompt" |
Single task or scripting |
| Print mode | claude -p "prompt" |
Pipe output to another command |
Within a session, slash commands control behavior. The ones you will use most:
| Command | What it does |
|---|---|
/init |
Generate CLAUDE.md for this project |
/plan |
Enter plan mode before a complex task |
/review |
Run a structured code review |
/diff |
View pending file changes |
/compact |
Compress context when approaching limits |
/clear |
Reset the conversation context |
/model |
Switch model mid-session |
/cost |
Check token usage for the current session |
/help |
List all available commands |
Keyboard shortcuts:
| Shortcut | Action |
|---|---|
Enter |
Send message |
Shift + Enter |
New line without sending |
Up arrow |
Recall previous message |
Ctrl + C |
Stop Claude mid-response |
Ctrl + D |
Exit Claude Code |
Shift + Tab |
Toggle auto-accept (applies edits without confirmation) |
Working with Files and Your Codebase
Claude Code reads files on demand. You do not paste code into the prompt: you reference files by path and Claude reads them directly.
Reading before acting:
Read src/auth/middleware.ts and explain what validation it performs
on incoming requests.
Making a targeted change:
In src/auth/middleware.ts, add rate limiting at the token validation step.
Use the existing Redis client in lib/cache.ts.
Add a test for the rate limit exceeded case in tests/auth.test.ts.
Working across multiple files:
Refactor the error handling in the API layer to use the new AppError class
in lib/errors.ts. Update all files in src/routes/ that currently throw
raw Error objects. Run the tests after each file change.
By default, Claude proposes each change and waits for your approval. Toggle auto-accept with Shift + Tab when you want Claude to apply changes without pausing.
Claude Code in the IDE
Claude Code integrates with VS Code and JetBrains. Once connected, a Claude panel appears inside the editor so you can run sessions without switching to a terminal.
VS Code setup:
- Open the Extensions panel (Cmd+Shift+X)
- Search for "Claude Code" and install
- Open the Command Palette (Cmd+Shift+P) and run "Claude Code: Open Panel"
JetBrains setup:
- Open Settings, then Plugins
- Search for "Claude Code" in the Marketplace and install
- The Claude Code panel appears in the right-side tool window
The IDE integration is most useful when you are actively editing. You can reference the file open in the editor without typing its path, and Claude's changes are immediately visible in your diff view.
Agentic Workflows
Standard sessions are interactive: task, action, review, repeat. Agentic workflows let Claude take multiple sequential actions with minimal interruption, suited for larger tasks where you have defined the expected output clearly.
Always use /plan before a multi-step task. Plan mode makes Claude describe what it will do before doing it. You can redirect, correct scope, or cancel before any work begins.
/plan
Implement the password reset flow. The spec is in docs/specs/password-reset.md.
Write the backend endpoint, the email template, and the unit tests.
Follow the patterns used in the existing registration flow.
Codebase-wide refactor:
Find all places in src/ that call the deprecated fetchUser(id) function.
Replace each call with userService.getById(id), which has the same signature.
Run the test suite after each batch of changes.
Review and fix failing tests:
Run the test suite. For each failing test, diagnose the failure and fix
the implementation. Do not modify test files.
Key Points
- Claude Code has direct filesystem access: it reads and writes files without copy-pasting
- CLAUDE.md gives Claude persistent project context: initialize it with
/initon every project - Use
/planbefore any multi-file or multi-step task to verify direction before work starts - The IDE integration (VS Code or JetBrains) is the lowest-friction entry point for most engineers
- Agentic workflows work best when the task is scoped, patterns to follow are clear, and the test suite can confirm correctness
Tools, Prompts, or Templates
Claude Code Setup Checklist
Most engineers skip the setup steps and end up with Claude that does not know anything about their project. Five minutes now saves repeated context explanations for every future session.
Run this once per project, not once per session.
Installation
- [ ] Node.js 18+ is installed
- [ ] Claude Code is installed: npm install -g @anthropic-ai/claude-code
- [ ] Authenticated: claude login completed successfully
Project Initialization
- [ ] Navigated to project root
- [ ] Run /init to generate CLAUDE.md
- [ ] CLAUDE.md includes: directory structure, naming conventions, test command
- [ ] CLAUDE.md includes: patterns to follow and any anti-patterns to avoid
IDE Integration (optional but recommended)
- [ ] Claude Code extension installed in VS Code or JetBrains
- [ ] Panel opens successfully inside the editor
First Session Verification
- [ ] Claude can read a file without error
- [ ] Claude can run the test command successfully
- [ ] Claude Code Commands Reference is bookmarked for reference
Claude Code Commands Reference
A complete reference for slash commands, keyboard shortcuts, and CLI flags. Use this during your first sessions until the core commands are muscle memory.
Session and Context
| Command | What it does |
|---|---|
/clear |
Clears conversation history (aliases: /reset, /new) |
/compact [instructions] |
Compresses context window with optional focus |
/context |
Visualizes current context usage |
/rewind |
Reverts conversation and code changes to a prior point |
/resume [session] |
Resumes a previous session by ID or name |
/export [filename] |
Exports conversation to file or clipboard |
/rename <name> |
Renames current session |
/fork [name] |
Branches current conversation |
Project and Memory
| Command | What it does |
|---|---|
/init |
Initialize project and generate CLAUDE.md |
/memory |
Edit CLAUDE.md memory files |
/add-dir |
Add additional working directories |
/sandbox |
Enable sandboxed bash with isolation |
Models and Performance
| Command | What it does |
|---|---|
/model |
Select or change AI model mid-session |
/effort |
Set processing intensity level |
/fast |
Toggle fast output mode |
/output-style |
Set response formatting style |
Code and Review
| Command | What it does |
|---|---|
/review |
Request a structured code review |
/security-review |
Security review of pending changes |
/diff |
View pending file changes interactively |
/pr-comments |
View pull request comments |
/plan |
Enter plan mode for complex tasks |
Agents and Tasks
| Command | What it does |
|---|---|
/agents |
Manage subagent configurations |
/tasks |
List and manage background tasks |
Settings and Account
| Command | What it does |
|---|---|
/config |
Open settings interface |
/permissions |
View or update tool permissions |
/privacy-settings |
Update privacy settings |
/login |
Switch Anthropic accounts |
/logout |
Sign out |
/stats |
View daily usage and session history |
/cost |
Show token usage statistics |
Integrations and Tools
| Command | What it does |
|---|---|
/mcp |
Manage MCP server connections |
/ide |
Manage IDE integrations |
/hooks |
Manage hook configurations |
/plugin |
Manage Claude Code plugins |
/install-github-app |
Set up Claude GitHub Actions |
/teleport |
Resume a remote session from claude.ai |
Utility
| Command | What it does |
|---|---|
/help |
List all available commands |
/bug |
Report a bug to Anthropic |
/doctor |
Check installation health |
/release-notes |
View release notes |
/exit |
Exit the REPL |
Automation and Scheduling
| Command | What it does |
|---|---|
/loop [interval] [prompt] |
Run prompts on a recurring interval |
/schedule [description] |
Create and manage scheduled routines |
Where to Start
| Goal | Commands to use |
|---|---|
| First time setup | /init then /memory |
| Hitting context limits | /compact and /cost |
| Complex multi-step task | /plan first, then describe the task |
| Code review | /diff, /review, /security-review |
| Agent workflows | /agents, /mcp, /tasks |
| Switching models | /model and /effort |
| Debugging Claude Code itself | /doctor and /bug |
| Testing an approach safely | /fork and /rewind |
CLI Flags
| Command | What it does |
|---|---|
claude |
Start an interactive session |
claude "your prompt" |
Run a one-shot prompt and exit |
claude -p "your prompt" |
Print the response only, no interactive mode |
claude --continue |
Resume the most recent conversation |
claude --resume |
Choose a past conversation to resume |
Actionable Takeaways
Run
/initin your main project today. The five minutes it takes to write a good CLAUDE.md will pay back on every session that follows. Include your directory structure, test command, and at least three conventions Claude should follow.Replace one copy-paste coding workflow with Claude Code. Pick a recurring task (writing tests, reviewing for edge cases, drafting a PR description) and run it through Claude Code once. Compare the result to your browser workflow.
Set up the IDE integration. If you are in VS Code or JetBrains daily, the in-editor panel removes the context-switch cost entirely. Install it before your next coding session.
Use
/planbefore any task that touches more than two files. The cost of a bad plan is seconds. The cost of undoing three files of wrong changes is much higher.Start with read-only tasks first. Ask Claude to explain a file, audit a function, or identify edge cases before you ask it to make changes. It builds your trust in the output before you accept file modifications.
Practical Examples
Engineer: Implementing a New Feature
Situation: You need to add rate limiting to an authentication endpoint.
Session:
Read src/auth/middleware.ts and describe how it currently handles
token validation.
After Claude summarizes:
Add rate limiting at the token validation step. Requirements:
- 100 requests per minute per IP address
- Use the Redis client already initialized in lib/cache.ts
- Return 429 with a Retry-After header when the limit is exceeded
- Add tests in tests/auth/middleware.test.ts covering: within limit,
at limit, and over limit
Follow the existing middleware pattern in this file.
Engineer: Codebase-Wide Refactor
Situation: A deprecated function needs to be replaced across 20+ files.
Session with /plan first:
/plan
Find all usages of the deprecated fetchUser(id) function across src/.
Replace each call with userService.getById(id), which has the same
return type and signature.
Run the test suite after each file to catch regressions.
Report any files where the replacement is ambiguous.
Review the plan Claude produces. Approve it, then let it run. Use /diff to review changes before auto-accepting.
Engineer: Diagnosing Failing Tests
Situation: CI is red and you do not know why.
Run the test suite. For each failing test:
1. Show me the error message
2. Identify whether the failure is in the test or the implementation
3. Fix implementation failures only (do not modify test files)
4. Re-run the affected test to confirm the fix
Start with the failing tests in src/payments/.
Technical Director: Codebase Audit
Situation: You need to assess the security posture of a new service before it goes to production.
/security-review
Audit the authentication and authorization logic in src/auth/ and
src/api/middleware/. I want to know:
1. Where user input is validated (and where it is not)
2. Any endpoints missing authentication checks
3. Token handling practices: storage, expiry, rotation
4. Any hardcoded credentials or secrets in the codebase
Output: prioritized list of findings with severity (critical, high, informational).
Implementation Workflow
Your First Claude Code Session on Real Work
This exercise takes 20 minutes. Do it on a real project, not a test repo.
Install and authenticate if you have not already:
npm install -g @anthropic-ai/claude-code claude loginNavigate to your project root and start Claude Code:
cd your-project claudeRun
/initto generate CLAUDE.md. Review what Claude writes and add at least:- How to run your tests
- One convention specific to your codebase
- One thing Claude should avoid doing
Pick a real task you have open right now. A function to write, tests to add, a section of code to refactor, or a PR description to draft.
Start with a read prompt. Before asking Claude to change anything, ask it to read the relevant file and describe what it sees. Verify that Claude understands the context correctly.
Give the task with clear scope. Include: what to change, which files are relevant, what patterns to follow, and how to verify the result (usually: run this test command).
Review the proposed changes with
/diffbefore accepting. Check that Claude stayed within scope.Iterate once. If the output needs adjustment, follow up in the same session with a correction. Note what you had to add: that belongs in your CLAUDE.md so Claude gets it right the first time next session.