Skip to main content

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

explain

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:

  1. Analyzing your request
  2. Using tools to accomplish tasks (reading files, running commands, etc.)
  3. Responding with results and explanations

Example Interaction

Try it: See how Claude reads and modifies files.

claude

   ╭─────────────────────────────────╮
   │                                 │
   │   ██████╗██╗      █████╗ ██╗   │
   │  ██╔════╝██║     ██╔══██╗██║   │
   │  ██║     ██║     ███████║██║   │
   │  ██║     ██║     ██╔══██║██║   │
   │  ╚██████╗███████╗██║  ██║██║   │
   │   ╚═════╝╚══════╝╚═╝  ╚═╝╚═╝   │
   │                                 │
   │         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:

CommandDescription
/helpShow help and available commands
/clearClear conversation history
/compactSummarize and compact the conversation
/statusShow current session status
/costDisplay token usage and costs
/tasksList 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:

First Session
beginner
📁 my-project/
📄 ├── package.json
📁 ├── src/
📄 └── README.md
*Initialized. No CLAUDE.md found.*
>
💡Claude can explore your project even without CLAUDE.md. Try asking about the codebase.

Interactive: Essential Commands

Learn the built-in commands that help manage your session:

Essential Commands
beginner
📁 my-project/
📄 └── CLAUDE.md
*Initialized. Found CLAUDE.md.*
>
💡These commands give you visibility into your session state.