Claude Code Basics
Claude Code is Anthropic's official CLI tool for AI-assisted software development. It runs in your terminal and has direct access to your filesystem, allowing it to read, write, and execute code.
Try It Live
Ask me anything about getting started with Claude Code
Press Cmd/Ctrl + Enter to submit
Getting Started
Installation
# Install via npm
npm install -g @anthropic-ai/claude-code
# Or via Homebrew
brew install claude-code
Starting a Session
# Start in current directory
claude
# Start in a specific directory
claude /path/to/project
# Resume a previous conversation
claude --continue
Core Interaction Model
Claude Code operates through a conversational interface. You type natural language requests, and Claude responds by:
- Analyzing your request
- Using tools to accomplish tasks (reading files, running commands, etc.)
- Responding with results and explanations
Example Interaction
Try it: See how Claude reads and modifies files.
╭─────────────────────────────────╮ │ │ │ ██████╗██╗ █████╗ ██╗ │ │ ██╔════╝██║ ██╔══██╗██║ │ │ ██║ ██║ ███████║██║ │ │ ██║ ██║ ██╔══██║██║ │ │ ╚██████╗███████╗██║ ██║██║ │ │ ╚═════╝╚══════╝╚═╝ ╚═╝╚═╝ │ │ │ │ claude code │ │ │ ╰─────────────────────────────────╯
Key Concepts
1. Context Awareness
Claude Code reads your project's structure and understands:
- File contents and relationships
- Code patterns and conventions
- Project configuration (package.json, build files, etc.)
- Git history and status
2. CLAUDE.md Files
You can create a CLAUDE.md file in your project root to give Claude persistent instructions:
# CLAUDE.md
## Project Overview
This is a Node.js API using Express...
## Conventions
- Use async/await, not callbacks
- Tests go in __tests__ directories
- Use TypeScript strict mode
## Commands
- npm test: Run tests
- npm run build: Build project
Claude reads this file automatically and follows your guidelines.
3. Tool Usage
Claude has access to specialized tools:
- Read: Read file contents
- Write: Create new files
- Edit: Modify existing files
- Bash: Run shell commands
- Glob: Find files by pattern
- Grep: Search file contents
- WebSearch/WebFetch: Access web information
- Task: Spawn specialized sub-agents
4. Permission Model
Claude asks for permission before:
- Running potentially destructive commands
- Making significant file changes
- Accessing external resources
You can pre-approve common operations to streamline your workflow.
Built-in Commands
Type these directly in the CLI:
| Command | Description |
|---|---|
/help | Show help and available commands |
/clear | Clear conversation history |
/compact | Summarize and compact the conversation |
/status | Show current session status |
/cost | Display token usage and costs |
/tasks | List running background tasks |
Session Management
Conversation Continuity
Claude maintains context throughout your session. You can:
- Reference earlier parts of the conversation
- Build on previous work
- Ask follow-up questions
Automatic Summarization
Long conversations are automatically summarized to maintain context while managing token limits.
Interactive: Your First Session
Try this interactive terminal to experience Claude Code:
Interactive: Essential Commands
Learn the built-in commands that help manage your session: