What is Claude Code?
Same AI model — three completely different environments. The model is identical. The environment changes everything about what's possible.
📺 Learn By Watching
These two videos are the complete deep-dives this guide is built from.
Why Claude Code Changes Everything
The Mindset Shift
Most people use Claude Code like a smarter autocomplete. The real shift is from prompting to delegating.
| Old Mindset | New Mindset |
|---|---|
| "Write me this function" | "Build this feature end-to-end, with tests" |
| One prompt → one response | One outcome → Claude plans multi-step execution |
| I review every change manually | Hooks and agents enforce quality automatically |
| I run the same tasks every morning | Cloud Routines run them before I wake up |
| Skills are prompts I retype | Skills are reusable processes I define once |
| Claude Code is a tool I use | Claude Code is a system that works for me |
Pricing & Plans
Claude Code is available on every plan. What changes is daily limits, model access, and automation capabilities.
- Basic Claude access
- Limited daily messages
- No sub-agents
- No Cloud Routines
- 5× more usage vs Free
- Sonnet 4.6 + Haiku 4.5
- Skills & Agents
- 5 Cloud Routines/day
- Desktop Tasks (Mac/Win)
- 5× Pro usage
- Opus 4.8 access
- Agent Teams
- 15 Cloud Routines/day
- Priority access
- All models
- No rate limits
- Full programmatic
- Best for power users
Model Quick Reference
| Model | Best For | Speed | Cost |
|---|---|---|---|
| Haiku 4.5 | Sub-agents, routine tasks, logging | ⚡⚡⚡ | $ |
| Sonnet 4.6 | Daily coding, features, code reviews | ⚡⚡ | $$ |
| Opus 4.8 | Architecture, complex reasoning, Agent Teams | ⚡ | $$$ |
Setup Guide
From zero to first working session — install, configure, and give Claude Code your project's context.
npm install -g @anthropic-ai/claude-code # Windows: if claude doesn't work, add npm global to PATH npm config get prefix # shows the path to add
claude # Opens auth in your browser # Or use API key directly: export ANTHROPIC_API_KEY=your-key-here
cd my-project && claude
CLAUDE.md is your project's brain. It loads automatically every session — giving Claude Code your project context, coding standards, and rules without re-explaining each time.
# My Project — Claude Code Context ## What This Is Django REST API for a task management SaaS. Backend: Django 4.2, PostgreSQL, Redis, Celery. ## Coding Standards - Python: PEP 8, Black formatter, type hints required - Never use bare `except:` — always catch specific exceptions - All endpoints must have docstrings and tests - Use `os.environ.get()` — never hardcode secrets ## Common Commands - Start dev: `python manage.py runserver` - Run tests: `pytest --cov=. --tb=short`
.claude/ ├── CLAUDE.md ← Project brain (auto-loads every session) ├── settings.json ← Permissions, hooks, env vars ├── settings.local.json ← Personal overrides (git-ignored) ├── skills/ ← Custom automation playbooks │ └── generate-report/ │ ├── SKILL.md │ └── scripts/scan.py ├── agents/ ← Specialist sub-agents │ └── code-reviewer.md ├── hooks/ ← Event-triggered local scripts │ ├── auto_format.py │ └── security_guard.py ├── logs/ ← Session activity logs └── agent-memory/ ← Persistent agent knowledge └── code-reviewer/MEMORY.md
Context Management
The context window is Claude Code's working memory. Manage it well and performance stays sharp. Ignore it and quality degrades — silently.
Context Rot Warning Signs
Key Commands
Skills System
Document a process once. Claude executes it on demand, forever. Skills are the most economically valuable feature in Claude Code.
--- name: generate-report description: > Generates a daily project status report. Use when asked to summarise the codebase, create a status update, or generate a report. Reads Python files in /src and writes to /reports/. trigger: /generate-report effort: low # low | normal | high | max --- # Goal Generate a status report for: $ARGUMENTS[1] (default: src/) # Steps ## Step 1: Scan Run scripts/scan_codebase.py $ARGUMENTS[1] ## Step 2: Summarise Compile per-file info: purpose, function count, TODOs ## Step 3: Write report Create /reports/YYYY-MM-DD-status.md with all findings ## Step 4: Confirm Print: files scanned, TODOs found, report path
| Skill | Sub-Agent | |
|---|---|---|
| What is it? | A playbook / checklist | A separate Claude instance |
| Runs in | Same session context | Own isolated context window |
| Memory | Shares parent context | Fresh context + optional MEMORY.md |
| Tools | Inherits parent tools | Scoped explicitly (e.g. read-only) |
| Model | Uses active model | Can use cheaper model (Haiku) |
| Best for | Repeatable workflows | Isolated specialist tasks |
Hooks System
Event-driven scripts that fire automatically at lifecycle points. Zero LLM involvement. Zero tokens. Pure local execution.
Hook Events
| Event | When it fires | Can block? | Best for |
|---|---|---|---|
| PreToolUse | Before any tool executes | ✅ Exit 2 | Security guards, validation |
| PostToolUse | After tool succeeds | ❌ | Auto-format, logging |
| Notification | Claude needs attention | ❌ | Desktop/Slack pings |
| Stop | Claude finishes responding | ❌ | "Done" notifications, final logs |
| PermissionDenied 2026 | Auto mode blocks action | Return retry:true | Intelligent retry logic |
| SessionStart | Session opens | ❌ | Logging, setup tasks |
Exit Code System — Critical
Production Settings.json
{
"hooks": {
// 1. Security guard — blocks dangerous bash commands
"PreToolUse": [{ "matcher": "Bash", "hooks": [{
"type": "command",
"command": "python .claude/hooks/security_guard.py",
"timeout": 10 }] }],
// 2. Auto-format — formats after every file write/edit
"PostToolUse": [{ "matcher": "Write|Edit", "hooks": [{
"type": "command",
"command": "python .claude/hooks/auto_format.py" }] }],
// 3. Notification — pings you when Claude needs input
"Notification": [{ "hooks": [{
"type": "command",
"command": "python .claude/hooks/notify.py",
"async": true }] }],
// 4. Session logger — logs everything silently in background
"Stop": [{ "hooks": [{
"type": "command",
"command": "python .claude/hooks/session_logger.py",
"async": true }] }]
}
}MCP Connectors
Model Context Protocol — Anthropic's open standard connecting Claude Code to the outside world. GitHub, Gmail, databases, browsers, and 3,000+ tools.
{
"mcpServers": {
// Local stdio server (Node.js)
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_..." }
},
// Local stdio server (Python)
"playwright": {
"command": "uvx",
"args": ["mcp-playwright"]
},
// Hosted remote server (HTTP)
"tavily": {
"type": "http",
"url": "https://mcp.tavily.com/mcp/?apikey=tvly-..."
}
}
}Sub-Agents
Separate Claude instances with isolated context, scoped tools, custom models, and defined permissions. Skills are playbooks. Sub-agents are specialists.
Five Key Properties
Agent File Anatomy
--- name: code-reviewer description: > Reviews code for quality, security vulnerabilities, and best practices. Use proactively before commits or PRs. Checks OWASP Top 10, N+1 queries, and naming conventions. Best for Python, JS, TypeScript. tools: Read, Grep, Glob, Bash disallowedTools: Write, Edit model: claude-haiku-4-5 memory: project color: blue --- You are a senior engineer specialising in code quality and security. You have read-only access — you analyse and report, never modify. For every review, check in order: 1. Security: SQL injection, hardcoded secrets, auth gaps 2. Performance: N+1 queries, blocking operations 3. Code quality: missing error handling, function length, naming 4. Output: Prioritised findings with severity + specific fix for each
Three Must-Have Agents
Agent Teams
Multiple Claude Code instances with a shared task list and peer messaging — working in parallel on the same codebase. Experimental
Sub-Agents vs Agent Teams
| Sub-Agents | Agent Teams | |
|---|---|---|
| Topology | Star — everything through parent | Mesh — teammates talk directly |
| Peer messaging | ❌ Cannot | ✅ Direct mid-task messaging |
| Task distribution | Parent assigns manually | Shared task list — agents self-claim |
| File isolation | Same directory | Git worktrees — separate branches |
| Cost | ~1× baseline | ~7× baseline |
| Stability | Production-ready | Experimental — known bugs |
Enable & Use
# Requires: git repo + Opus 4.6+ model # settings.json: { "env": { "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" } } # Then in Claude Code — one prompt: Create an agent team to refactor this codebase: - Teammate 1: Fix SQL injection issues in /api - Teammate 2: Write tests (wait for T1's API contract first) - Teammate 3: Update documentation (can start immediately)
Three Tiers of Parallelism
Plugins & Marketplace
Bundle skills, agents, hooks, and MCP servers into one installable unit. Install community power-ups. Share your full Claude Code setup with your team in one command.
5 Must-Install Plugins
Scheduling & Automation Loops
Claude Code that works while you sleep. Three scheduling tiers — from session-scoped polling to cloud-hosted routines that run when your laptop is closed.
Three Scheduling Tiers
/loop Syntax
# Basic interval /loop 5m check if the deployment finished # Cron expression (more precise) /loop 0 9 * * 1-5 run the morning standup skill # Loop a skill /loop 10m /fetch-api-data # Adaptive — Claude chooses the interval dynamically /loop watch the build status and report when it changes # Job management cron list # see all jobs + IDs cron delete job_a3f2 # cancel specific job # Emergency brake — stops ALL scheduled tasks export CLAUDE_CODE_DISABLE_CRON=1
Headless Mode (The Engine Behind Everything)
# Run without interactive session — for cron, GitHub Actions, pipelines claude -p "analyse error logs and write summary to /reports/" # With tool restrictions (safer) claude -p "generate daily report" --allowedTools "Read,Bash,Glob" # System cron (Linux — ALWAYS source .env for the API key) 0 9 * * 1-5 bash -c 'source ~/.env && cd /project && claude -p "/standup" >> /log/daily.log 2>&1'
New 2026 Features
Anthropic shipped 74 releases in Q1 2026 alone. These six fundamentally change what Claude Code is.
Industry Playbooks
Real-world use cases across six industries. Click a sector to see specific workflows, skills, and prompts that work today.
📣 Marketing Playbook
💹 Finance Playbook
⚙️ Operations Playbook
👥 HR & People Playbook
👷 Engineering Playbook
📊 Data & Analytics Playbook
Quick Reference
Slash commands, power prompts, and troubleshooting — everything you need in one place.
| Problem | Likely Cause | Fix |
|---|---|---|
| MCP "Connection closed" on Windows | Missing cmd /c wrapper | "command":"cmd","args":["/c","npx",...] |
| MCP server shows disconnected | Forgot to restart after config change | Fully exit (/exit) and reopen Claude Code |
| Hook doesn't block anything | Using exit 1 instead of exit 2 | Change to sys.exit(2) for blocking behaviour |
| Skill not appearing in / typeahead | Wrong location or no restart | Check .claude/skills/name/SKILL.md — restart |
| Agent routing to wrong agent | Vague description field | Rewrite description with explicit trigger conditions |
| Context rot / quality degrading | Context window 70%+ full | Run /compact "focus on [what matters]" |
| /loop task not firing | Claude busy or new session | Use claude --resume to restore; check cron list |
| Headless cron fails silently | ANTHROPIC_API_KEY missing in cron env | Add source ~/.env && before claude -p in cron |
| Plugin silently broken | Components in wrong folder | Move skills/agents/hooks to plugin ROOT, not inside .claude-plugin/ |
| Agent Teams not working | Not on Opus / no git repo | Set Opus 4.6+ model, run git init && git commit --allow-empty |