01 — the beginning
Next module →
01 — the beginning

Getting started
with Claude Code.

Claude Code is a terminal-native AI pair programmer. This module walks you from install to your first productive session in under 15 minutes.

Read time22 min
LevelBeginner
Quiz6 questions
Module01 / 06
01 — the install

Installing Claude Code

One command. Works on macOS, Linux, and Windows (WSL).

Claude Code is distributed as an npm package. You need Node.js 18+ and an Anthropic API key. If you're using Claude Enterprise, your key is pre-configured.

bash
# Install globally
npm install -g @anthropic-ai/claude-code

# Verify install
claude --version

# Start a session in your project
cd your-project
claude

55 Tech setup: Your API key is managed by the IT team via environment variables. Run echo $ANTHROPIC_API_KEY to verify it's set before running Claude Code.

02 — the session

Your first session

Claude Code is a conversation, not a command.

When you run claude in a project directory, Claude reads your codebase, your CLAUDE.md instructions, and your conversation history. Every response is grounded in your actual code — not a generic answer.

Your request natural language Claude reads codebase + CLAUDE.md Response code / answer
Figure 1 — Claude reads your full project context before responding
03 — the superpower

CLAUDE.md: teaching Claude your codebase

A CLAUDE.md file is the most impactful thing you can add to any project.

Claude reads CLAUDE.md at the start of every session. It's your project's README for the AI — write it once, get consistent, project-aware answers forever.

What to includeTech stack, naming conventions, test commands, CI setup, key file paths
What to excludeAnything already obvious from the code — don't repeat what Claude can read directly
Keep it shortUnder 200 lines. Every extra line competes for attention with your actual request
04 — the rules

What goes in CLAUDE.md — and what doesn't

Written once, applied every session. CLAUDE.md is where you encode the rules Claude must never forget.

Unlike a README (written for humans who read it once), CLAUDE.md is read by Claude on every single session boot. That means every line competes with your actual request for context window space. The goal is maximum signal, minimum noise.

Always includeTech stack, framework versions, naming conventions, test commands, CI pipeline, response format, key file paths
Never includeAnything derivable from reading the code — don't explain what Claude can see. Avoid duplicating obvious patterns
GuardrailsHard rules: "Never edit .env directly", "Never push to main", "Always run tests before committing". Negative constraints matter
Skill triggers"Read the error-handling skill before writing any exception class" — this is how skills fire automatically, not just on demand
markdown
# CLAUDE.md — 55 Tech project name

## Stack
NestJS 10 · Node 20 · MongoDB · TypeScript strict

## Rules
- Never edit .env directly — use ConfigService
- Never push to main — always use a branch
- Run `npm test` before every commit
- Errors: always throw NestJS built-in exceptions

## Skills
Read error-handling before writing any exception class.
Read unit-tests before writing any test file.

The "read [skill] before doing X" pattern is how skills become automatic. Without this line, Claude only uses skills when explicitly asked.

05 — the five sections

CLAUDE.md: the 5-section structure

Every well-built CLAUDE.md follows the same five sections — in this order.

These sections cover what Claude needs to know before writing a single line: the stack, the system layout, the hard constraints, the available skills, and where to find deeper docs. Sessions that start with a structured CLAUDE.md consistently outperform sessions that don't.

SectionWhat goes hereExample
StackTech stack, versions, runtimeNestJS 10 · Node 20 · MongoDB · TypeScript strict
ArchitectureModule structure, key paths, patternsFeature-first NestJS modules in src/[feature]/
RulesHard constraints Claude must never breakNever push to main · Never edit .env directly
SkillsTrigger lines for auto-loaded skill filesRead error-handling before writing any exception
Docs referenceTable pointing to docs/ files for on-demand loaddocs/business-rules.md → any business logic
markdown
# CLAUDE.md — TiffinConnect Backend

## Stack
NestJS 10 · Node 20 · MongoDB (port 27018) · TypeScript strict · Docker Compose

