Claude Code Intro Lesson 2 of 3

Basic Operations

Overview

Claude Code supports four primary operation categories: codebase querying, file manipulation, shell command execution, and session management. This lesson documents each category with representative usage patterns.

Codebase Queries

Natural language queries against the codebase constitute the most fundamental operation:

> What does the auth middleware do?
> How is error handling implemented?
> Where is the database connection configured?

Claude Code identifies and reads the relevant source files before generating a response. Query specificity directly correlates with response quality.

File Operations

Claude Code reads files automatically when context requires it. Explicit read requests are also supported:

> Read src/config.js and explain the settings
> Show me the User model

File creation and modification follow the same pattern:

> Create a helper function for date formatting in utils/
> Add input validation to the signup form
> Fix the bug in the payment calculation

All file modifications are presented as diffs for review prior to application. The user retains the ability to accept, reject, or request revisions.

Shell Command Execution

Claude Code can execute shell commands within the project environment:

> Run the tests
> Install lodash
> Check git status

Commands classified as potentially destructive require explicit user confirmation before execution.

Plan Mode

For non-trivial tasks, plan mode enables Claude Code to explore the codebase, design an implementation strategy, and present it for approval before writing any code. This reduces wasted effort on complex changes by establishing alignment prior to implementation.

Memory

Claude Code maintains a persistent, file-based memory system. User preferences, project conventions, and recurring context are stored across sessions. This eliminates the need to re-supply the same information in each conversation and enables Claude Code to build a cumulative understanding of the project.

Session Management Commands

Built-in slash commands provide control over the active session:

  • /help — Display available commands and usage information
  • /clear — Reset conversation history to reclaim context capacity
  • /compact — Compress prior context via summarization
  • /cost — Report token consumption and associated cost
  • /fast — Toggle fast output mode (same model, higher throughput)

Note: Token consumption increases monotonically over the course of a conversation. Executing /clear or /compact at task boundaries prevents unnecessary context accumulation.

Key Takeaways

  • Query specificity directly determines response quality
  • All file modifications require explicit user approval
  • Plan mode enables design-first workflows for complex tasks
  • Memory persists context across sessions automatically
  • Slash commands provide precise session state control