Development Environment Setup¶
Build a professional development environment with Claude Code CLI at the center.
What You'll Learn¶
- Terminal optimization for Claude Code CLI
- Essential developer tools and configurations
- IDE integration strategies
- Project scaffolding with Claude CLI
- Environment management best practices
CLI vs Web: The Development Advantage¶
Before diving in, understand why Claude Code CLI is superior for development:
| Capability | Web Claude | Claude Code CLI |
|---|---|---|
| Read project files | Manual copy/paste | Direct access |
| Edit code | Copy response back | Edits in place |
| Run tests | Describe results | Executes & sees output |
| Git operations | Instructions only | Creates commits/PRs |
| Environment access | None | Full shell access |
| Tool integration | None | MCP, hooks, commands |
| Automation | None | Scripts, CI/CD |
| Context | Conversation only | Full project context |
Terminal Setup¶
Recommended Terminal Emulators¶
| Platform | Recommended | Why |
|---|---|---|
| macOS | iTerm2, Warp | Better rendering, splits, profiles |
| Linux | Alacritty, Kitty | GPU-accelerated, configurable |
| Windows | Windows Terminal | WSL support, tabs, profiles |
Shell Configuration¶
Claude Code CLI works best with a well-configured shell:
# ~/.zshrc or ~/.bashrc
# Essential aliases for Claude Code CLI
alias cc="claude"
alias ccc="claude --continue"
alias ccp="claude -p"
alias ccw="claude --cwd"
# Quick project context
alias cc-init="claude 'Give me a quick overview of this project'"
alias cc-review="claude 'Review the recent changes in this branch'"
# Non-interactive helpers
cc-ask() {
claude -p "$*"
}
cc-explain() {
claude -p "Explain this file: $(cat $1)"
}
# Set up environment variables
export ANTHROPIC_API_KEY="your-key-here" # Or use Claude Pro auth
# Ensure Claude Code CLI is in PATH
export PATH="$PATH:$(npm config get prefix)/bin"
Terminal Multiplexer Setup¶
Use tmux or screen for persistent Claude sessions:
# ~/.tmux.conf
# Create a Claude Code development layout
bind C-c new-window -n 'claude' 'claude'
bind C-s split-window -h 'claude'
# Session persistence
set -g @plugin 'tmux-plugins/tmux-resurrect'
Development Layout:
┌─────────────────────────────────────┬──────────────────────┐
│ │ │
│ Claude Code CLI │ Code Editor │
│ (main interaction) │ (vim/nvim) │
│ │ │
├─────────────────────────────────────┼──────────────────────┤
│ │ │
│ Test Runner │ Git / Logs │
│ (watch mode) │ │
│ │ │
└─────────────────────────────────────┴──────────────────────┘
Essential Developer Tools¶
Core Tools Claude Code CLI Integrates With¶
| Tool | Purpose | CLI Integration |
|---|---|---|
| Git | Version control | Full commit/branch/PR support |
| Node.js/npm | JS runtime & packages | Package management, scripts |
| Python/pip | Python runtime | Virtual envs, dependencies |
| Docker | Containerization | Build, run, compose |
| Make | Build automation | Task running |
| jq | JSON processing | Data transformation |
| ripgrep (rg) | Fast search | Code exploration |
| fzf | Fuzzy finder | File selection |
| gh | GitHub CLI | Issues, PRs, releases |
Tool Installation Script¶
#!/bin/bash
# install-dev-tools.sh - Essential tools for Claude Code CLI development
# Detect OS
if [[ "$OSTYPE" == "darwin"* ]]; then
PKG_MANAGER="brew install"
elif [[ -f /etc/debian_version ]]; then
PKG_MANAGER="sudo apt-get install -y"
elif [[ -f /etc/redhat-release ]]; then
PKG_MANAGER="sudo dnf install -y"
fi
# Core tools
$PKG_MANAGER git
$PKG_MANAGER jq
$PKG_MANAGER ripgrep
$PKG_MANAGER fzf
$PKG_MANAGER gh
# Node.js (via nvm for version management)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.nvm/nvm.sh
nvm install --lts
# Claude Code CLI
npm install -g @anthropic-ai/claude-code
# Verify installation
claude --version
echo "Development environment ready!"
Project Configuration¶
Essential Project Files¶
Every project should have these files for optimal Claude Code CLI experience:
project/
├── .claude/
│ ├── settings.json # Project-specific Claude settings
│ └── commands/ # Custom slash commands
├── CLAUDE.md # Project context for Claude
├── .env.example # Environment template (never .env!)
├── .gitignore # Include .env, node_modules, etc.
├── Makefile # Common tasks
└── README.md # Human documentation
CLAUDE.md Best Practices¶
Create a comprehensive CLAUDE.md:
# CLAUDE.md
This file provides guidance to Claude Code CLI when working with this repository.
## Project Overview
[One paragraph describing what this project does]
## Tech Stack
- Runtime: Node.js 20
- Framework: Express.js
- Database: PostgreSQL
- ORM: Prisma
- Testing: Jest
## Quick Commands
```bash
npm run dev # Start development server
npm test # Run all tests
npm run lint # Lint and format
npm run build # Production build
npm run db:push # Push schema changes
Architecture¶
/src/routes- API route handlers/src/services- Business logic/src/models- Data models/src/utils- Shared utilities
Key Patterns¶
- All async functions use try/catch with custom errors
- API responses use { data, error, meta } format
- Database queries go through repository layer
Development Notes¶
- Run
npm run db:seedbefore first test run - Tests require local PostgreSQL on port 5432
- Use feature branches, squash merge to main
### Project Settings (.claude/settings.json) ```json { "model": "claude-sonnet-4-20250514", "permissions": { "allowedTools": ["Read", "Edit", "Write", "Glob", "Grep", "Bash"], "deniedPaths": [ "**/.env", "**/.env.*", "**/secrets/**", "**/*.pem", "**/*.key" ] }, "hooks": { "post-tool-use": [ { "matcher": "Edit:*.ts", "command": "npm run lint:fix --silent" }, { "matcher": "Edit:*.tsx", "command": "npm run lint:fix --silent" } ] } }
Makefile for Common Tasks¶
# Makefile - Common development tasks
.PHONY: dev test lint build clean claude
# Development
dev:
npm run dev
# Testing
test:
npm test
test-watch:
npm test -- --watch
test-coverage:
npm test -- --coverage
# Code quality
lint:
npm run lint
lint-fix:
npm run lint -- --fix
format:
npm run format
# Build
build:
npm run build
clean:
rm -rf dist node_modules/.cache
# Database
db-push:
npm run db:push
db-seed:
npm run db:seed
db-reset:
npm run db:reset
# Claude Code CLI helpers
claude:
claude
claude-review:
claude "Review the changes in this branch for bugs and issues"
claude-test:
claude "Run the tests and help me fix any failures"
claude-docs:
claude "Update documentation based on recent code changes"
IDE Integration¶
VS Code + Claude Code CLI¶
Use VS Code's integrated terminal with Claude Code CLI:
// .vscode/settings.json
{
"terminal.integrated.defaultProfile.osx": "zsh",
"terminal.integrated.profiles.osx": {
"claude": {
"path": "zsh",
"args": ["-c", "claude"]
}
},
// Keyboard shortcut to open Claude
"terminal.integrated.tabs.enabled": true
}
// .vscode/keybindings.json
[
{
"key": "cmd+shift+c",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "claude\n" }
}
]
Neovim Integration¶
-- ~/.config/nvim/lua/claude.lua
-- Open Claude Code CLI in a split terminal
vim.keymap.set('n', '<leader>cc', function()
vim.cmd('vsplit | terminal claude')
end, { desc = 'Open Claude Code CLI' })
-- Send current file to Claude for review
vim.keymap.set('n', '<leader>cr', function()
local file = vim.fn.expand('%')
vim.cmd('vsplit | terminal claude "Review this file: ' .. file .. '"')
end, { desc = 'Review current file with Claude' })
-- Send selection to Claude
vim.keymap.set('v', '<leader>ce', function()
-- Get visual selection
vim.cmd('normal! "vy')
local selection = vim.fn.getreg('v')
vim.cmd('vsplit | terminal claude "Explain this code: ' .. selection .. '"')
end, { desc = 'Explain selection with Claude' })
Environment Management¶
Using direnv for Project Environments¶
# Install direnv
brew install direnv # macOS
# Add to shell: eval "$(direnv hook zsh)"
# .envrc in project root
export NODE_ENV=development
export DATABASE_URL="postgresql://localhost/myapp_dev"
export CLAUDE_PROJECT_CONTEXT="web-app"
# Auto-load when entering directory
direnv allow
Docker Development Environment¶
# Dockerfile.dev - Development container with Claude Code CLI
FROM node:20-slim
# Install development tools
RUN apt-get update && apt-get install -y \
git \
curl \
jq \
ripgrep \
&& rm -rf /var/lib/apt/lists/*
# Install Claude Code CLI
RUN npm install -g @anthropic-ai/claude-code
# Set working directory
WORKDIR /app
# Mount point for project
VOLUME ["/app"]
# Default to Claude Code CLI
CMD ["claude"]
# docker-compose.yml
version: '3.8'
services:
dev:
build:
context: .
dockerfile: Dockerfile.dev
volumes:
- .:/app
- ~/.claude:/root/.claude # Share Claude config
environment:
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
stdin_open: true
tty: true
Python Virtual Environments¶
# Create project with Claude Code CLI awareness
mkdir my-python-project && cd my-python-project
# Set up virtual environment
python -m venv venv
source venv/bin/activate
# Create CLAUDE.md with Python context
cat > CLAUDE.md << 'EOF'
# CLAUDE.md
## Python Project
### Setup
```bash
python -m venv venv
source venv/bin/activate # or `venv\Scripts\activate` on Windows
pip install -r requirements.txt
Commands¶
pytest- Run testspytest --cov- Run with coverageblack .- Format codemypy .- Type checkingruff check .- Linting
Structure¶
/src- Main source code/tests- Test files (mirror src structure)/scripts- Utility scripts EOF
Now Claude Code CLI understands your Python project¶
claude
## Git Workflow Integration
### Git Hooks with Claude Code CLI
```bash
#!/bin/bash
# .git/hooks/pre-commit
# Run Claude Code CLI to check for issues (non-interactive)
ISSUES=$(claude -p "Check staged changes for obvious bugs, security issues, or forgotten debug code. Reply with PASS if ok, or list issues." 2>&1)
if [[ "$ISSUES" != *"PASS"* ]]; then
echo "Claude Code CLI found potential issues:"
echo "$ISSUES"
echo ""
read -p "Commit anyway? (y/n) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
fi
Branch Naming with Claude¶
# Helper function to create branches with good names
cc-branch() {
DESCRIPTION="$*"
BRANCH_NAME=$(claude -p "Suggest a git branch name for: $DESCRIPTION. Reply with only the branch name, using format: type/short-description (e.g., feat/user-auth, fix/login-bug)")
echo "Suggested branch: $BRANCH_NAME"
read -p "Create this branch? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
git checkout -b "$BRANCH_NAME"
fi
}
Try It Yourself¶
Exercise: Set Up a Complete Development Environment¶
-
Configure your shell:
-
Create a test project:
-
Set up project structure:
-
Create CLAUDE.md:
-
Configure hooks:
-
Verify everything works:
What's Next?¶
Learn about integrating Claude Code CLI with your developer toolchain in 06-toolchain-integration.
Summary: - Optimize your terminal with aliases, tmux, and proper shell config - Essential tools: git, jq, ripgrep, fzf, gh, language runtimes - Every project needs: CLAUDE.md, .claude/settings.json, Makefile - IDE integration keeps Claude CLI accessible while coding - Use direnv or Docker for consistent environments - Git hooks can leverage Claude CLI for pre-commit checks
Learning Resources¶
Featured Video¶
NetworkChuck: AI in the Terminal - Setup (3.6M subscribers)
Complete development environment setup - terminal optimization, tools, and IDE integration.
Additional Resources¶
| Type | Resource | Description |
|---|---|---|
| 🎬 Video | Claude Code Environment Setup | All About AI - Dev environment |
| 📚 Official Docs | Getting Started | Official setup guide |
| 📖 Tutorial | AI Terminal Guide | Complete environment setup |
| 🎓 Free Course | Anthropic Academy | Free setup courses |
| 💼 Commercial | AI Dev Course | Environment configuration |