Intermediate

What is Claude Code

Claude Code is an agentic command-line tool that gives Claude direct access to your local development environment. Unlike the Claude.ai web interface, Claude Code can read your files, write code, run shell commands, and iterate autonomously on multi-step tasks — all from your terminal, inside your actual project.

What Makes Claude Code Different from Claude.ai Chat

Claude.ai (web chat)

  • You paste code snippets manually
  • Claude reads only what you share in the conversation
  • Claude generates code but does not run it (except in React Artifact sandbox)
  • No access to your file system, terminal, or tools
  • Each conversation starts with no project context

Claude Code (CLI)

  • Claude reads your actual project files directly
  • Claude can explore the full codebase — you don't need to paste anything
  • Claude can run shell commands, tests, and build scripts
  • Claude can write files and make changes directly
  • CLAUDE.md provides persistent project context across sessions

What Claude Code Can Do

Claude Code has access to a set of tools that give it agency over your local environment:

  • Read files: Explores your project structure, reads any file you have access to
  • Write files: Creates new files and edits existing ones — with your approval (unless pre-approved)
  • Run shell commands: Execute test suites, build scripts, linters, git commands, and arbitrary terminal commands
  • Search codebase: Grep, glob, and search across files to find relevant code without you specifying exact paths
  • Browse the web: Fetch documentation, check API references, or look up current information (when enabled)
  • Call MCP tools: Access external tools and services via the Model Context Protocol (databases, APIs, cloud services)

How Claude Code Sessions Work

You start a Claude Code session by running claude in your project directory. Claude Code then:

  1. Reads any CLAUDE.md files in the project hierarchy (project instructions + memory)
  2. Enters an interactive REPL — you type tasks, Claude executes them
  3. Prompts you for permission before file writes and shell commands (unless pre-approved)
  4. Maintains conversation context within the session — earlier results inform later actions
  5. Saves memory automatically for the next session (if configured)

Sessions are stateful within a single invocation. Context does not persist between separate claude invocations by default — CLAUDE.md is the mechanism for cross-session memory.

When to Use Claude Code vs the Web Interface

  • Use Claude Code for: multi-file code changes, debugging with actual error output, running tests and iterating on failures, refactoring a codebase, understanding an unfamiliar project, build and deployment automation
  • Use Claude.ai for: one-off questions, writing and editing tasks not related to code, research, conversation-oriented tasks, quick code snippets you just want to copy
  • Use both together: Claude.ai for planning and research; Claude Code for implementation — they share the same underlying model but have different tool access

Claude Code's Approach to Safety

Claude Code is designed around the principle of minimal footprint — it asks before taking actions with side effects, prefers reversible actions over irreversible ones, and stops to ask when uncertain rather than proceeding autonomously.

Defaults are cautious: file writes and shell commands require explicit approval unless you pre-approve them in settings. You can widen permissions to streamline your workflow, but the conservative defaults exist to prevent unintended changes to your codebase.

Checklist: Do You Understand This?

  • Claude Code is a CLI with direct file system and shell access — not a chat interface wrapper
  • Key capabilities: read files, write code, run shell commands, search codebase, call MCP tools
  • Sessions start fresh each invocation — CLAUDE.md provides the cross-session project context
  • Use Claude Code for multi-step code tasks; use Claude.ai for writing, research, and quick questions
  • Default permissions are cautious — Claude asks before writes and shell commands unless pre-approved

Page built: 01 Jun 2026