Library
Claude Code Mastery · Chapter 2 of 10
Chapter 02

Setting Up Claude Code
Like a Professional

A calm, complete workstation is the quiet secret of every serious AI builder.

SetupToolingBeginner FriendlyHands-on
A Handbook For Builders
Setting Up Claude Code
Like a Professional
Chapter 02
The Claude Code Handbook
Prologue

Your workstation is your instrument.

A concert pianist tunes their piano before the concert. A chef sharpens their knives before service. An AI builder configures their workstation before the first prompt. This chapter is the tuning session for the rest of the book — twenty quiet minutes now will save you hundreds of frustrating hours later.

We will install five foundational tools (VS Code, Claude Code, Git, Node.js, Python), configure two API providers (Anthropic and OpenRouter), and end by shipping your first real Claude Code project. Every step includes a screenshot placeholder so you can compare what you see to what the book expects.

Section 2.0

Learning Objectives

  • Install and configure VS Code, Claude Code, Git, Node.js and Python correctly on Mac, Windows or Linux.
  • Understand the terminal well enough to move around, create files, and run commands without fear.
  • Create Anthropic and OpenRouter API keys and store them safely with environment variables.
  • Design a clean, professional folder layout for every future project.
  • Ship your first working Claude Code project end-to-end.
Part I · Editor

1. Installing VS Code

Visual Studio Code (VS Code) is a free, fast, extensible code editor from Microsoft. It is the industry-standard editor for AI development, and Claude Code plugs into it beautifully.

Step-by-step install

  1. Open code.visualstudio.com in your browser.
  2. Click the big download button — the site auto-detects your operating system.
  3. Open the installer, accept the defaults, and launch VS Code once it finishes.
  4. On Mac, also run Shell Command: Install 'code' command in PATH from the Command Palette (Cmd+Shift+P).
Claude Code — Terminal
Screenshot placeholder
VS Code download page with the operating-system-aware download button highlighted.
Figure — VS Code download page with the operating-system-aware download button highlighted.
Claude Code — Terminal
Screenshot placeholder
First launch of VS Code showing the welcome tab and the Extensions icon on the left activity bar.
Figure — First launch of VS Code showing the welcome tab and the Extensions icon on the left activity bar.
Part I · Editor

2. Installing Claude Code

Claude Code ships as a command-line tool you run from your terminal. It reads and edits files in whatever folder you launch it from — that folder becomes your workspace for the session.

bashclaude-code
# macOS or Linux
curl -fsSL https://claude.ai/install.sh | sh

# Windows (PowerShell)
irm https://claude.ai/install.ps1 | iex

# Verify
claude --version
Claude Code — Terminal
Screenshot placeholder
Successful Claude Code installation printing the version number in the terminal.
Figure — Successful Claude Code installation printing the version number in the terminal.

The first time you run claude, you will be asked to log in with your Anthropic account or an API key. Either works; we will set up an API key in section 8 for automation.

Part II · Version Control

3. Git

Git is the time-machine of software. It records every change you make so you can undo, branch, and collaborate safely. When you let an AI edit your code, Git is your seatbelt.

bashclaude-code
# Install (macOS)
brew install git
# Install (Windows) — use git-scm.com installer
# Install (Ubuntu)
sudo apt install git

# Configure once
git config --global user.name "Your Name"
git config --global user.email "you@example.com"

# Basic loop
git init          # start tracking a folder
git add .         # stage changes
git commit -m "message"   # save a snapshot
git log --oneline # see history
Claude Code — Terminal
Screenshot placeholder
Terminal output of git log --oneline after three commits, showing a clean linear history.
Figure — Terminal output of git log --oneline after three commits, showing a clean linear history.
Part II · Version Control

4. GitHub

GitHub is a cloud home for your Git repositories. It gives you backup, collaboration, portfolio, and — in later chapters — deployment triggers. Create a free account at github.com.

  1. Sign up with a professional-looking username.
  2. Create a new empty repository called claude-code-playground.
  3. Follow the "push an existing repository" snippet GitHub shows you.
bashclaude-code
git remote add origin https://github.com/<you>/claude-code-playground.git
git branch -M main
git push -u origin main
Claude Code — Terminal
Screenshot placeholder
GitHub new-repository page with a suggested name and the visibility set to Private.
Figure — GitHub new-repository page with a suggested name and the visibility set to Private.
Part III · Runtimes

5. Node.js

Node.js runs JavaScript outside the browser. You will use it for the web-app chapters and for many AI SDKs. Install the LTS version.

bashclaude-code
# macOS
brew install node
# Windows — nodejs.org installer, "LTS" option
# Ubuntu
sudo apt install nodejs npm

node --version
npm --version
Claude Code — Terminal
Screenshot placeholder
Terminal showing node --version returning v20.x and npm --version returning 10.x.
Figure — Terminal showing node --version returning v20.x and npm --version returning 10.x.
Part III · Runtimes

6. Python

Python is the lingua franca of AI. Most agent frameworks, notebooks, and research libraries live here. Install Python 3.11 or newer.

bashclaude-code
# macOS
brew install python@3.12
# Windows — python.org installer, TICK "Add Python to PATH"
# Ubuntu
sudo apt install python3 python3-venv python3-pip

python3 --version
pip3 --version
Claude Code — Terminal
Screenshot placeholder
Windows Python installer with the 'Add Python to PATH' checkbox visibly ticked.
Figure — Windows Python installer with the 'Add Python to PATH' checkbox visibly ticked.
Part IV · Fluency

