← 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 Opus 4.8 / Sonnet 4.6
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

⚖️ Which Coding Tool Should I Pick?

The current tool is highlighted. There is no single winner - pick by how you like to work.

ToolTypePricingBest forModels / AI
GitHub CopilotIDE extensionFree tier; Pro ~$10/moAI in your existing editorGPT-5.5, Claude Sonnet 4.6, Gemini 3.5
CursorAI IDE (VS Code fork)Hobby free; Pro $20/moAll-round AI editor + agentGPT-5.5, Claude Opus 4.8 / Sonnet 4.6
WindsurfAI IDE (VS Code fork)Free tier; paid plansAgentic flows (Cascade)Frontier models + own
Google AntigravityAgent-first IDEFree public previewAutonomous build + browser testGemini 3.5
Claude Code (CLI)(this page)Terminal agentClaude sub or APIAgentic coding in the terminalClaude Opus 4.8 / Sonnet 4.6 / Haiku 4.5
VS Code + AI extEditor + extensionsFree options existKeep VS Code, add AIDepends on extension

Pricing and model support change often. Verified June 2026 - confirm on each tool's official site.

🛠️ Troubleshooting & Common Pitfalls

command not found: claude
Re-run the global install and make sure your npm global bin directory is on your PATH. Restart the terminal afterward.
Authentication errors
Log in with your Claude subscription, or set ANTHROPIC_API_KEY in your environment for API-key mode.
Too many permission prompts
Configure allowed tools / commands in settings, or run with the right permission mode - but review what you allow.
Token costs climbing
Scope each task, use /clear to reset context between tasks, and prefer a cheaper model (Haiku) for simple jobs.

📚 Related Course Lessons

Go deeper on the skills this tool is for:

L46 - Agentic CodingL47 - Custom AI ExtensionsL56 - From Prompter to Loop DesignerL59 - Skills

🔗 Official Resources

Product pageWhat it is + how to installDocumentationCommands, CLAUDE.md, MCP, agentsnpm packagenpm i -g @anthropic-ai/claude-codeGitHub repoIssues + sourcePricingSubscription + API rates

Links open the official sites. Pricing and features change often - always confirm there. (Verified June 2026.)

→ Compare: GitHub Copilot→ Compare: Windsurf