Quick Start

Learn Claude Code essentials in 5 minutes

Quick Start

After completing installation and environment configuration, let's master Claude Code's core features in 5 minutes.

Launch Claude Code

Navigate to your project directory in the terminal and run:

cd /path/to/your/project
claude

You'll see Claude Code's interactive interface, ready to start a conversation.

Core Interactions

1. Understand Code

> What's the architecture of this project?
> Explain how src/auth/login.ts works
> Find all places that call the database

2. Generate Code

> Write a user registration API endpoint
> Add unit tests for the UserService class
> Create a React login form component

3. Edit Existing Code

> Refactor utils.js to improve readability
> Fix the memory leak in handleSubmit function
> Add TypeScript types to all public functions

4. Debug Issues

> Why is the user redirected to 404 after login?
> Analyze this error: TypeError: Cannot read property 'id' of undefined
> Investigate why the API response is slow

5. Git Operations

> Show me what files I've modified
> Commit these changes with a good commit message
> Create a PR description

Reference Files with @

Use the @ symbol to precisely reference specific files, letting Claude read their contents directly:

> Review @src/components/Header.tsx and optimize performance
> Compare @src/v1/api.js with @src/v2/api.js
> Analyze project dependencies based on @package.json

Tip: Press Tab after typing @ to autocomplete file paths.

Pipe Input

Pass output from other commands to Claude Code for analysis:

# Explain git changes
git diff | claude "explain these code changes"

# Analyze log errors
cat error.log | claude "analyze these errors and provide solutions"

# Review PR changes
gh pr diff 123 | claude "review this PR for code quality"

Common Slash Commands

Use / commands during a session:

Command Description
/help Show help info and all available commands
/clear Clear current conversation history
/compact Compress conversation history to save tokens
/model View or switch models (e.g., opus, sonnet)
/memory Edit project memory file CLAUDE.md
/init Auto-generate project configuration
/commit Smart commit with generated message
/review Code review
/bug Report an issue

Keyboard Shortcuts

Shortcut Function
Tab Autocomplete file paths
Esc Interrupt current output
Ctrl+C Cancel current operation
/ Browse command history

Initialize Project Configuration

On first use, run /init to let Claude analyze your project and generate configuration:

> /init

This creates a CLAUDE.md file containing: - Project tech stack and architecture overview - Common build and test commands - Code style guidelines - Project-specific conventions

Purpose of CLAUDE.md: Claude Code automatically reads this file on startup, helping the AI better understand your project context.

Practical Examples

Example 1: Add a New Feature

> I need to add a user avatar upload feature with:
  1. Support for JPG/PNG formats
  2. 2MB file size limit
  3. Auto-crop to 200x200 after upload
  4. Store in S3

Example 2: Fix a Bug

> User feedback: Page freezes after clicking "Save" button
> Please investigate the issue in @src/pages/EditProfile.tsx

Example 3: Code Review

> /review
> Focus on security issues and performance bottlenecks

Example 4: Smart Commit

> /commit

Claude will automatically: 1. Analyze all changes 2. Generate a proper commit message 3. Complete the commit

Efficiency Tips

  1. Be specific: Clearly describe what you want, including constraints
  2. Break it down: Split complex tasks into smaller steps
  3. Interrupt early: Press Esc immediately if output isn't what you want
  4. Use references: Use @ to specify files instead of letting AI guess
  5. Maintain context: Claude remembers previous conversation in the same session

Next Steps

Congratulations on mastering Claude Code essentials! Continue with:

  1. Explore CLI Tips for 34 practical tips
  2. Learn Workflow Tips to boost productivity
  3. Check out Codex Integration to use another AI tool