Getting Started with Claude Code
Claude Code is an agentic coding tool that lives in your terminal. This guide will get you up and running quickly.
Prerequisites
- Node.js 18 or higher
- A terminal (macOS Terminal, iTerm2, Windows Terminal, etc.)
- An Anthropic API key or Claude Pro/Team subscription
Installation
Using npm (Recommended)
npm install -g @anthropic-ai/claude-codeVerify Installation
claude --versionAuthentication
Option 1: API Key
export ANTHROPIC_API_KEY=sk-ant-xxxxxOption 2: Browser Login
claude loginFirst Session
Start Claude Code
# In any project directory
cd my-project
claudeBasic Commands
| Command | Description |
|---------|-------------|
| Just type | Ask Claude anything |
| /help | Show available commands |
| /clear | Clear conversation history |
| /exit | Exit Claude Code |
Quick Examples
Ask about your code
What does the main function in app.js do?
Make changes
Add error handling to the API endpoint in routes/users.js
Run commands
Run the test suite and fix any failures
Explore codebase
How is authentication implemented in this project?
Project Setup
Create CLAUDE.md
Add context about your project:
echo "# My Project
Built with React and Node.js.
## Commands
- npm run dev - Start dev server
- npm test - Run tests
## Conventions
- Use TypeScript
- Follow ESLint rules" > CLAUDE.mdKey Features
Tool Permissions
Claude will ask before:
- Writing or editing files
- Running shell commands
- Accessing external services
Context Awareness
Claude Code automatically:
- Reads relevant files
- Understands project structure
- Maintains conversation history
Multi-File Operations
Claude can:
- Edit multiple files atomically
- Create new files and directories
- Refactor across the codebase
Keyboard Shortcuts
| Shortcut | Action |
|----------|--------|
| Ctrl+C | Cancel current operation |
| Ctrl+D | Exit Claude Code |
| Up Arrow | Previous message |
| Tab | Auto-complete file paths |
Next Steps
- Add memory: Create a CLAUDE.md file for your project
- Try slash commands: Use
/helpto see available commands - Set up MCP: Connect external tools and services
- Create hooks: Automate repetitive tasks