Skip to main content
This guide will get you up and running with Claude Code quickly. We’ll cover starting a session, your first commands, and common workflows.

Prerequisites

Before starting, ensure you have:

Start Your First Session

Navigate to your project directory and run:
cd your-project
claude
You’ll see Claude Code initialize and present an interactive prompt:
╭─────────────────────────────────────────────╮
│  Claude Code - Ready to help you build     │
╰─────────────────────────────────────────────╯

Project: /home/user/your-project
Model: Claude Sonnet 4.6

>

Your First Commands

Ask About Your Code

Start by asking Claude about your codebase:
> What does this project do?
Claude will analyze your files and explain the project’s purpose, structure, and key components.

Make a Simple Change

Let’s add a feature:
> Add a README.md file with a basic project description
Claude will:
  1. Analyze your project
  2. Draft README content
  3. Show you the proposed file
  4. Ask for approval before creating it
Approve the change by responding:
> Yes, create it

Reference Specific Files

Use @ to reference files:
> Explain what @src/index.js does
Claude will read the file and provide a detailed explanation.
Type @ to see autocomplete suggestions for files in your project.

Core Workflows

Code Generation

Ask Claude to write code with natural language:
> Create a user authentication module with login and logout functions
Claude will:
  • Analyze existing code patterns
  • Generate code following your conventions
  • Show you the complete implementation
  • Wait for approval before writing files

Code Editing

Edit existing files:
> In @src/api.js, add error handling to the fetch function
Claude reads the file, makes targeted edits, and shows you a diff:
- const response = await fetch(url);
+ const response = await fetch(url).catch(err => {
+   console.error('Fetch failed:', err);
+   throw err;
+ });

Git Operations

Use built-in commands for git workflows:
> /commit
Claude will:
  1. Run git status and git diff
  2. Analyze your changes
  3. Draft a commit message
  4. Create the commit
Other git commands:
  • /commit-push-pr - Commit, push, and create a PR
  • Natural language: “Create a new branch called feature/auth”

Slash Commands

Slash commands provide quick access to common operations:
CommandDescription
/helpShow available commands
/commitCreate a git commit
/modelChange AI model
/clearStart a new conversation
/resumeResume a previous session
/configOpen configuration
/bugReport an issue
Type / to see autocomplete suggestions.
Type / and start typing to search commands. Press Tab to autocomplete.

Permission System

Claude Code asks for permission before executing potentially dangerous operations:
Claude wants to run:
  bash: rm old-file.js

Allow this operation?
  [a] Allow once
  [s] Allow for this session
  [n] Deny
  [r] Create rule
Choose your level of trust:
  • Allow once: Just this operation
  • Allow for session: All similar operations this session
  • Deny: Reject this operation
  • Create rule: Add permanent permission rule
The permission system protects you from unintended changes. Review carefully before granting permissions.

Working with Multiple Files

Claude can work across multiple files simultaneously:
> Refactor the authentication logic: move it from @src/app.js 
  to a new @src/auth.js module and update all imports
Claude will:
  1. Read both files
  2. Create the new module
  3. Update imports
  4. Show you all changes
  5. Execute after approval

Using Agents

Launch specialized agents for complex tasks:
> Launch a code-explorer agent to trace how authentication works
Agents run in the background and report results:
Agent: code-explorer [Running...]
Agent: code-explorer [Complete]

Findings:
- Entry point: src/app.js:23
- Authentication flow: 
  1. User credentials received (app.js:45)
  2. Password hashing (auth/hash.js:12)
  3. Database query (db/users.js:89)
  4. JWT token generation (auth/jwt.js:34)

Key files to review:
- src/app.js:23-67
- src/auth/hash.js:12-28
- src/auth/jwt.js:34-56

Advanced Features

Background Tasks

Run long operations in the background:
> Run the test suite in the background
Press Ctrl+B to view background task status.

Session Management

Resume previous conversations:
claude --resume
Select a session from the list to continue where you left off.

Context Management

View context usage:
> /context
See token usage, files loaded, and available space. Compact context when needed:
> /compact

Keyboard Shortcuts

ShortcutAction
EnterSend message
Shift+EnterNew line (multi-line input)
Ctrl+CCancel current operation
Ctrl+DExit Claude Code
Ctrl+GOpen external editor
Ctrl+BView background tasks
Ctrl+FKill all background agents
Up/DownNavigate command history
TabAutocomplete

Example Session

Here’s a complete example workflow:
# Start Claude Code
claude

# Ask about the project
> What are the main components of this application?

# Make changes
> Add input validation to the user registration form in @src/components/Register.js

# Review changes
> Show me what you changed

# Create a commit
> /commit

# Launch a code review
> Launch a code-reviewer agent to check my changes

# Exit
> /exit

Common Patterns

Feature Development

> /feature-dev Add user profile page with avatar upload
This launches a structured 7-phase workflow:
  1. Discovery - Clarify requirements
  2. Exploration - Analyze existing code
  3. Questions - Resolve ambiguities
  4. Architecture - Design approaches
  5. Implementation - Build the feature
  6. Review - Quality check
  7. Summary - Document results

Code Review

> Review the changes in @src/api.js for bugs and improvements
Claude analyzes:
  • Potential bugs
  • Performance issues
  • Code quality
  • Best practices
  • Security concerns

Debugging

> I'm getting "TypeError: Cannot read property 'name' of undefined" 
  in @src/user.js. Help me fix it.
Claude will:
  • Read the file
  • Identify the issue
  • Suggest fixes
  • Explain the root cause

Tips for Success

Be specific: Include file references, error messages, and context for better results.
Use @-mentions: Reference specific files and functions to give Claude precise context.
Review before approving: Always review proposed changes before allowing execution.
Iterate: Refine requests based on results. Claude remembers conversation context.

Troubleshooting

Claude doesn’t find my files

Issue: File references don’t autocomplete or aren’t found Solution: Ensure you’re in the project root or use full paths

Changes aren’t what I expected

Issue: Generated code doesn’t match your request Solution:
  • Provide more context with @-mentions
  • Reference similar existing code
  • Iterate with follow-up refinements

Permission prompts are annoying

Issue: Too many permission requests Solution: Create permanent rules:
  1. Choose “Create rule” option
  2. Define scope (session/project/user)
  3. Future similar operations auto-approve

Next Steps

Now that you’re familiar with the basics, explore:

Core Concepts

Learn how Claude Code works under the hood

Git Workflows

Master git operations with Claude

Task Automation

Create custom commands and agents

Configuration

Customize settings and permissions

Build docs developers (and LLMs) love