CLSkills
March 20, 2025Claude Skills Hub

Setting Up Claude Code from Scratch: A Developer's Guide

A complete walkthrough for installing and configuring Claude Code for the first time. Covers installation, API setup, CLAUDE.md configuration, adding skills, and pro tips for maximum productivity.

claude-codesetupinstallationgetting-startedtutorialconfiguration

Getting Started with Claude Code

Claude Code is Anthropic's official command-line interface for interacting with Claude directly in your terminal. It's designed specifically for developers who want Claude integrated into their coding workflow rather than switching between a browser chat and their editor. This guide walks you through setting everything up from zero to a fully configured, skill-enhanced development environment.

Prerequisites

Before installing Claude Code, make sure you have:

  • Node.js 18+ installed (check with node --version)
  • npm or another package manager (comes with Node.js)
  • An Anthropic API key or a Claude Pro/Team subscription
  • A terminal you're comfortable working in (Terminal, iTerm2, Windows Terminal, etc.)
  • Git installed (recommended but not strictly required)

Step 1: Install Claude Code

Install Claude Code globally using npm:

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

Verify the installation:

claude --version

You should see the version number printed. If you get a "command not found" error, ensure your npm global bin directory is in your PATH.

Alternative Installation Methods

If you prefer not to install globally:

# Using npx (runs without installing)
npx @anthropic-ai/claude-code

# Using yarn
yarn global add @anthropic-ai/claude-code

# Using pnpm
pnpm add -g @anthropic-ai/claude-code

Step 2: Authentication

Claude Code needs to authenticate with Anthropic's API. There are two options:

Option A: API Key

Set your Anthropic API key as an environment variable:

# Add to your shell profile (~/.bashrc, ~/.zshrc, etc.)
export ANTHROPIC_API_KEY="sk-ant-your-key-here"

Reload your shell:

source ~/.bashrc  # or ~/.zshrc

Option B: Interactive Login

Run Claude Code and follow the interactive login prompts:

claude

It will guide you through authenticating with your Anthropic account.

Step 3: Your First Session

Navigate to a project directory and start Claude Code:

cd ~/projects/my-app
claude

You're now in an interactive session where you can talk to Claude about your code. Try these starter commands:

Explain the structure of this project
What does the main entry point do?
Find any potential bugs in src/utils/

Claude can read your files, understand your project structure, and provide context-aware assistance.

Step 4: Create Your CLAUDE.md File

The CLAUDE.md file is one of the most impactful things you can set up. It's a markdown file at the root of your project that tells Claude about your project's architecture, conventions, and preferences.

Why CLAUDE.md Matters

Without a CLAUDE.md, Claude starts every session with zero context about your project. With one, Claude immediately understands your tech stack, coding conventions, and architectural decisions.

Creating a Basic CLAUDE.md

Create CLAUDE.md in your project root:

# Project: My Application

## Tech Stack
- Runtime: Node.js 20 with TypeScript
- Framework: Next.js 14 (App Router)
- Database: PostgreSQL with Prisma ORM
- Styling: Tailwind CSS
- Testing: Vitest + React Testing Library
- Package Manager: pnpm

## Architecture
- `src/app/` - Next.js App Router pages and layouts
- `src/components/` - Reusable React components
- `src/lib/` - Utility functions and shared logic
- `src/server/` - Server-side code (API routes, database queries)
- `prisma/` - Database schema and migrations

## Coding Conventions
- Use functional components with TypeScript
- Prefer named exports over default exports
- Use `async/await` over `.then()` chains
- Error handling: always use typed errors with proper messages
- File naming: kebab-case for files, PascalCase for components

## Commands
- `pnpm dev` - Start development server
- `pnpm build` - Production build
- `pnpm test` - Run tests
- `pnpm lint` - Run ESLint
- `pnpm db:migrate` - Run database migrations
- `pnpm db:seed` - Seed the database

## Important Notes
- Always run `pnpm lint` before committing
- Database migrations must be reversible
- All new components need unit tests
- Use server components by default, client components only when needed

