Getting started with Claude Code in 2026: setup to first commit
- Claude Code is Anthropic's terminal-native agentic coding tool. It runs in your shell, reads your files, writes code, runs commands, and iterates until the task is done.
- Setup is five steps: install, authenticate, write a CLAUDE.md, hand it a real task, then check costs in the Anthropic console. The whole sequence takes under 20 minutes.
- The most common beginner mistake is starting with a vague task. Claude Code performs significantly better with scoped, specific instructions — which is what a good CLAUDE.md provides.
What Claude Code actually is
Claude Code is not a chat interface. It is a command-line agent that reads your filesystem, executes bash commands, edits files, and iterates on its own output until it reaches the goal you describe. You start it in a project directory, give it a task, and it works through the problem step by step — reading existing code, making changes, running tests, and looping back if something fails.
The practical implication: Claude Code works best on real, scoped problems in real codebases. Asking it to "help me with my project" produces drift. Asking it to "add input validation to the createUser function in src/api/users.ts and update the corresponding tests" produces results.
Step 1 — Install
Claude Code requires Node.js 18 or higher. Verify with node --version before proceeding. Then install the CLI globally.
npm install -g @anthropic-ai/claude-code
Confirm the install succeeded:
claude --version
# → claude-code 1.x.x
If you see a permissions error on macOS or Linux, the standard fix is to adjust npm's global directory ownership rather than running npm with sudo. Anthropic's documentation covers this in the prerequisites section. On Windows, running the terminal as administrator handles most permission issues, but the WSL2 path is more reliable for heavy agentic use.
Step 2 — Authenticate
Claude Code authenticates against your Anthropic account. You need either a Claude Pro subscription (which includes a usage allowance) or an Anthropic API key for direct API billing.
claude login
This opens a browser window to complete OAuth. Once complete, the credentials are stored in ~/.claude/ and you will not need to repeat this step unless you switch accounts.
If you are using an API key directly — for example, in a CI environment or on a machine without browser access — set the environment variable instead:
export ANTHROPIC_API_KEY="sk-ant-api03-..."
The Claude Pro subscription tier includes a monthly token allowance that covers moderate individual use. If you are running Claude Code on large codebases, writing extensive tests, or running it in loops, you will likely hit the Pro limit and need to supplement with API credits. The Anthropic console shows your usage in real time — check it after your first few sessions to calibrate.
Step 3 — Write your CLAUDE.md
A CLAUDE.md file in your project root is how you tell Claude Code what kind of project it is working in, what commands to use, what to never touch, and how to run tests. Without one, Claude Code spends your tokens figuring out context it could have been given for free.
A minimal but effective CLAUDE.md covers five things:
# Project: [name]
## Stack
- Runtime: Node 20, TypeScript 5.3
- Framework: Next.js 14 (App Router)
- Database: PostgreSQL via Prisma
- Tests: Vitest, run with `npm test`
## Commands
- Dev server: `npm run dev`
- Build: `npm run build`
- Lint: `npm run lint` — fix before committing
- Migrate: `npx prisma migrate dev`
## Rules
- All new API routes go in src/app/api/
- Zod for all input validation — no raw req.body access
- Never touch the /legacy/ directory
- Do not remove console.error calls in error handlers
## Do not
- npm install packages without asking first
- Modify .env files
- Run database migrations without confirmation
The "Do not" section is the one most developers skip on their first pass, and it is the one that prevents the costly mistakes. If there are files Claude should never touch, name them. If there are commands it should never run autonomously, say so explicitly.
For a deeper treatment of CLAUDE.md structure, see our post on writing a CLAUDE.md that actually works. The Septim Starter pack ($9) includes a battle-tested template for five common project types — Next.js, Python Flask, Rails, Go, and plain Node — so you are not starting from a blank file.
Step 4 — Give it a real task
Navigate to your project directory and launch the interactive session. Claude Code reads your CLAUDE.md automatically on startup.
cd ~/projects/my-app
claude
At the prompt, give a task specific enough to have a clear done-state. Good first tasks for beginners:
- Add a rate limiter to the
/api/loginroute — 5 attempts per minute per IP, 429 on exceed - Write unit tests for every function in
src/lib/date-utils.ts— target 90% branch coverage - Refactor
src/components/UserTable.tsxto use React Query instead of raw fetch calls
Claude Code will read the relevant files, propose changes, and ask for permission before writing to disk or running commands. In the default configuration, it will confirm before any write operation — this is the right mode to learn in. You can loosen or tighten these permissions in ~/.claude/settings.json once you understand the tool's behavior.
What happens during the agentic loop
A typical Claude Code task runs through this cycle:
- Read the relevant source files to understand current structure
- Propose an implementation plan and list the files it will touch
- Write changes file by file, with explanation
- Run the test suite (if configured in CLAUDE.md) and iterate on failures
- Report completion and list every file changed
On straightforward tasks — adding a field to a form, writing a small utility function, fixing a type error — this runs in under two minutes. On larger tasks (refactoring a module, adding a feature end-to-end), plan for 5-15 minutes and a few rounds of iteration.
Step 5 — Check your costs
Claude Code is not free to run at scale, and beginner sessions often consume more tokens than expected because the context window fills with file reads, tool outputs, and conversation history.
The Anthropic console at console.anthropic.com shows your token usage broken down by model and date. After your first two or three sessions, check the dashboard to understand your burn rate before you start using Claude Code for longer tasks.
The three patterns that drive unexpected cost:
- Large files in context. If Claude Code reads a 10,000-line file to answer a question about one function, you paid for 10,000 lines of input tokens. Point it at specific files rather than asking broad questions about the whole codebase.
- Repeated context rebuilding. Each new message in a session re-sends the full conversation history. Long sessions get expensive. Start fresh sessions for unrelated tasks rather than continuing one session all day.
- Sub-agent spawning. Claude Code can spawn sub-agents for parallel work. Each sub-agent carries its own context. If you are running multiple agents, your cost scales accordingly. The Tokenocalypse guide covers this in detail — see the sub-agent cost breakdown.
A single well-scoped coding task typically costs $0.05–$0.40 in API credits depending on file size and complexity. A session where you ask Claude Code to understand your entire codebase before doing anything can cost several dollars. The CLAUDE.md you wrote in step 3 reduces that second pattern significantly — pre-supplied context replaces tokens spent on exploration.
Septim Starter — $9 pay-once
A structured onboarding kit for Claude Code beginners: CLAUDE.md templates for 5 project types, a permission-settings reference, a 30-task practice sequence, and a cost-calibration worksheet. You get the GitHub repo invite on purchase — no subscription, no expiry.
Get Septim Starter — $9 →Common first-session mistakes
Asking Claude Code to "look at my project and tell me what's wrong"
This burns the context window on a fishing expedition. The output is a general code review that might identify real issues, but at significant token cost. Use Septim Drills ($29) for structured code-review exercises, or point Claude Code at a specific file with a specific question.
Not reading the plan before approving it
Claude Code proposes a plan before executing. Read it. On complex tasks, the plan sometimes includes steps you would not sanction — dropping a table, removing a cache layer, touching a file you specifically excluded. Catching this at the plan stage is free. Catching it after the writes are done is a git revert.
Running it without version control
Claude Code writes to disk. Run it only in repositories with a clean working tree so you can git diff every change and git checkout . anything you disagree with. If you are not using git yet, initialize a repository before you start your first session.
Skipping the CLAUDE.md
Without a CLAUDE.md, Claude Code infers project context from file exploration. That inference costs tokens and is often wrong about conventions, forbidden commands, and test runners. The 20 minutes you spend on the CLAUDE.md in step 3 will save more than that across your first week of use.
Where to go next
Once you have completed a few tasks successfully, the natural next step is extending Claude Code with MCP servers — integrations that give it access to external tools like your database, GitHub, or browser. See the MCP server tutorial for a practical walkthrough.
If you are running Claude Code inside a team and want to set up automated PR review, the PR review setup guide covers the GitHub Action configuration end to end.
For cost management at scale — once you are past the beginner phase and using Claude Code daily — see the cost monitoring guide and the context management post.
Septim Starter — $9 · CLAUDE.md templates + onboarding kit
Five project-type templates, a 30-task practice sequence scoped for beginners, permission-settings reference, and a cost-calibration worksheet. Pay once, use indefinitely.
Buy Septim Starter — $9 → Or move to Septim Drills ($29) for structured practice →