7. Terminal Basics

The terminal is where Claude Code lives. You do not need to memorize hundreds of commands — ten will take you 80% of the way.

bashclaude-code
pwd            # where am I?
ls             # what's in this folder?
cd projects    # move into a folder
cd ..          # up one folder
mkdir demo     # make a new folder
touch app.py   # create an empty file
cat app.py     # print file contents
rm app.py      # delete the file
clear          # clear the screen
history        # what did I just run?
Claude Code — Terminal
Screenshot placeholder
Split view of the terminal running pwd, ls, and cd to navigate into a project folder.
Figure — Split view of the terminal running pwd, ls, and cd to navigate into a project folder.
Part V · APIs

8. Anthropic API Key

For anything programmatic, you need an Anthropic API key. This is what gives your code the right to talk to Claude.

  1. Go to console.anthropic.com and sign up.
  2. Add billing (a few dollars is enough to build every project in this book).
  3. Open API Keys → Create Key, name it handbook-dev, and copy the value.
  4. Paste it into your .env file as ANTHROPIC_API_KEY.
Claude Code — Terminal
Screenshot placeholder
Anthropic console showing a new API key, with the copy button highlighted.
Figure — Anthropic console showing a new API key, with the copy button highlighted.
Part V · APIs

9. OpenRouter (Backup Provider)

OpenRouter is a single API that fronts dozens of AI models — Claude, GPT, Gemini, Llama, and more. It is invaluable when you want to compare models or fall back automatically.

  1. Sign up at openrouter.ai.
  2. Top up $5 of credits.
  3. Generate a key and store it as OPENROUTER_API_KEY.
Claude Code — Terminal
Screenshot placeholder
OpenRouter dashboard listing available models with per-token pricing.
Figure — OpenRouter dashboard listing available models with per-token pricing.
Part VI · Configuration

10. Environment Variables

An .env file is a plain text file where you keep secrets, one per line. Your app reads them at runtime, so the secrets stay out of Git.

dotenvclaude-code
ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxx
OPENROUTER_API_KEY=sk-or-xxxxxxxxxxxx
NODE_ENV=development
bashclaude-code
# .gitignore  <-- add this line so secrets never reach GitHub
.env
Claude Code — Terminal
Screenshot placeholder
Side-by-side view of a .env file and a matching .gitignore that excludes it.
Figure — Side-by-side view of a .env file and a matching .gitignore that excludes it.
Part VI · Configuration

11. Folder Structure

A predictable folder layout lets Claude Code find things quickly and lets future-you understand past-you. Use this template for every new project:

treeclaude-code
my-project/
├─ .env                # secrets (ignored by git)
├─ .gitignore
├─ README.md           # what & why
├─ CLAUDE.md           # notes to the AI (repo conventions)
├─ src/                # your code
│  ├─ index.ts
│  └─ lib/
├─ prompts/            # reusable prompt templates
├─ scripts/            # one-off automation
├─ tests/
└─ docs/
Claude Code — Terminal
Screenshot placeholder
File tree in VS Code sidebar matching the folder structure recommended by the handbook.
Figure — File tree in VS Code sidebar matching the folder structure recommended by the handbook.
Part VII · Editor Power

12. Essential VS Code Extensions

  • Prettier — automatic formatting.
  • ESLint — catches JavaScript mistakes.
  • Python (Microsoft) — Python language support.
  • GitLens — supercharged Git in VS Code.
  • Error Lens — surfaces errors inline while you type.
  • Docker — for the deployment chapter.
  • Even Better TOML — for config files.
Claude Code — Terminal
Screenshot placeholder
VS Code Extensions marketplace with Prettier, ESLint, GitLens and Error Lens installed.
Figure — VS Code Extensions marketplace with Prettier, ESLint, GitLens and Error Lens installed.
Part VII · Editor Power

13. Project Organization Rules

  1. One folder per project — never mix two apps in one repo unless it is a monorepo.
  2. Write a one-paragraph README.md before you write any code.
  3. Keep secrets in .env, config in config/, and content in content/.
  4. Commit little and often — small commits are easy to review and easy to undo.
Part VIII · Hands-on

14. Your First Prompt

Open a new terminal, cd into your empty project folder, and run:

bashclaude-code
claude "Create a Python script that prints the first 20 Fibonacci numbers,
save it as fib.py, then run it and show me the output."
Claude Code — Terminal
Screenshot placeholder
Claude Code creating fib.py, running it, and streaming the output back into the terminal.
Figure — Claude Code creating fib.py, running it, and streaming the output back into the terminal.

Notice how Claude Code broke the request into steps: create → run → report. That is the loop from Chapter 1 in the wild.

Part VIII · Hands-on

15. Your First Real Project

Let us build a tiny Markdown-to-HTML converter, entirely through Claude Code.

bashclaude-code
mkdir md2html && cd md2html
git init
claude "Set up a Node.js project called md2html using TypeScript.
Add a single command 'convert' that takes a .md file and writes a styled .html file
in the same folder. Include a nice CSS theme, a README, and one test file.
Then run the test to prove it works."
Claude Code — Terminal
Screenshot placeholder
Terminal split view: Claude Code scaffolding the project on the left, VS Code showing the created files on the right.
Figure — Terminal split view: Claude Code scaffolding the project on the left, VS Code showing the created files on the right.
Claude Code — Terminal
Screenshot placeholder
Browser rendering the styled HTML output from the freshly built md2html tool.
Figure — Browser rendering the styled HTML output from the freshly built md2html tool.