← Back to Course|Developer Tools
🖥️
Terminal / CLI ToolRequires Claude API or Pro

Claude Code (CLI)

by Anthropic — terminal-native agentic coding assistant

Claude Code is Anthropic's terminal-native AI coding tool. Unlike editor plugins, it runs directly in your shell — giving it full access to your filesystem, git history, terminal output, and the ability to run commands. It is the most powerful option for agentic tasks: give it a goal and it autonomously reads files, writes code, runs tests, and iterates.

Made by
Anthropic
Interface
Terminal (CLI)
Requires
Claude Pro or API
Platform
Mac, Linux, WSL
Model
Claude 3.5/3.7 Sonnet
Install via
npm (Node.js)

⚡ Install & Setup

1
Install Node.js
Claude Code requires Node.js 18+. Download from nodejs.org or run: brew install node (Mac).
2
Install Claude Code
Run in terminal: npm install -g @anthropic-ai/claude-code
3
Authenticate
Run: claude — on first launch it opens your browser to sign in with your Anthropic account. Requires Claude Pro ($20/month) or an API key (pay-per-use, very affordable for coding tasks).
4
Verify installation
Run: claude --version — you should see the version number. Then cd into any project and run: claude
# Install and launch:
npm install -g @anthropic-ai/claude-code
cd my-project
claude

🚀 Sample Usage

Interactive Mode — Ask & Iterate
$ claude
> Explain the auth flow in this project
[Claude reads src/auth/, middleware, and routes, then explains]

> Add JWT refresh token rotation. Write tests too.
[Claude creates files, runs npm test, fixes failures, done]
One-Shot Commands (non-interactive)
# Ask a question and get output:
claude "What does the processPayment function do?"

# Pipe a diff for review:
git diff --staged | claude "Review this diff before I commit"

# Run a file through Claude:
claude "Add error handling to all async functions" src/api/users.ts
CLAUDE.md — Persistent Project Context

Create a CLAUDE.md file in your project root. Claude Code reads it automatically every session:

# CLAUDE.md
## Stack Node.js + Express + PostgreSQL
## Conventions
- Use AppError for all errors (src/lib/errors.ts)
- No console.log — use logger from src/lib/logger.ts
## Tests vitest, run with npm test

💡 Pro Tips

  • Always start agentic tasks in a clean git branch — Claude will modify multiple files
  • The CLAUDE.md file is your most powerful tool — detailed context = better output
  • Use Ctrl+C to interrupt Claude mid-task and redirect it
  • Press y to accept file changes, n to reject, or type a correction
  • API key mode (no Pro required): set ANTHROPIC_API_KEY in your environment and billing kicks in at ~$0.003/1K tokens
→ Compare: GitHub Copilot→ Compare: Windsurf