As a DevOps engineer I spend most of my day in the terminal. When Anthropic released Claude Code their official CLI for Claude I was immediately interested. Unlike browser-based AI tools, Claude Code runs directly in your shell and has full access to your project files, git history, and command output. It understands your codebase, not just isolated snippets you paste into a chat window.

In this article I cover how to install Claude Code on macOS (my daily driver) and on a Windows VM, explain the most useful commands, and share a set of practical tips that make a real difference in day-to-day use.


What is Claude Code?

Claude Code is the official command-line interface built by Anthropic for their Claude AI models. It is designed specifically for software engineering tasks and runs as an interactive agent inside your terminal. Key capabilities include:

  • Full filesystem access reads, edits, and creates files within your project
  • Shell command execution runs tests, linters, builds, and git operations on your behalf
  • Codebase awareness understands project structure, not just isolated files
  • Agentic mode can plan and execute multi-step tasks autonomously
  • MCP support extensible via Model Context Protocol servers

Claude Code is not a plugin or extension  it is a standalone CLI tool. On macOS it is distributed as a Homebrew cask, on Windows via Chocolatey or npm.


Prerequisites

macOS

Windows VM


Installing Claude Code on macOS

Step 1 Install Homebrew (skip if already installed)

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Step 2 Install Claude Code

Anthropic distributes Claude Code as an official Homebrew cask. This is the easiest approach no separate Node.js installation required:

brew install --cask claude-code

Alternatively, if you prefer npm or already have Node.js 18+ installed:

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

Verify the installation:

claude --version

Step 3 Configure your API key

Get your API key from console.anthropic.com under API Keys. Add it permanently to your shell profile:

# Add to ~/.zshrc
echo 'export ANTHROPIC_API_KEY="sk-ant-your-key-here"' >> ~/.zshrc
source ~/.zshrc

Step 4 First launch

Navigate to a project directory and start Claude Code:

cd ~/your-project
claude

On first run, Claude Code will ask you to accept the terms of service and optionally configure a few preferences. After that you land in the interactive shell.


Installing Claude Code on a Windows VM

Step 1 Install Node.js (skip if using Chocolatey)

Download the LTS installer from https://nodejs.org and run it. Accept the defaults, including the option to install necessary tools. After installation, verify in PowerShell:

node --version
npm --version

Step 2 Install Claude Code

If you have Chocolatey installed, this is the quickest option. Open PowerShell as administrator and run:

choco install claude-code

Don’t have Chocolatey? Install it first from https://chocolatey.org/install, or use npm instead. Open PowerShell 7 as your regular user and run:

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

If npm global installs are not on your PATH, add the npm global bin directory:

# Find the global bin directory
npm config get prefix

# Add to your PowerShell profile
notepad $PROFILE

Add the following line and save:

$env:PATH += ";C:\Users\YourUser\AppData\Roaming\npm"

Step 3 Configure your API key

Set the API key as a permanent user environment variable via PowerShell:

[System.Environment]::SetEnvironmentVariable(
    "ANTHROPIC_API_KEY",
    "sk-ant-your-key-here",
    "User"
)

Restart your PowerShell session and verify:

echo $env:ANTHROPIC_API_KEY

Step 4 First launch

cd C:\your-project
claude

Claude Code runs natively on Windows. There is no WSL requirement, though WSL2 works equally well if you prefer a Linux environment.


How to Use Claude Code Effectively

Basic workflow

Once inside the Claude Code shell, you interact with it through natural language. Claude Code will read files, propose changes, and ask for permission before executing commands. A typical session looks like this:

> explain the structure of this project
> fix the failing unit tests in src/auth/
> add input validation to the login endpoint
> create a git commit with a descriptive message

Claude Code shows you exactly what it plans to do before acting and asks for approval on destructive or impactful operations.

Slash commands

Inside the Claude Code shell, several built-in slash commands are available:

CommandDescription
/helpShow all available commands and shortcuts
/clearClear the conversation context
/compactCompress conversation to save context tokens
/memoryView and edit persistent memory (CLAUDE.md)
/modelSwitch between Claude models (Sonnet, Opus, Haiku)
/costShow token usage and estimated API cost for the session
/reviewTrigger a code review on recent changes
/commitCreate a git commit with an AI-generated message

CLAUDE.md project-level context

One of the most powerful features is the CLAUDE.md file. When Claude Code starts, it automatically reads any CLAUDE.md file in the project root (and parent directories). Use this file to give Claude persistent context about your project:

# CLAUDE.md

## Project
This is a Python FastAPI service deployed on AWS ECS.

## Tech stack
- Python 3.12, FastAPI, SQLAlchemy
- PostgreSQL (RDS), Redis (ElastiCache)
- Terraform for infrastructure, GitHub Actions for CI/CD

## Conventions
- Use snake_case for all variables and functions
- All database queries must go through the repository layer
- Never commit secrets — use AWS Secrets Manager references

## Testing
Run tests with: pytest tests/ -v
Integration tests require a local Docker Compose stack: docker compose up -d

Claude Code reads this on every session start, so you never have to repeat project context.


Tips & Best Practices

1. Use permission modes to control autonomy

By default Claude Code asks for confirmation before running commands. You can adjust this with the --dangerously-skip-permissions flag for fully automated runs (CI pipelines), or use --allowedTools to whitelist specific tools:

# Allow only file reads and writes, no shell commands
claude --allowedTools Read,Write,Edit

2. Pass a task directly from the command line

You do not need to open the interactive shell for simple tasks. Use -p to pass a prompt directly and get a non-interactive result:

claude -p "Review the Dockerfile in this project and suggest security improvements"

This is useful for integrating Claude Code into scripts or CI pipelines.

3. Use /compact regularly on long sessions

Claude Code has a context window limit. On long sessions with many file reads and edits, use /compact to summarize and compress the conversation. This frees up context space without losing the important history of what was done.

4. Be specific about scope

Vague instructions produce vague results. The more specific your request, the better the output:

# Too vague
> fix the authentication

# Much better
> The JWT token validation in src/middleware/auth.py is not checking the expiry claim.
  Fix it and add a unit test that verifies expired tokens are rejected.

5. Ask Claude to explain before it acts

For unfamiliar codebases or risky operations, ask Claude Code to explain its plan before executing:

> Explain what changes you would make to migrate from SQLAlchemy 1.4 to 2.0 in this project,
  but don't make any changes yet.

Review the plan, ask follow-up questions, and only then confirm to proceed.

6. Extend with MCP servers

Model Context Protocol (MCP) servers let you connect Claude Code to external data sources and tools databases, internal APIs, documentation systems, cloud provider CLIs. Configure them in ~/.claude/settings.json under mcpServers. This is particularly useful in DevOps contexts where you want Claude to query your infrastructure directly.


Conclusion

Claude Code fills a gap that browser-based AI tools cannot: it works where you actually work, inside your project, with full context. The installation is straightforward on both macOS and Windows a single Homebrew cask or Chocolatey install and an API key is all it takes to get started.

The real value comes from using it consistently. Set up your CLAUDE.md file on every project, be specific in your requests, and use the permission controls to match the level of autonomy you are comfortable with. Once that habit is in place, Claude Code becomes a genuine force multiplier for daily engineering work.

In a follow-up article I will cover how to extend Claude Code with custom MCP servers and how to integrate it into a CI/CD pipeline using the non-interactive mod