Claude Code
Install Anthropic's terminal-first AI agent and run your first task
What is Claude Code?
Claude Code is Anthropic’s command-line AI agent. It runs in your terminal, reads your entire project, and can plan, write, edit, and debug code across multiple files autonomously.
Key features:
- Understands your full codebase through long context (200K tokens)
- Creates, edits, and deletes files
- Runs commands and tests
- Iterates on errors automatically
- Respects your project’s style and conventions
Installation
Step 1: Install Claude Code
npm install -g @anthropic-ai/claude-codeVerify it installed:
claude --versionYou should see a version number.
Step 2: Authenticate
Run Claude Code for the first time:
claudeIt will walk you through authentication. You have two options:
Option A — Anthropic Console (API key):
- Go to console.anthropic.com
- Create an account if you don’t have one
- Go to API Keys and create a new key
- When Claude Code asks, paste your key
Option B — Claude Pro/Max subscription: If you have a Claude Pro or Max subscription at claude.ai, Claude Code can use that directly. Follow the prompts to log in with your Anthropic account.
Claude Code requires authentication with an Anthropic account. Your instructor will provide access details. You can authenticate via an API key or through a Claude Pro/Max subscription.
If you’re working on a remote server (SSH, VS Code Remote), the browser-based login won’t work directly. Instead, use Option A (API key) — set the key as an environment variable before starting Claude:
export ANTHROPIC_API_KEY="sk-ant-your-key-here"claudeThis bypasses browser auth entirely. You can also add the export to your ~/.bashrc so it persists across sessions.
Your first interaction
Let’s do a “hello world” — the simplest possible task to make sure everything works.
Step 1: Create a project folder
mkdir hello-claude && cd hello-claudeStep 2: Start Claude Code
claudeStep 3: Give it a task
Type this into Claude Code:
Create a simple HTML page that says "Hello from Claude Code!" with adark background and centered white text. Make it look clean and modern.Watch what happens:
- Claude plans what to create
- It creates an
index.htmlfile - It writes the HTML, CSS, and content
- It tells you what it did
Step 4: Check the result
ls # See the file(s) Claude createdcat index.html # Look at the contentsOpen the file in your browser:
open index.htmlIf you’re in WSL, open it with:
explorer.exe index.htmlOr if you’re in VS Code, right-click the file in the Explorer panel and select “Open with Live Server” or “Reveal in File Explorer.”
Open the file in your browser:
xdg-open index.htmlIf you’re on a remote server (SSH), use VS Code’s file explorer to preview, or copy the file to your local machine. If you used VS Code Remote, just click the HTML file and it opens locally.
You should see a clean webpage with your message. You just built a website by describing what you wanted in plain English.
Useful Claude Code commands
Once inside a Claude Code session, these are helpful:
| Command | What it does |
|---|---|
/help | Show available commands |
/clear | Clear the conversation |
/cost | Show how much this session has cost |
Ctrl+C | Exit Claude Code |
Tips for effective use
-
Start in your project directory. Always
cdinto your project folder before runningclaude. This gives it access to your files. -
Be specific. “Make it look nice” → vague. “Use a dark theme with #09090b background, rounded corners, and subtle border” → specific and predictable.
-
Iterate. Don’t try to get everything right in one prompt. Start with the basic structure, then refine: “Now add a navigation bar” → “Make the nav sticky” → “Add a mobile hamburger menu.”
-
Let it run. Claude Code will often plan multiple steps and ask for confirmation. When it asks “Should I proceed?”, say yes unless something looks wrong.
What's the best practice when starting Claude Code for a project?