Claude Code Complete Guide 2026

Setup, CLAUDE.md, slash commands, MCP integrations, sub-agents, and team workflows — everything in one place.

By Ask Patrick  ·  June 16, 2026  ·  15 min read

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.

Who this guide is for: Developers, tech leads, and engineering teams who want to use Claude Code effectively — not just install it and poke at it.

Installation & First Run

Prerequisites

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.

Tip: Run 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`
Common mistake: Making CLAUDE.md too long. Claude reads the whole file on every request — keeping it under 500 lines prevents token bloat. Move detailed docs to separate files and reference them.

Global CLAUDE.md vs project CLAUDE.md

Claude Code reads from two locations:

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:

CommandWhat it does
/initCreates a CLAUDE.md by scanning your project structure
/compactSummarizes the conversation to reduce context length
/clearClears the conversation history entirely
/statusShows current token usage and session cost
/doctorRuns a health check on your Claude Code setup
/permissionsShows/edits what Claude Code is allowed to do (read/write/execute)
/mcpLists connected MCP servers and their tools
Custom slash commands: You can define your own in .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

ServerWhat it addsUse when
GitHub MCPIssues, PRs, code searchWorking from tickets or doing PR reviews
PostgreSQL MCPLive DB schema + querySchema migrations, data model work
Filesystem MCPCross-directory accessMonorepos, shared libraries
Sentry MCPProduction errorsDebugging live issues
Linear MCPIssues + projectsWorking from sprint tickets
Slack MCPChannel historyContext from discussions
Tip: Connect Claude Code to your issue tracker (Linear, GitHub Issues, Jira) and you can say "implement issue #247" and it will read the ticket, understand the context, and get to work.

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

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]
Warning: Sub-agents don't share file locks by default. If two agents edit the same file simultaneously, you get conflicts. Be explicit about which files each agent owns.

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:

  1. Model selection: Use claude-sonnet-4-5 for everyday work, reserve claude-opus-4-5 for complex reasoning tasks
  2. Context discipline: Use /compact regularly and keep CLAUDE.md lean
  3. Task scoping: Smaller, focused sessions cost less than sprawling all-day conversations

7 Common Claude Code Mistakes

  1. No CLAUDE.md — Claude starts every session with zero project context. You repeat yourself every time.
  2. CLAUDE.md is too long — Over 500 lines and you're paying for context you don't need. Be ruthless about what stays.
  3. Vague requests — "Improve the auth code" is not a task. "Refactor auth.js to use middleware pattern, keeping the existing session store" is.
  4. 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.
  5. Ignoring permissions — Not scoping denyPaths means Claude could accidentally edit production config.
  6. No version control discipline — Always commit before a Claude Code session. If it breaks something, you want a clean rollback point.
  7. 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)
$39
One-time · Instant download · Use on your whole team
Get the Bundle →

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:

  1. A well-maintained CLAUDE.md that gives Claude real project context
  2. Task prompts that are specific about goals and constraints without micromanaging steps
  3. 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 →