Advanced CLAUDE.md Sections

As your project grows, add sections for:

  • Authentication flow - How auth works in your app
  • API conventions - Request/response formats, error codes
  • Environment variables - What each env var does
  • Deployment - How the app is deployed and where
  • Known issues - Bugs or limitations Claude should know about

Step 5: Set Up Skills

Skills supercharge Claude Code by giving it specialized knowledge for common tasks.

Create the Skills Directory

mkdir -p ~/.claude/skills

Install Essential Skills

Visit Claude Skills Hub and install skills that match your workflow. Here are the ones we recommend starting with:

  1. smart-commit - Better commit messages instantly
  2. unit-test-generator - Generate tests for your code
  3. claude-md-writer - Help writing and improving CLAUDE.md files

Using Skills in Your Session

Once installed, reference skills naturally:

Use the smart-commit skill to commit my changes
Use the unit-test-generator skill to test src/lib/auth.ts

Step 6: Configure Your Shell for Productivity

Set up aliases and shortcuts to make working with Claude Code faster:

# Add to ~/.bashrc or ~/.zshrc

# Quick start
alias cc="claude"

# Start with a specific prompt
alias ccr="claude 'Review the recent changes and suggest improvements'"
alias cct="claude 'Run the tests and fix any failures'"

Step 7: Integrate with Your Editor

Claude Code works alongside any editor. A common workflow is:

  1. Write code in your editor (VS Code, Neovim, etc.)
  2. Switch to the terminal to ask Claude for help
  3. Claude reads and modifies files directly
  4. Changes appear instantly in your editor

VS Code Tips

  • Use the integrated terminal to run Claude Code
  • Split your terminal so Claude is always visible
  • Use VS Code's auto-save so Claude always sees your latest changes

Neovim Tips

  • Use a terminal split (:terminal) to run Claude alongside your code
  • Consider tmux for persistent Claude sessions

Pro Tips for Maximum Productivity

1. Be Specific with Requests

Instead of:

Fix the bug

Say:

The login form in src/components/LoginForm.tsx throws a TypeError 
when the email field is empty. Fix the validation logic.

2. Use Claude for Code Reviews

Before pushing a PR:

Review my changes since the last commit. Focus on bugs, 
performance issues, and TypeScript type safety.

3. Let Claude Read Before Writing

When asking Claude to modify code, let it understand the context first:

Read src/server/api/users.ts and then add a new endpoint 
for updating user preferences.

4. Chain Tasks Together

Claude maintains context throughout a session:

1. Create a new API endpoint for /api/settings
2. Add input validation using zod
3. Write unit tests for the new endpoint
4. Update the API documentation

5. Use CLAUDE.md as Living Documentation

Update your CLAUDE.md whenever you make architectural decisions. It benefits both Claude and your human team members.

6. Leverage Git Context

Claude understands git:

What changed since yesterday? Summarize the recent commits.
There's a regression somewhere in the last 5 commits. 
Help me find it.

Common Configuration Issues

API Key Not Recognized

If Claude says it can't authenticate:

  1. Verify your key is set: echo $ANTHROPIC_API_KEY
  2. Make sure there are no extra spaces or quotes
  3. Check that you've reloaded your shell after setting the variable

Claude Can't Find Files

Make sure you're running Claude from your project's root directory. Claude's file access is relative to where you start the session.

Slow Responses

For large projects, Claude may take longer to analyze files. You can help by:

  • Being specific about which files to look at
  • Adding a good CLAUDE.md so Claude doesn't need to explore as much
  • Using .claudeignore to exclude irrelevant directories (node_modules, dist, etc.)

What's Next?

Now that you're set up, explore these resources:

Claude Code gets more powerful the more you use it. Your CLAUDE.md improves over time, your skill collection grows, and you develop an intuition for how to get the best results. Welcome to a more productive way of coding.

Stay Updated

Get notified when we publish new guides and add new skills.