Learning CenterClaude Code MasteryInstallation & First-Time Setup
Beginner7 min read

Installation & First-Time Setup

Install Claude Code, authenticate with your Anthropic account, and configure your environment for maximum productivity.

Installing Claude Code

Claude Code is a Node.js CLI distributed via npm. Install it globally so it's available in any directory:

npm install -g @anthropic-ai/claude-code

Verify the installation:

claude --version

Authentication

Claude Code uses OAuth against your Anthropic account. On first launch, it opens a browser window for you to sign in. Your session token is stored locally — you won't need to re-authenticate every session.

If you're on a headless server or CI environment, use an API key instead:

export ANTHROPIC_API_KEY=sk-ant-...
claude

Creating Your Global CLAUDE.md

Claude Code reads a CLAUDE.md file in your project directory as persistent instructions. Create a global one at ~/.claude/CLAUDE.md that applies everywhere:

# My Global Preferences
- TypeScript strict mode always
- Prefer functional patterns
- Always run tests before marking done
- Never commit without explaining why

Project-level CLAUDE.md files override the global one.

Shell Configuration

Add these aliases to your ~/.zshrc or ~/.bashrc for a smoother experience:

alias cc="claude"
alias ccp="claude --print"  # Print-only mode (no interactive)

Key Startup Flags

| Flag | Purpose | |------|---------| | --no-update | Pin the version (useful for CI) | | --print | Non-interactive mode, output to stdout | | --dangerously-skip-permissions | Auto-approve tools (use only in trusted automation) | | --model claude-opus-4-5 | Override the default model |

First Session Tips

Start by asking Claude to explain the codebase structure before asking for edits. This gives Claude the context it needs to make accurate changes. The /status command shows what files Claude has read, what tools are enabled, and the current session cost.

Loading…