Skip to content

SOP-004: Installing Claude Code

Fresh

Source: Claude Code in Action

Document Control

FieldValue
SOP IDSOP-004
Version1.0
StatusActive
Last Updated2024-12

Overview

Install and configure Claude Code, a command-line AI assistant for development tasks.

Prerequisites

  • Node.js 18+ installed
  • Terminal/Command prompt access
  • Anthropic API key

Installation Process

Step 1: Install via npm

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

Or use npx (no install):

bash
npx @anthropic-ai/claude-code

Step 2: Configure API Key

bash
# Set environment variable
export ANTHROPIC_API_KEY="sk-ant-api03-..."

# Or configure interactively
claude config set api_key sk-ant-api03-...

Step 3: Initialize in Project

bash
cd /path/to/your/project

# Initialize Claude Code
claude /init

This creates a CLAUDE.md file with project context.

Claude Code Architecture

Essential Commands

CommandDescription
/initInitialize project context
/clearClear conversation
/helpShow available commands
/compactReduce context size
@file.tsReference specific file
EscapeCancel current operation

CLAUDE.md File Structure

markdown
# Project: My App

## Overview
Brief description of the project.

## Tech Stack
- Framework: Next.js
- Language: TypeScript
- Database: PostgreSQL

## Key Patterns
- Use functional components
- Follow existing naming conventions

## Important Files
- src/lib/db.ts - Database connection
- src/app/api - API routes

Verification Checklist

  • [ ] Claude Code installed globally
  • [ ] API key configured
  • [ ] Project initialized with CLAUDE.md
  • [ ] Can run basic commands
  • [ ] File references working (@file)

Troubleshooting

IssueSolution
Command not foundReinstall or use npx
API key invalidCheck key format
Permission deniedCheck file permissions
Context too largeUse /compact

See Also

Based on Anthropic Academy courses