## Architecture
Feature-first: src/[feature]/[feature].module|controller|service|dto|schema|spec.ts
All routes: /api/v1/[feature]/ — prefix and versioning are global, never add manually
ResponseInterceptor wraps all 2xx in { success, statusCode, data } automatically

## Rules
- Never edit .env directly — use ConfigService
- Never push to main — always branch
- Always run npm test before committing
- Throw NestJS built-in exceptions only (NotFoundException, ConflictException, etc.)
- Never use ../../ across module boundaries — use @common/* and @config/*

## Skills
Read error-handling before writing any exception class.
Read unit-tests before writing any test file.
Read feature-explainer before documenting any feature.

## Docs
| File                         | Read before working on                  |
|------------------------------|-----------------------------------------|
| docs/order-lifecycle.md      | Orders, subscriptions, planner          |
| docs/business-rules.md       | Any business logic                      |
| docs/open-questions.md       | Review at session start — check blockers|
06 — the case study

TiffinConnect: before and after CLAUDE.md

The same project. The same developer. The difference is what Claude reads at session start.

TiffinConnect is a NestJS + MongoDB meal-delivery platform. Before adding CLAUDE.md, every session started with re-explaining the architecture. After, Claude opened the session already knowing the module structure, forbidden patterns, and which skill to read before writing tests.

AreaBefore CLAUDE.mdAfter CLAUDE.md
Session startClaude asks "what's the tech stack?"Claude opens knowing stack, structure, rules
Error handlingClaude generates raw Error objects or custom classesClaude reads error-handling skill, throws NestJS built-ins
Module structureDifferent shape every session — DTOs in types/, tests in __tests__/Identical shape every time — co-located, feature-first
ImportsClaude uses ../../ relative paths across modulesKnows to use @common/* and @config/* aliases
Test runsOften forgotten until the PRWired as a hard rule — runs npm test before every commit

Key insight: CLAUDE.md eliminates the "orient the AI" phase at the start of every session. The session cost drops by ~40% just from not having to re-explain context that should already be known.

07 — do's and don'ts

CLAUDE.md: what works and what backfires

The mistakes that cost tokens are usually in what you put in, not what you leave out.

✓ Write for Claude, not humansCLAUDE.md is read by an AI every session — write imperatives ("Never push to main"), not descriptions ("This project uses main branch")
✓ Put skill triggers in Rules"Read error-handling before writing any exception class" — without this, Claude uses skills only when asked, not automatically
✓ Build the docs reference tablePoint to docs/ files with "read before working on" column — keeps CLAUDE.md lean while domain knowledge stays accessible
✓ Stay under 200 linesEvery line competes with your actual request for context window space. Exceeding 200 lines means you're spending session budget on Claude.md, not on code
✗ Don't explain what the code already showsDon't describe architecture that's obvious from the file structure. Don't repeat module names that are visible in src/. Claude can read the code
✗ Don't put domain knowledge in CLAUDE.mdOrder lifecycle rules, business logic, settlement formulas — these belong in docs/. Loading them every session wastes tokens on tasks that don't need them
Check your understanding
1. What does Claude Code read at the start of every session to understand your project?
Correct.Not quite — the correct answer is highlighted above.
2. What is the minimum Node.js version required to install Claude Code?
Correct.Not quite — the correct answer is highlighted above.
3. What is the recommended maximum length for a CLAUDE.md file?
Correct.Not quite — the correct answer is highlighted above.
4. What pattern makes a skill fire automatically without the user explicitly asking for it?
Correct.Not quite — the correct answer is highlighted above.
5. In the 5-section CLAUDE.md structure, where should detailed order lifecycle rules and business logic go?
Correct.Not quite — the correct answer is highlighted above.
6. What is the primary benefit of adding the TiffinConnect CLAUDE.md compared to having no CLAUDE.md?
Correct.Not quite — the correct answer is highlighted above.