Beginner15 min1 prerequisite

Learn the essential commands, shortcuts, and interaction patterns for working with Claude Code effectively.

Basic Commands and Interactions

Claude Code uses natural language for most interactions, but has several built-in commands and features that make working more efficient.

Starting Sessions

Basic Start

Terminal
claude

Starts Claude Code in the current directory.

With Options

Terminal
# Start with a specific model
claude --model claude-opus-4-20250514

# Resume previous conversation
claude --continue

# Start with an initial prompt
claude "Explain this project structure"

Built-in Commands

Commands start with / and provide quick actions.

Essential Commands

CommandDescription
/helpShow all available commands
/exitExit Claude Code
/clearClear conversation history
/modelSwitch AI model
/compactSummarize conversation to save context

File Commands

CommandDescription
/read <path>Read a file into context
/treeShow project structure
/search <query>Search codebase

Session Commands

CommandDescription
/saveSave conversation
/loadLoad saved conversation
/historyShow conversation history
/undoUndo last file change

Natural Language Interactions

Asking Questions

Simply ask in plain English:

Terminal
What does the UserService class do?

How is authentication handled in this app?

What database is this project using?

Requesting Actions

Describe what you want done:

Terminal
Add input validation to the signup form

Create a new API endpoint for user preferences

Fix the bug where prices show as undefined

Giving Instructions

Provide detailed specifications:

Terminal
Create a React component called ProductCard:
- Display product image, title, and price
- Include "Add to Cart" button
- Use Tailwind for styling
- Support a "featured" variant with a badge

Approval Flow

Claude Code asks for confirmation before actions.

File Changes

Terminal
Claude Code: I'll update src/components/Button.tsx to add the loading state.

This will:
- Add a loading prop
- Show a spinner when loading
- Disable the button during loading

Proceed? [Y/n]

Type y (or just Enter) to approve, n to reject.

Command Execution

Terminal
Claude Code: I need to run this command:
npm install framer-motion

This will install the framer-motion animation library.

Allow? [Y/n]

Auto-Approve Mode

For faster iteration (use carefully):

Terminal
/autoApprove on

Claude Code will make changes without asking. Turn off with:

Terminal
/autoApprove off

Keyboard Shortcuts

During Input

ShortcutAction
EnterSend message
Shift+EnterNew line
Up ArrowPrevious message
Down ArrowNext message
Ctrl+CCancel/Exit
Ctrl+LClear screen

During Approval

KeyAction
y or EnterApprove
nReject
eEdit before applying
?Get more details

Providing Context

Reference Files

Use @ to reference files:

Terminal
Look at @src/api/users.ts and explain the authentication logic

Include Code Snippets

Use markdown code blocks:

Terminal
This code isn't working:

```javascript
const data = await fetch('/api/users')
console.log(data.users)

What's wrong?

Terminal

### Share Error Messages

I'm getting this error when I run npm build:

Error: Cannot find module './utils' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1048:15) at Module.require (node:internal/modules/cjs/loader:1140:19)

Terminal

## Working with Output

### Copy Code

When Claude Code shows code, you can:
- Select and copy normally
- Use the copy button if available
- Apply directly to files

### Apply Suggestions

When Claude Code suggests changes:

Claude Code: Here's the updated function:

Terminal
function calculateTotal(items: Item[]): number {
  return items.reduce((sum, item) => sum + item.price * item.quantity, 0)
}

Apply this change? [Y/n]

Terminal

### Request Modifications

If the suggestion isn't quite right:

That's close, but also add tax calculation

Terminal

Claude Code will revise its suggestion.

## Conversation Patterns

### Iterative Refinement

Build up complex changes step by step:

You: Create a basic user profile component

Claude Code: [Creates component]

You: Add an edit mode with form inputs

Claude Code: [Adds edit functionality]

You: Make it responsive for mobile

Claude Code: [Adds responsive styles]

Terminal

### Clarifying Questions

If Claude Code needs more information:

Claude Code: I can add user avatars. A few questions:

  1. Should avatars be stored locally or in cloud storage?
  2. What's the maximum file size?
  3. Should I support cropping?
Terminal

### Confirm Understanding

Claude Code often confirms before proceeding:

Claude Code: Let me make sure I understand. You want me to:

  1. Add a "favorites" table to the database
  2. Create API endpoints for adding/removing favorites
  3. Add a heart icon button to ProductCard
  4. Create a Favorites page listing saved items

Is that correct? [Y/n]

Terminal

## Handling Mistakes

### Undo Changes

If something goes wrong:

/undo

Terminal

Reverts the last file change.

### Multiple Undos

/undo 3

Terminal

Reverts the last 3 changes.

### Start Over

/clear

Terminal

Clears conversation but keeps file changes.

### Full Reset

For a complete fresh start:

/exit claude

Terminal

## Session Management

### Save Important Conversations

/save feature-auth

Terminal

Saves current conversation as "feature-auth".

### Resume Later

claude --continue

Terminal

Or load a specific save:

/load feature-auth

Terminal

### Compact Long Sessions

When context gets long:

/compact

Terminal

Claude Code summarizes the conversation to free up context space.

## Getting Help

### Built-in Help

/help

Terminal

Shows all commands and usage.

### Specific Command Help

/help search

Terminal

Shows details about the search command.

### Ask Claude Code

How do I use you to run tests?

What's the best way to refactor this large file?

Terminal

Claude Code can explain its own features.

## Summary

**Starting:**
- `claude` to start
- `--continue` to resume
- `--model` to specify model

**Commands:**
- `/help` - Get help
- `/clear` - Clear history
- `/undo` - Revert changes
- `/save` and `/load` - Manage sessions

**Interactions:**
- Natural language for requests
- `@file` to reference files
- Code blocks for snippets
- `Y/n` for approvals

**Shortcuts:**
- `Enter` to send
- `Ctrl+C` to cancel
- `Up/Down` for history

## Next Steps

Now that you know the basics, let's explore how Claude Code understands and works with your project's context.
Mark this lesson as complete to track your progress