Claude Code Intro Lesson 2 of 3

Basic Operations

What this lesson teaches

Claude Code can read files, write code, run commands, and answer questions about your codebase. This lesson covers the essential operations you'll use daily.

Asking Questions

The simplest way to use Claude Code is to ask questions:

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

Claude reads relevant files and explains. Be specific—vague questions get vague answers.

Reading Files

Claude automatically reads files when needed. You can also be explicit:

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

Claude understands relative paths from your project root.

Writing and Editing Files

Ask Claude to create or modify files:

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

Claude will show you the changes before applying them. You can accept, reject, or ask for modifications.

Tip: Review changes carefully before accepting. Claude is good but not perfect—always verify the logic.

Running Commands

Claude can run shell commands for you:

> Run the tests
> Install lodash
> Check git status

It will ask for confirmation before executing potentially dangerous commands.

Useful Slash Commands

These built-in commands help manage your session:

  • /help — Show available commands
  • /clear — Clear conversation history
  • /compact — Summarize context to save tokens
  • /cost — Show token usage and cost

Remember: Long conversations consume more tokens. Use /clear or /compact when starting new tasks.

Key Takeaways

  • Ask specific questions for better answers
  • Claude reads and writes files with your permission
  • Review all changes before accepting
  • Use slash commands to manage your session