claudemd

Claude Code Setup Guide

Get up and running with Anthropic's command-line agent. A complete workflow guide from initial NPM installation to advanced MCP config.

1. Installing Claude Code

To install claude code, you need Node.js v22.12.0 or higher. Claude Code is distributed as a global npm package by Anthropic. Verify your Node version and install the CLI:

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

This claude code install command adds the claude binary globally, giving you access to Anthropic's terminal-native AI development assistant. The package works on macOS, Linux, and Windows via WSL.

2. First-time Authentication

Upon first launch, you need to authenticate with your Anthropic account. Run claude in your terminal — it will display a one-time code and open your browser.

claude
Terminal: authentication• Active connection
claudemd> initializing handshake...
Please open: https://console.anthropic.com/activate
Enter code: ABCD-EFGH

Success! Authenticated as [email protected]

After entering the code, credentials are stored locally in ~/.claude/. This is a one-time claude code first time setup process.

3. Configuring your first project

Navigate to your project directory and run claude. It will scan your project structure and read any existing configuration.

cd /path/to/my-web-project
claude

This claude code configuration step is where the CLI detects package.json, tsconfig, and other project files to build a directory outline.

4. Adding a CLAUDE.md File

Create CLAUDE.md in your project root with build commands and style rules:

# Build and Test Commands
- Build: `npm run build`
- Dev server: `npm run dev`
- Test: `npm run test`
- Lint: `npm run lint`

# Code Style Guidelines
- Use React functional components with TypeScript
- Keep components small and reusable
- Follow mobile-first design patterns

Following claude code setup instructions, this file is parsed automatically at session start.

5. Setting up skills

Claude code skills are custom executable scripts stored in .claude/skills/ (project) or ~/.claude/skills/ (global). Skills extend what Claude Code can run autonomously, including database migrations, code reviews, and deployment tasks.

  • Project-Scoped Skills: .claude/skills/ in your project directory.
  • Global Skills: ~/.claude/skills/ for use across all projects.

6. Model Context Protocol (MCP) Servers

Claude Code supports the Model Context Protocol (MCP) for connecting to external tools, databases, and APIs. Configure MCP servers in ~/.claude/config.json under the mcpServers schema.

7. Recommended settings.json

Optimize your claude code configuration with production settings in ~/.claude/settings.json:

{
  "theme": "dark",
  "editor": "code --wait",
  "autoApprove": {
    "readFiles": true,
    "listFiles": true,
    "globSearch": true
  },
  "maxTokens": 4000,
  "telemetry": false
}

8. Global vs Project Config

The claude code setup resolution order is:

  1. ~/.claude/settings.json — global environment preferences.
  2. ~/.claude/CLAUDE.md — global system rules.
  3. ./CLAUDE.md — project-specific rules (overrides global).
  4. .claude/ — local project-scoped memory blocks.

9. Troubleshooting & FAQs

Error: Permission denied on shell commands

Ensure you are running Claude Code inside a user directory. Configure sudo privileges or whitelist folders in settings.json.

How can I clear local memory?

Remove the hidden cache directory: rm -rf .claude/ in your workspace root.

Claude Code gets stuck in a command loop

Cancel with Ctrl + C and verify your CLAUDE.md scripts match active package parameters.