
1 - Claude CLI Tutorial: Zero to Productive in 10 Minutes
๐ Table of Contents
- Introduction
- Your Journey
- What is Claude CLI?
- Prerequisites
- Installation Guide
- Authentication Setup
- Your First Commands
- FAQ
- Conclusion
๐ฏ Introduction
The Problem: You're coding in your terminal. You hit a bug. You alt-tab to browser, open Claude.ai, copy-paste error, wait for response, copy code back to terminal. Repeat 20 times a day. You're bleeding 2 hours daily to context switching.
What if Claude lived in your terminal?
That's exactly what Claude CLI delivers. โก
In this tutorial, you'll install Claude Code, authenticate your account, and run your first commands in under 10 minutes. Whether you're debugging a gnarly error, generating boilerplate code, or exploring a new codebase, Claude CLI transforms your terminal into an AI-powered development environment.
Let's get started. โฑ๏ธ
๐ Your Journey: From Zero to Production AI Engineer
This is Post 1 of a 9-post series that will transform you from a Claude CLI beginner into a production AI systems engineer.
The Complete 9-Week Roadmap
๐ YOU ARE HERE (Post 1)
โ
๐ Destination: Production AI Engineer (Post 9)
Phase 1: Fundamentals ๐ฑ (Posts 1-2, 2 weeks)
- Install and configure Claude CLI on any system
- Execute interactive conversations that solve real problems
- Navigate codebases with AI assistance
- Debug complex issues through natural language
Phase 2: Automation โ๏ธ (Posts 3-5, 3 weeks)
- Write bash scripts that integrate Claude into your workflows
- Create custom slash commands for one-word automation
- Integrate Claude directly into VS Code with keyboard shortcuts
- Build automated code review and testing pipelines
Phase 3: Advanced Systems ๐๏ธ (Posts 6-9, 4 weeks)
- Deploy custom MCP servers connecting Claude to your infrastructure
- Implement enterprise security (SSO, RBAC, PII detection, audit logging)
- Build production observability with OpenTelemetry, Prometheus, Grafana
- Design workflow architectures that multiply team productivity
- Deploy to production with governance, compliance, and cost optimization
The Transformation
Before: You alt-tab constantly, copy-paste manually, lose context every tab switch.
After: Claude lives in your terminal, IDE, and CI/CD pipeline. Custom commands handle repetitive tasks. Automated workflows run code reviews, generate tests, and update documentation. Production systems serve your team with enterprise security and observability.
Real Results from Production
- Anthropic: 3x faster prototyping with Claude Code workflows
- Microsoft: 90% reduction in boilerplate code generation time
- Google Research: 21% faster code development in production
Why Follow This Series?
OpenAI adopted MCP in March 2025. Google DeepMind followed in April. Microsoft integrated it into Copilot Studio. The AI development ecosystem is consolidating around production-grade patterns.
This isn't about playing with AI tools. This is about building production AI systems that ship. ๐ข
Timeline: 9 posts. One per week. In 9 weeks, you deploy enterprise AI infrastructure.
Let's start your transformation. โฌ๏ธ
๐ก What is Claude CLI?
Claude CLI (also called Claude Code) is an agentic coding tool that lives directly in your terminal.
Think of it as Your AI Pair Programmer
Not just a chatbot that answers questions. Claude CLI is an agentic system that acts in your codebase:
๐ฅ Pair programmer who never gets tired ๐ Codebase expert who instantly understands your project ๐ค Autonomous assistant who executes multi-step tasks ๐ง DevOps engineer integrated with git, npm, CI/CD
The 5 Key Benefits
๐ซ No Context Switching โ Stay in terminal, no browser tabs ๐ง Automatic Project Understanding โ Reads your codebase automatically โก Multi-Step Task Execution โ Not just answers, but actions ๐ง Native Tool Integration โ Works with git, npm, and your stack ๐ด Cached Operations โ Some features work offline
CLI vs Web Interface: When to Use Each
| Feature | ๐ป Claude CLI | ๐ Web Interface | |---------|---------------|-----------------| | Environment | Terminal | Browser | | Codebase Awareness | Automatic | Manual upload | | Git Integration | Native | None | | Automation | Full support | Limited | | Setup | One-time install | None needed |
Use CLI when: You code in terminal, need automation, value speed Use Web when: One-off questions, mobile access, quick lookup
Real Use Cases
๐จ Code Generation
claude "Create a REST API endpoint for user registration with email validation"
๐ Debugging
claude "Why is this React component re-rendering infinitely?"
๐ Documentation
claude "Generate README.md for this project"
๐ Code Review
git diff main | claude "Review these changes for potential bugs"
Claude CLI excels at tasks that require understanding your project contextโsomething tedious to provide manually in a web interface.
โ Prerequisites
Before installing, make sure you have:
Required
- ๐ป Terminal access: macOS Terminal, Linux shell, Windows PowerShell, or WSL
- ๐ Claude account: Free account at claude.ai or Claude Console
- ๐ Internet connection: For installation and authentication
Recommended
- ๐ง Basic terminal skills: Navigating directories, running commands
- ๐ A code project: To test Claude CLI with real work
- ๐ฆ Git installed: For git-integrated workflows (optional)
System Requirements
- macOS: 10.15 (Catalina) or later
- Linux: Most modern distributions (Ubuntu 20.04+, Fedora 35+)
- Windows: Windows 10/11 with PowerShell 5.1+ or WSL2
๐ก Good news: No Node.js required! Installation methods handle dependencies automatically.
โ๏ธ Installation Guide
Claude CLI offers multiple installation methods. Choose the one that fits your platform.
๐ macOS Installation
Option 1: Homebrew (Recommended)
brew install --cask claude-code
Option 2: Install Script
curl -fsSL https://claude.ai/install.sh | bash
Verification:
claude --version
# Expected: claude-code version 2.x.x
Time: ~2-3 minutes
๐ง Linux Installation
Universal Install Script (works on Ubuntu, Debian, Fedora, Arch):
curl -fsSL https://claude.ai/install.sh | bash
The script automatically:
- Detects your distribution
- Installs dependencies
- Downloads Claude CLI binary
- Adds to PATH
- Verifies installation
Verification:
which claude
claude --version
Time: ~3 minutes
๐ช Windows Installation
Option 1: PowerShell (Recommended)
Open PowerShell as Administrator:
irm https://claude.ai/install.ps1 | iex
Option 2: Command Prompt
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
Option 3: WSL (Windows Subsystem for Linux)
Inside your WSL terminal:
curl -fsSL https://claude.ai/install.sh | bash
Verification:
claude --version
Time: ~3 minutes
๐ฆ Alternative: NPM Installation
If you prefer npm (requires Node.js 18+):
npm install -g @anthropic-ai/claude-code
Useful for:
- Node.js-based development workflows
- Teams using npm for tool management
- Environments where install scripts are blocked
๐ Common Installation Issues
"Command not found: claude"
Cause: Installation succeeded, but binary isn't in your PATH.
Solution for macOS/Linux:
# Add to your shell profile (~/.bashrc, ~/.zshrc, etc.)
export PATH="$PATH:$HOME/.claude/bin"
source ~/.bashrc # or ~/.zshrc
Solution for Windows:
- Open System Properties โ Environment Variables
- Add
C:\Users\YourUsername\.claude\binto PATH - Restart PowerShell
"Permission Denied"
Cause: Installer lacks write permissions.
Solution for macOS/Linux:
# Don't use sudo! Instead, fix permissions:
sudo chown -R $(whoami) /usr/local/bin
# Then re-run the install script
Solution for Windows: Run PowerShell as Administrator.
"Homebrew not found" (macOS)
Install Homebrew first:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Then install Claude CLI
brew install --cask claude-code
curl command fails
Cause: Network restrictions or firewall.
Solutions:
- Check firewall/proxy settings
- Try npm installation instead
- Download manually from claude.ai/download
๐ Authentication Setup
Now that Claude CLI is installed, let's authenticate your account.
First-Time Authentication (3 Steps)
Step 1: Navigate to any project directory and launch:
cd ~/projects/my-app
claude
Step 2: Press Enter when prompted:
Welcome to Claude Code! ๐
To get started, please authenticate your account.
Press Enter to open your browser and log in...
Step 3: Complete browser auth:
- Browser opens to
https://claude.ai/auth - Log in with your credentials
- Authorize Claude CLI access
- See confirmation: "Authentication successful!"
Back in terminal:
โ
Authentication successful
โ
Account: user@example.com (Claude Pro)
โ
Session started
Ready to code! Type /help for commands or start chatting.
Total time: ~2 minutes
Account Types
| Account | Cost | Usage Limits | Best For | |---------|------|--------------|----------| | Free | $0 | Standard limits | Learning, personal projects | | Pro | $17-20/month | 5x higher than Free | Daily development work | | Max | $100/month | 5x-20x higher than Pro | Power users, heavy usage | | Team | $25-30/user/month** | Higher than Pro | Team collaboration (min. 5 users) | | Enterprise | Custom | Highest + SSO | Production systems |
**$17/month annual or $20/month | **Team: $25/month annual or $30/month (minimum 5 members)
๐ก Recommendation: Start with Free. Upgrade to Pro ($20/mo) for daily work, Max ($100/mo) for heavy usage, or Team ($30/mo/user) for collaboration.
Re-authentication
Switch accounts or refresh session:
claude /login
Or within an interactive session:
/login
Authentication Troubleshooting
Browser doesn't open:
- Copy the URL shown in terminal and open manually
"Authentication failed" error:
- Verify your Claude.ai account is active
- Check internet connection
- Try clearing auth cache:
rm -rf ~/.config/claude/auth && claude /login
"Invalid session" after working previously:
- Sessions expire after 30 days of inactivity
- Simply re-authenticate:
claude /login
๐ฎ Your First Commands
Congratulations! Claude CLI is installed and authenticated. Let's run some commands.
The 3 Command Modes
๐ฌ Interactive Mode โ Multi-turn conversations (claude)
โก One-Shot Mode โ Quick questions (claude "query")
๐ Print Mode โ Automation scripts (claude -p "query")
Remember: Interactive for dev sessions, One-shot for quick answers, Print for automation.
๐ฌ Interactive Mode: Your AI Pair Programmer
Launch:
cd ~/projects/my-app
claude
You'll see:
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ ๐ค Claude Code - Interactive Mode โ
โ Model: Claude Sonnet 4.5 โ
โ Project: my-app โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Type /help for commands or start chatting...
>
Try this conversation:
> What does this project do? ๐ค
[Claude analyzes package.json, README, src/ structure]
This is a React e-commerce application with...
> How is authentication handled? ๐
[Claude reads auth/ directory]
Authentication uses JWT tokens with...
> Create a utility function to format dates in MM/DD/YYYY ๐
[Claude generates code]
function formatDate(date) {
const mm = String(date.getMonth() + 1).padStart(2, '0');
const dd = String(date.getDate()).padStart(2, '0');
const yyyy = date.getFullYear();
return `${mm}/${dd}/${yyyy}`;
}
Would you like me to add this to a file?
Exit: Press Ctrl+D or type /exit
โก One-Shot Mode: Quick Questions
For fast answers without starting a session:
claude "Explain how JavaScript promises work"
Real Examples:
Generate commit message:
claude "Write a commit message for: $(git diff --staged)"
Quick code snippet:
claude "Show me a Python function to validate email addresses"
Look up syntax:
claude "What's the syntax for async/await in Python?"
๐ Print Mode: For Scripts & Automation
Print mode (-p flag) outputs clean text onlyโperfect for piping and scripting:
claude -p "Generate a Python function to calculate fibonacci numbers"
Automation Examples:
Generate documentation:
claude -p "Create API documentation for: $(cat server.js)" > API.md
Analyze logs:
tail -f /var/log/app.log | grep ERROR | \
claude -p "Explain these errors and suggest fixes"
Code review in git hook:
# .git/hooks/pre-commit
git diff --cached | claude -p "Review for bugs and style issues" || exit 1
Understanding Output Formats
Interactive Output (conversational):
> Create a hello world function
Here's a hello world function:
```javascript
function helloWorld() {
console.log("Hello, World!");
}
Would you like me to add it to a file?
**Print Output** (clean, scriptable):
```javascript
function helloWorld() {
console.log("Hello, World!");
}
๐ฏ Your First Real Task (5-Minute Challenge)
Let's solve a real performance bug:
Step 1: Navigate to your project
cd ~/projects/my-react-app
Step 2: Launch interactive mode
claude
Step 3: Describe the problem
> I have a React component that's re-rendering too often.
Can you analyze src/components/UserProfile.js?
Claude's typical response:
I found the issue! ๐ฏ In UserProfile.js line 15:
useEffect(() => {
fetchUserData();
}, []); // โ Missing userId dependency!
The useEffect hook is missing `userId` in its dependency array.
Here's the fix:
useEffect(() => {
fetchUserData();
}, [userId]); // โ
Runs when userId changes
Would you like me to show the complete corrected version?
Step 4: Get the solution
> Yes, show me the corrected version
Step 5: Apply the fix
> Write this to src/components/UserProfile.js
Step 6: Verify
Ctrl+D # Exit Claude
npm run dev # Test your app
Result: ๐ Performance bug fixed in under 5 minutes, without leaving your terminal!
โ FAQ
<details> <summary><strong>What is Claude CLI?</strong></summary>Claude CLI (Claude Code) is a command-line interface for Anthropic's Claude AI that brings conversational AI assistance directly into your terminal. It understands your codebase, executes development tasks, and integrates with your workflows through natural language commands.
In short: AI pair programmer living in your terminal. ๐ค
</details> <details> <summary><strong>Is Claude CLI free?</strong></summary>Claude CLI is available to all Claude users. Current plans:
- Free: $0/month - Standard usage limits (learning, personal projects)
- Pro: $20/month - 5x higher limits, Claude Code access (daily development)
- Max: $100/month - 5x-20x higher than Pro, extended thinking, priority access (power users)
- Team: $30/user/month - Team features, higher limits (min. 5 users for collaboration)
- Enterprise: Custom pricing - Highest limits, SSO, SCIM, audit logs (production systems)
Start with Free and upgrade as needed. Usage is metered based on your Claude account plan.
</details> <details> <summary><strong>How do I install Claude CLI?</strong></summary>Quick install commands:
- macOS:
brew install --cask claude-code - Linux:
curl -fsSL https://claude.ai/install.sh | bash - Windows:
irm https://claude.ai/install.ps1 | iex(PowerShell as Admin) - npm:
npm install -g @anthropic-ai/claude-code
Takes ~3 minutes on any platform.
</details> <details> <summary><strong>Claude CLI vs ChatGPT CLIโwhat's different?</strong></summary>Claude CLI advantages:
- โ Automatic codebase understanding (no manual context)
- โ Native git integration
- โ Direct file editing
- โ Autonomous multi-step task execution
ChatGPT CLI: Requires more manual context management, lacks native code-aware features.
TLDR: Claude CLI is purpose-built for software development.
</details> <details> <summary><strong>Do I manually provide code files to Claude?</strong></summary>๐ซ No! Claude CLI automatically understands your project structure.
When you ask questions in a project directory, Claude:
- Scans project structure
- Reads relevant files as needed
- Maintains context across conversations
You never manually upload unless you want to focus on a specific snippet.
</details> <details> <summary><strong>Can Claude CLI modify my files?</strong></summary>โ Yes, with your permission.
Claude can read, create, and modify files. Always review changes before committing!
Safety tip: Use checkpoints (covered in Post 6) to instantly revert unwanted changes.
</details> <details> <summary><strong>Does Claude CLI work offline?</strong></summary>โ No - requires internet connection.
Claude's AI models run on Anthropic's servers. Some data is cached locally for faster responses during active sessions, but internet is required for AI inference.
</details>๐ Conclusion
You've installed Claude CLI, authenticated your account, and learned the three command modes (interactive, one-shot, and print). But this is just scratching the surface. Claude CLI becomes exponentially more powerful when you master interactive conversations, custom workflows, and automation scripts.
๐ What's Next?
In Post 2: "Master Claude CLI Interactive Mode", you'll learn:
โก Advanced slash commands for power users ๐ง Multi-turn conversation strategies for complex problems โจ๏ธ Keyboard shortcuts that save hours ๐ Real-world debugging workflows (with examples) ๐พ Context management across sessions
Challenge
Before moving on, spend 10 minutes pairing with Claude:
- Navigate to one of your projects
- Launch
claudein interactive mode - Ask: "What does this project do?"
- Ask a follow-up question about a specific file or feature
- Try generating a small utility function
You'll be amazed how quickly it becomes part of your workflow.
๐ Resources
- Official Claude Code Documentation
- Claude Code GitHub Repository
- Anthropic Community Forum
- Claude Code Best Practices
Next in Series: ๐ Post 2: Master Claude CLI Interactive Mode โ
๐ค Join the Community
Share your success: What problem did Claude CLI solve for you today? ๐ฌ
Questions or stuck?: Drop a comment below for help ๐ค
Did this tutorial help you? Share it with your team and follow for the next post in the series!
Questions or stuck on installation? Drop a comment below and let's troubleshoot together.
Last Updated: November 2025 | Claude Code Version 2.x | Written for developers by developers