Free Chapter

Chapter 2 — Setting Up Your Environment

Most friction in AI-assisted development comes from a misconfigured environment. Get Node, Git, VS Code, and Claude Code set up once — correctly.

Most of the friction in AI-assisted development comes from a misconfigured environment. The wrong Node version, a stale Git, a terminal that does not play nicely with the Claude Code CLI — any one of these can turn a five-minute task into a one-hour debugging session. This chapter walks through the setup so you only have to do it once.

2.1 Choosing your operating system

Everything in this book works on Windows 10/11, macOS 12+, and Ubuntu 22.04+. If you are on Windows, install Windows Subsystem for Linux (WSL2) with an Ubuntu distribution. WSL2 makes the Node and Git ecosystem behave the same on Windows as it does on macOS and Linux. It is worth the fifteen minutes it takes to set up. The rest of the book assumes a Unix-like shell, which WSL2 provides.

2.2 Installing Visual Studio Code

Download VS Code from code.visualstudio.com. After installing, install three extensions from the marketplace: ESLint, Prettier, and GitLens. We will install the Claude Code extension separately in Chapter 8.

Open VS Code's settings (Ctrl+, or Cmd+,) and turn on Format On Save. This single setting will save you thousands of small style fights with Claude over the life of the book.

2.3 Installing Node.js

The simplest approach is nvm, the Node Version Manager. On macOS and Linux:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
# restart your shell, then:
nvm install 20
nvm use 20
node --version   # should print v20.x

On Windows, use nvm-windows from the GitHub releases. Optionally, install pnpm for faster installs:

npm install -g pnpm

2.4 Installing and configuring Git

Most systems already have Git. Verify, then configure your identity once globally:

git --version
git config --global user.name  "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main

If you have not already, generate an SSH key and add it to GitHub. Claude Code will use Git frequently, and SSH keys avoid password prompts that can interrupt long agent runs.

2.5 Creating your Claude.ai account

Go to claude.ai and sign up. The free tier is enough to follow most of Parts I and II. Download the desktop app from claude.ai/download — it has a global hotkey, better file uploads, and pairs with the Claude Code VS Code extension so you can switch between chat and your editor without leaving either.

2.6 Getting an Anthropic API key

Go to console.anthropic.com, sign in, and create an API key. Add five US dollars of credit — enough to complete every example in this book with margin. Store the key in a password manager, then export it in your shell:

# in ~/.zshrc or ~/.bashrc
export ANTHROPIC_API_KEY="sk-ant-..."

Never commit this key. Chapter 28 covers secret hygiene in detail.

2.7 Installing Claude Code

npm install -g @anthropic-ai/claude-code
claude --version

The first time you run claude in a folder, it prompts you to authenticate. The flow opens a browser, you log in, and it returns to the terminal with a confirmation. From that point forward, claude just works.

2.8 Configuring the integrated terminal

Open VS Code's integrated terminal (Ctrl+```). Make sure it is using the same shell where you set ANTHROPIC_API_KEY`. Test the whole stack:

mkdir hello-claude && cd hello-claude
claude
> create a README.md that explains what this folder is for

If a README.md appears, you are done.

2.9 Smoke test

Inside the same folder:

> generate a 5-question quiz about JavaScript closures, with answers,
  and save it to quiz.md

Read quiz.md. Notice that Claude Code wrote the file without you typing anything. This is the rhythm of the rest of the book.

Key Takeaway. A clean environment removes most of the friction in AI-assisted work. Spend an hour now setting it up properly, and reclaim that hour ten times over the course of this book.