Table of Contents
What is Claude Code?
Claude Code is Anthropic's agentic coding tool — a terminal-first AI assistant that doesn't just autocomplete lines, it executes tasks. It reads your codebase, runs shell commands, edits files, runs tests, and iterates until the work is done.
Unlike tab-completion tools like GitHub Copilot, Claude Code operates as an agent. You describe what you want in plain English. It figures out the steps, executes them, and reports back. Think less "smart autocomplete" and more "junior developer who runs in your terminal."
In 2026, Claude Code has become the default choice for teams who want AI that actually does the work rather than suggesting it. This guide covers everything you need to go from zero to fully operational.
Installation & First Run
Prerequisites
- Node.js 18+ (Claude Code runs as an npm package)
- Anthropic account with Claude Code access enabled
- A project directory with code in it (or an empty one to start fresh)
Install
npm install -g @anthropic-ai/claude-code
First run
cd your-project
claude
On first run, Claude Code will authenticate via your Anthropic account and create a basic CLAUDE.md in your project root if one doesn't exist.
claude --help to see all CLI flags. The most useful ones are --print (non-interactive output) and --model (switch between claude-opus-4-5, claude-sonnet-4-5, etc.).
CLAUDE.md: The Configuration File That Changes Everything
CLAUDE.md is a plain-text file in your project root (or home directory) that Claude Code reads before every session. It's your standing instructions — the context Claude keeps in mind throughout the conversation.
Most people skip it. That's a mistake. A well-written CLAUDE.md can cut token usage by 30%, eliminate repeated corrections, and make every session noticeably more productive.
What to put in CLAUDE.md
The most effective CLAUDE.md files have four sections:
# Project Overview
[2-3 sentences on what this project is and does]
# Architecture
[Key files, directories, and how they connect]
# Conventions
[Naming, formatting, patterns you want maintained]
# Commands
[How to run tests, builds, lints — commands Claude should use]
A real CLAUDE.md example (Node.js API)
# TaskFlow API
REST API for task management. Node.js, Express, PostgreSQL.
Production runs on Railway. Do not touch `.env.production`.
## Architecture
- `src/routes/` — Express routers by resource
- `src/models/` — Sequelize models
- `src/services/` — Business logic (keep fat models, thin routes)
- `src/middleware/` — Auth, validation, rate limiting
## Conventions
- ES modules only (no CommonJS require)
- Use `async/await`, never raw `.then()` chains
- Tests in `__tests__/` mirroring `src/` structure
- All DB queries go through service layer — no raw SQL in routes
## Commands
- Run tests: `npm test`
- Start dev: `npm run dev`
- Lint: `npm run lint`
- Migrate: `npx sequelize-cli db:migrate`
Global CLAUDE.md vs project CLAUDE.md
Claude Code reads from two locations:
~/.claude/CLAUDE.md— Applied to every project./CLAUDE.md— Applied to this project only
Use global CLAUDE.md for preferences that should always apply (your preferred code style, tools you use, how you like responses formatted). Use project CLAUDE.md for project-specific context.
Slash Commands Reference
Claude Code has a set of built-in slash commands for common operations. Here are the ones you'll actually use:
| Command | What it does |
|---|---|
/init | Creates a CLAUDE.md by scanning your project structure |
/compact | Summarizes the conversation to reduce context length |
/clear | Clears the conversation history entirely |
/status | Shows current token usage and session cost |
/doctor | Runs a health check on your Claude Code setup |
/permissions | Shows/edits what Claude Code is allowed to do (read/write/execute) |
/mcp | Lists connected MCP servers and their tools |
.claude/commands/. Each file becomes a slash command. Great for repetitive tasks like "generate a test file for this module" or "write a migration for this schema change."
Real-World Workflows
Workflow 1: Feature implementation
You: Implement user avatars. Users should be able to upload a profile photo (JPEG/PNG, max 5MB). Store in S3. Show it in the navbar and profile page. Use the existing auth middleware.
Claude Code: [reads codebase → writes S3 upload handler → updates user model → edits profile controller → updates navbar template → writes tests → runs them]
The key is specificity without micromanagement. Tell it what to build and what constraints exist. Don't tell it which files to edit — it figures that out.
Workflow 2: Debugging production issues
You: Users are reporting that file uploads fail intermittently in production but work fine locally. Here are three error logs: [paste logs]. Figure out what's happening.
Claude Code: [reads logs → checks S3 config → looks at timeout settings → identifies race condition in multipart upload handler → proposes fix → writes test to reproduce it]
Workflow 3: Codebase exploration
New to a large codebase? This is where Claude Code shines:
You: I've just joined this project. Walk me through how a user login request flows from the frontend through to the database and back.
Claude Code: [reads through auth files → maps the request flow → explains each layer → identifies the auth middleware chain → notes anything unusual]
Workflow 4: Writing tests for existing code
You: Write comprehensive unit tests for src/services/billing.js. Cover happy path, error cases, and edge cases around failed payments.
Claude Code: [reads billing.js → identifies all code paths → writes tests → runs them → fixes any that fail → reports coverage]
MCP Integrations
Model Context Protocol (MCP) lets Claude Code connect to external tools and data sources. In 2026, MCP has matured significantly — there are servers for nearly everything you'd want.
Setting up MCP servers
MCP servers are configured in ~/.claude/mcp-servers.json:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_..."
}
},
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"POSTGRES_CONNECTION_STRING": "postgresql://..."
}
},
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/projects"]
}
}
}
The MCP servers that actually matter in 2026
| Server | What it adds | Use when |
|---|---|---|
| GitHub MCP | Issues, PRs, code search | Working from tickets or doing PR reviews |
| PostgreSQL MCP | Live DB schema + query | Schema migrations, data model work |
| Filesystem MCP | Cross-directory access | Monorepos, shared libraries |
| Sentry MCP | Production errors | Debugging live issues |
| Linear MCP | Issues + projects | Working from sprint tickets |
| Slack MCP | Channel history | Context from discussions |
Sub-Agents & Parallel Execution
One of the most powerful features added in 2025–2026 is the ability to spawn sub-agents — separate Claude Code instances running in parallel on different parts of a task.
When to use sub-agents
- Tasks that can be parallelized (frontend + backend + tests)
- Large refactors across multiple modules
- Running the same operation across many files
- Long-running tasks where you want isolation
How to trigger parallel execution
Claude Code spawns sub-agents automatically when you give it a task it recognizes as parallelizable. You can also trigger it explicitly:
You: Implement dark mode. Work on these three things in parallel: (1) add CSS custom properties for all color tokens, (2) update all component files to use the new tokens, (3) add a theme toggle to the navbar.
Claude Code: [spawns 3 sub-agents → each works independently → coordinates merging changes]
Team Setup
Shared CLAUDE.md in version control
Check your project CLAUDE.md into git. Every team member gets the same context, and you can improve it over time via PR reviews like any other code.
Consistent permissions policy
Set file permissions via .claude/settings.json and commit it:
{
"allowedTools": ["Bash", "Read", "Write", "Edit"],
"denyPaths": [
".env.production",
"secrets/",
"infrastructure/"
]
}
Cost management for teams
Claude Code token costs add up fast with a team. Three levers:
- Model selection: Use
claude-sonnet-4-5for everyday work, reserveclaude-opus-4-5for complex reasoning tasks - Context discipline: Use
/compactregularly and keep CLAUDE.md lean - Task scoping: Smaller, focused sessions cost less than sprawling all-day conversations
7 Common Claude Code Mistakes
- No CLAUDE.md — Claude starts every session with zero project context. You repeat yourself every time.
- CLAUDE.md is too long — Over 500 lines and you're paying for context you don't need. Be ruthless about what stays.
- Vague requests — "Improve the auth code" is not a task. "Refactor auth.js to use middleware pattern, keeping the existing session store" is.
- Not checking what it's doing — Claude Code will tell you what it's about to do. Read it before saying yes. Especially for DB migrations and file deletions.
- Ignoring permissions — Not scoping
denyPathsmeans Claude could accidentally edit production config. - No version control discipline — Always commit before a Claude Code session. If it breaks something, you want a clean rollback point.
- Wrong model for the task — Opus for a simple rename refactor is expensive. Sonnet for a complex architecture decision might disappoint. Match the model to the task.
Claude Code Complete Bundle
Every template, prompt, and workflow from this guide — packaged and ready to use. Drop it into your project and ship.
- 10 ready-to-use CLAUDE.md templates by stack (Node, Python, React, Django, Go, and more)
- 50-prompt Claude Code library covering features, debugging, refactors, tests, and migrations
- Team playbook: onboarding guide, permissions policy, cost tracking setup
- MCP configuration templates for GitHub, PostgreSQL, Linear, Sentry
- Sub-agent orchestration patterns with example prompts
- Custom slash command library (12 pre-built commands)
Summary
Claude Code in 2026 is a genuine productivity multiplier — but only if you set it up properly. The difference between developers who get 2x output and those who get 20x often comes down to three things:
- A well-maintained CLAUDE.md that gives Claude real project context
- Task prompts that are specific about goals and constraints without micromanaging steps
- The right model for each type of work
Everything else — MCP, sub-agents, custom commands — builds on that foundation. Get the fundamentals right first.
Ask Patrick publishes guides on Claude Code, Microsoft Copilot, and AI workflows for teams. Back to homepage →