6  The Basics

You’ve installed Claude Code. Now let’s understand how to actually use it effectively.

6.1 Starting Claude Code

Always start Claude Code from inside a project folder:

cd ~/Projects/my-project
claude

Claude Code will: 1. Read your project structure 2. Understand the context (what kind of project, what files exist) 3. Be ready to help

Don’t Start from Home Directory

Starting Claude from ~ or / gives it access to your entire file system. Always cd into a specific project first.

6.2 The Conversation Model

Claude Code is a conversation. You describe what you want, Claude responds, you refine.

6.2.1 Good Prompts

Specific and actionable:

> Create a Python script that reads data.csv and prints the column names

With context:

> I'm getting an error when I run main.py - can you look at it and fix it?

Describing the goal:

> I want to analyze this dataset to find correlations between columns A and B

6.2.2 Less Effective Prompts

Too vague:

> Help me with my code

No context:

> Fix the bug

Multiple unrelated things:

> Write a function for X, also change the CSS, and explain quantum physics

6.3 How Claude “Sees” Your Project

When you start Claude Code in a project, it can:

  • List files: See the structure of your project
  • Read files: Look at the contents of any file
  • Search: Find specific text across your project
  • Understand context: Know what kind of project this is

It cannot see: - Files outside the current directory (unless you explicitly reference them) - Hidden system files (usually) - Very large files in their entirety (it may sample them)

6.4 Tools: How Claude Interacts

Claude Code uses tools to do things. The main ones:

Tool What It Does Example
Read Look at a file See contents of main.py
Write Create/modify files Create new_file.py
Edit Make specific changes Change line 42 of config.json
Bash Run commands python script.py, git status
Glob Find files by pattern Find all *.csv files
Grep Search file contents Find where “error” appears

When Claude wants to use a tool, you’ll see it in the output:

Claude wants to use: Read
File: ./data/input.csv

Allow? [y/n]

6.5 The Approval Cycle

For your safety, Claude Code asks before making changes.

6.5.1 Automatic Approvals

Some actions are low-risk and may be auto-approved: - Reading files - Listing directories - Searching for text

6.5.2 Manual Approvals

Higher-risk actions require your okay: - Creating or modifying files - Running shell commands - Deleting anything

6.5.3 Making a Decision

When prompted, you can:

Input What Happens
y or Enter Approve and continue
n Reject this action
(type text) Give feedback or ask for changes

Example:

Claude wants to use: Write
File: ./report.py
Content: [shows the code]

Allow? [y/n] Actually, can you add error handling for missing files?

Claude will revise and ask again.

6.6 Reading Files and Understanding Code

A common first step is understanding what exists:

> What files are in this project?
> Show me the main.py file
> Explain what the process_data function does

Claude will read the relevant files and explain in plain language.

6.7 Making Changes

When you want Claude to change something:

  1. Describe what you want

    > Add a function to calculate the average of a list
  2. Review the proposal Claude shows you exactly what it will write/change

  3. Approve or refine

    • y to accept
    • Describe what should be different
  4. Verify

    > Run the tests to make sure it works

6.8 Running Commands

Claude can run terminal commands for you:

> Run the Python script main.py
> Install pandas and numpy
> Show me the git history

Each command requires approval. Always read what command will be executed before approving.

Be Careful with Commands

Before approving a command, make sure you understand what it does. Be especially careful with:

  • Commands containing rm (delete)
  • Commands with sudo (administrator access)
  • Commands that modify your git history
  • Commands that install software globally

6.9 Session State

Within a session, Claude remembers: - Previous conversation - Files it has read - Changes it has made

When you exit and restart, Claude starts fresh but can still read your project files.

6.10 Helpful Commands

Built-in commands start with /:

Command What It Does
/help Show available commands
/clear Clear conversation history
/exit Exit Claude Code

6.11 Practice Exercise

Let’s practice the basics. In your claude-test folder from before:

  1. Start Claude Code:

    cd ~/Projects/claude-test
    claude
  2. Ask Claude to create a simple Python script:

    > Create a Python script called greet.py that asks for my name and says hello
  3. Review and approve the file creation

  4. Run it:

    > Run greet.py
  5. Ask Claude to modify it:

    > Make it also ask for my favorite color and include that in the greeting
  6. Test the changes work

  7. Exit:

    > exit

6.12 Next Steps

You understand the basics. Now let’s look at a more realistic workflow.

Continue to Core Workflow.