As of February 2026, Claude Code v2.1.3+ unifies skills and slash commands, supports lifecycle hooks, subagents, MCP integrations, and a plugin ecosystem. Power users like Boris Cherny (Claude Code's creator) ship 259 pull requests in 30 days with every line written by AI. This guide covers the full system.
1. What Claude Code is and how to get started
Claude Code is a terminal-native AI coding agent built by Anthropic. It reads your codebase, plans changes, edits files, runs commands, creates commits, and iterates on problems autonomously.
How it differs from Cursor and Copilot:
- Copilot autocompletes lines inside your IDE. You drive; AI assists.
- Cursor is an AI-enhanced IDE fork of VS Code. More autonomous than Copilot, but still IDE-first.
- Claude Code inverts the relationship. AI drives; you supervise. You describe what you want in natural language. Claude handles the rest.
It follows Unix philosophy: composable, scriptable, pipe-friendly.
tail -f app.log | claude -p "Slack me if you see any anomalies"
Installation:
- macOS/Linux:
curl -fsSL https://claude.ai/install.sh | bashorbrew install --cask claude-code - Windows:
irm https://claude.ai/install.ps1 | iexorwinget install Anthropic.ClaudeCode - npm (deprecated):
npm install -g @anthropic-ai/claude-code
Native installations auto-update in the background. After installing, navigate to your project directory and run claude.
Pricing:
- Pro ($20/month) โ moderate usage, 5-hour reset cycle
- Max 5x ($100/month) โ sweet spot for power users
- Max 20x ($200/month) โ heavy usage
- API pay-per-token โ set the
ANTHROPIC_API_KEYenvironment variable instead
Usage limits are shared across Claude web/desktop and Claude Code. Monitor with /status.
Available surfaces: terminal CLI, browser (claude.ai/code), desktop app, VS Code extension, JetBrains extension, GitHub Actions, GitLab CI/CD, Slack, Chrome extension.
๐ Official docs: code.claude.com/docs/en/overview ยท github.com/anthropics/claude-code
2. CLAUDE.md: the constitution of your agent
CLAUDE.md files are persistent memory that shapes Claude Code's behavior. They define coding conventions, project architecture, common commands, and guardrails. Getting CLAUDE.md right is the single highest-leverage thing you can do.
The four-level hierarchy
Loaded automatically at startup. Higher levels take precedence.
| Level | Location | Purpose |
|---|---|---|
| Enterprise | System paths (e.g., /etc/claude-code/CLAUDE.md) |
Org-wide standards, managed by IT |
| Project | ./CLAUDE.md or ./.claude/CLAUDE.md |
Team-shared, committed to source control |
| User | ~/.claude/CLAUDE.md |
Personal preferences across all projects |
| Local | ./CLAUDE.local.md |
Personal project-specific prefs, auto-gitignored |
Claude also performs recursive lookup from your working directory upward. Subdirectory CLAUDE.md files load only when Claude accesses files in that subtree (progressive disclosure, saving context tokens).
What to put in it
Keep it under 300 lines (context tokens are precious):
- One-line project description
- Exact build/test/lint commands
- Code style rules (specific: "Use 2-space indentation" not "Format code properly")
- Directory structure overview
- Critical gotchas ("NEVER commit .env files")
Run /init to bootstrap a starter CLAUDE.md from your project structure.
Imports
CLAUDE.md supports @path/to/import syntax:
@READMEโ reference your readme@docs/git-instructions.mdโ pull in other docs@~/.claude/my-project-instructions.mdโ personal instructions not in the repo
Imports resolve recursively up to 5 hops. Not evaluated inside code blocks.
Iterative updates
Tell Claude: "remember that we use pnpm, not npm" and it updates CLAUDE.md automatically. Use /memory to open memory files in your editor. Periodically ask Claude to review the file and suggest improvements.
Auto Memory
Claude can also record its own learnings as it works, stored in ~/.claude/projects/<project>/memory/. Opt in:
export CLAUDE_CODE_DISABLE_AUTO_MEMORY=0
๐ Official docs: code.claude.com/docs/en/memory
3. The core workflow: explore, plan, code, commit
Anthropic's recommended workflow has four phases. The first two are where most people under-invest.
The four phases
- Explore โ Ask Claude to read relevant files. Explicitly say "don't write any code yet." Use subagents for complex exploration to keep your main context clean.
- Plan โ Ask Claude to make a plan. Use thinking triggers for harder problems. Iterate until the plan is solid. Have Claude write it to a document as a checkpoint.
- Code โ Ask Claude to implement the plan. Include tests or expected outputs so Claude can self-verify.
- Commit โ Ask Claude to commit and create a PR. Optionally update docs and changelogs.
Plan Mode
Activated by pressing Shift+Tab twice (or claude --permission-mode plan). Claude can only analyze the codebase and create plans โ it cannot modify files.
Boris Cherny's workflow: start in Plan Mode โ iterate โ switch to Auto-Accept Mode (Shift+Tab once) โ Claude executes. "A good plan is really important!"
You can set Plan Mode as default in .claude/settings.json:
{"permissions": {"defaultMode": "plan"}}
Context management
Context is the real skill in Claude Code. The 200K token window is your most precious resource.
/clearโ Resets context completely. Use between unrelated tasks. After two failed corrections,/clearand write a better initial prompt./compactโ Summarizes conversation to free tokens while preserving key context. Accepts a focus hint:/compact Focus on the API changes- Auto-compaction โ triggers automatically near context limits
Providing context
- @-tagging โ
@src/utils/auth.jsincludes the full file;@src/componentsprovides a directory listing - Images โ drag-and-drop or paste (Ctrl+V) into the terminal
- macOS screenshot โ
Cmd+Ctrl+Shift+4to clipboard, thenCtrl+V
Thinking modes
Thinking triggers allocate more reasoning tokens for complex problems:
| Trigger | Budget | When to use |
|---|---|---|
| "think" | ~4K tokens | Normal complexity |
| "think hard" | ~10K tokens | Multi-file changes |
| "think harder" / "ultrathink" | ~32K tokens | Architecture decisions |
Toggle thinking with the Tab key during a session. Opus 4.6 uses adaptive thinking that calibrates depth dynamically, but the trigger words still work.
Permission bypass
The --dangerously-skip-permissions flag bypasses all permission checks for fully autonomous execution. Anthropic recommends this only in containers without internet access. Useful for CI/CD pipelines and batch operations.
Keyboard shortcuts worth knowing
| Shortcut | Action |
|---|---|
| Escape | Stop Claude mid-response |
| Escape ร 2 | Jump back in message history |
| Shift+Tab | Cycle permission modes |
| Tab | Toggle thinking mode |
| Up arrow | Browse past prompts (including prior sessions) |
๐ Official docs: code.claude.com/docs/en/common-workflows ยท anthropic.com/engineering/claude-code-best-practices
4. Skills: the unified instruction system (v2.1.3+)
In January 2026, Anthropic merged slash commands and skills into one system. Existing .claude/commands/ files still work. .claude/skills/ is the recommended path forward because skills support richer features: supporting file directories, YAML frontmatter for invocation control, and auto-loading when contextually relevant.
Skills follow the Agent Skills open standard (agentskills.io), adopted across Claude Code, GitHub Copilot, OpenAI Codex, and others.
Anatomy of a skill
Every skill lives in a folder with a SKILL.md file containing two parts:
---
name: explain-code
description: Explains code with visual diagrams and analogies.
Use when the user asks "how does this work?"
---
When explaining code, always include:
1. Start with an analogy to everyday life
2. Draw an ASCII art diagram showing flow
3. Walk through the code step by step
4. Highlight a common gotcha
- The
namefield becomes the/slash-command - The
descriptionhelps Claude decide when to auto-load
Two invocation modes
- User-triggered โ You type
/explain-codeand Claude runs it - Claude auto-loads โ Claude reads skill descriptions at startup and loads relevant ones based on the current task
This is progressive disclosure: only metadata loads initially; full content loads on activation.
Key frontmatter controls
| Field | What it does |
|---|---|
disable-model-invocation: true |
Slash command only. Prevents Claude from auto-loading (use for /deploy, /commit) |
user-invocable: false |
Auto-load only. Hides from slash menu (use for background knowledge like coding conventions) |
context: fork |
Runs in an isolated subagent |
agent: Explore |
Which agent model the subagent uses |
allowed-tools: Read, Grep, Glob |
Restricts tools available |
argument-hint: [issue-number] |
Placeholder text in the UI |
String substitution works with $ARGUMENTS, $0, $1, and ${CLAUDE_SESSION_ID}.
Including "ultrathink" anywhere in skill content enables extended thinking.
Skill hierarchy
When skills share the same name, priority follows: enterprise > personal > project > plugin
| Scope | Location |
|---|---|
| Enterprise | Managed settings |
| Personal | ~/.claude/skills/ |
| Project | <project>/.claude/skills/ |
Skill descriptions consume a budget of 2% of the context window. Run /context to check for warnings about excluded skills.
Supporting files
A skill directory can include more than SKILL.md:
my-skill/
โโโ SKILL.md # Main instructions (required)
โโโ template.md # Template for Claude to fill in
โโโ examples/
โ โโโ sample.md # Example output
โโโ scripts/
โโโ validate.sh # Script Claude can execute
When to use skills vs CLAUDE.md
- CLAUDE.md โ always-on context loaded every session. Use for project-wide conventions.
- Skills โ loaded on demand when relevant. Use for specialized workflows, reusable templates, or anything that shouldn't eat context tokens every session.
๐ Official docs: code.claude.com/docs/en/skills
5. Subagents: isolated context for parallel work
Subagents are separate Claude instances that handle delegated tasks in their own context window. Subagent work doesn't pollute your main conversation. They cannot spawn other subagents.
Built-in subagents
| Agent | Model | Tools | Purpose |
|---|---|---|---|
| Explore | Haiku (fast, cheap) | Glob, Grep, Read, limited Bash | Read-only codebase search |
| Plan | Sonnet | Read/explore tools | Research before creating plans |
| General-purpose | Sonnet | All tools | Complex research, multi-step operations |
Claude delegates to these automatically when appropriate.
Custom subagents
Defined as Markdown files in .claude/agents/ (project) or ~/.claude/agents/ (user):
---
name: code-reviewer
description: Expert code review. Use proactively after modifying code.
tools: Read, Grep, Glob, Bash
model: inherit
---
You are a senior code reviewer.
Focus on: readability, naming, duplication, error handling,
security, test coverage.
Key fields:
modelโ sonnet, opus, haiku, orinherit(matches parent)permissionModeโ default, acceptEdits, bypassPermissions, planskillsโ auto-load specific skills into the subagent
Manage interactively with /agents.
The context: fork pattern
When a skill specifies context: fork, invoking it spawns a subagent and runs the skill's instructions in isolation. This bridges skills and subagents without needing a separate agent file.
Parallel sessions
Power users run multiple Claude Code instances simultaneously. Each needs its own git worktree or full checkout to avoid file conflicts:
git worktree add ../feature-auth -b feature/auth
git worktree add ../feature-search -b feature/search
# Run separate Claude Code sessions in each
Boris Cherny runs 5 local + 5-10 remote sessions simultaneously.
Community perspective on custom subagents
Shrivu Shankar (enterprise scale, billions of tokens/month) argues custom subagents are "brittle" because they "gatekeep context." He prefers letting Claude self-orchestrate via the built-in Task tool. Others find custom agents valuable within plugins. The consensus: use built-in agents for most work; create custom agents only for persistent specialized behavior.
๐ Official docs: code.claude.com/docs/en/sub-agents
6. Hooks: deterministic control in a probabilistic system
CLAUDE.md instructions are suggestions Claude should follow. Hooks are guarantees. They execute as app-level code at specific lifecycle points, regardless of what the LLM decides.
The practitioner wisdom: "CLAUDE.md suggests; hooks enforce."
Lifecycle events
| Event | When it fires | Common use |
|---|---|---|
| SessionStart | New session, resume, clear, compact | Inject context, set up environment |
| UserPromptSubmit | After you submit, before Claude processes | Validate prompts, add context |
| PreToolUse | Before Claude executes a tool | Block dangerous commands, modify inputs |
| PermissionRequest | When permission dialog appears | Auto-allow or auto-deny |
| PostToolUse | After tool completes successfully | Auto-format, run tests |
| Stop / SubagentStop | Agent finishes responding | Force continuation ("keep going") |
| Notification | Async events (permission, idle, auth) | Desktop notifications |
| PreCompact | Before compaction | Preserve key context |
| SessionEnd | Session terminates | Cleanup only |
Configuration
Hooks live in settings.json (user, project, or local scope):
{
"hooks": {
"PostToolUse": [{
"matcher": "Edit|Write",
"hooks": [{
"type": "command",
"command": "npx prettier --write \"$(jq -r '.tool_input.file_path')\"",
"timeout": 30
}]
}]
}
}
How hooks communicate
- Hook scripts receive JSON on stdin with context (tool_name, tool_input, session_id, cwd)
- Exit code 0 = success
- Exit code 2 = block the operation; stderr feeds back to Claude
- Other exit codes = non-blocking warnings
- Hooks can output JSON with
permissionDecision,updatedInput,additionalContext
Claude Code also supports prompt-based hooks (type: "prompt") that query Haiku for context-aware decisions.
Practical examples
- Auto-format TypeScript after every file write
- Block
rm -rfordrop tablevia PreToolUse - Log all bash commands to a file
- Protect
.envandpackage-lock.jsonfrom edits - Send desktop notifications when Claude needs input
- Re-inject critical context after compaction via SessionStart
Pro tip: block at commit time, not write time
From Shrivu Shankar: blocking mid-plan confuses the agent. Instead, use a PreToolUse hook on Bash(git commit) that checks for a test-pass flag file. This forces Claude into a natural test-and-fix loop before committing.
Use /hooks to view, add, and manage hooks interactively. Changes take effect immediately.
๐ Official docs: code.claude.com/docs/en/hooks ยท code.claude.com/docs/en/hooks-guide
7. MCP connects Claude to external tools
The Model Context Protocol (MCP) is an open-source standard for connecting AI applications to external tools and data sources. Introduced by Anthropic in November 2024, now under the Linux Foundation. Over 97 million monthly SDK downloads and 10,000+ active servers. Supported across Claude, ChatGPT, Cursor, Gemini, VS Code, and more.
What MCP servers provide
- Tools โ functions the AI can call
- Resources โ data sources accessed via
@server:resourcesyntax - Prompts โ pre-defined workflows available as slash commands
Adding servers
# HTTP transport (recommended for remote)
claude mcp add --transport http github https://api.githubcopilot.com/mcp/
# Stdio transport (local processes)
claude mcp add --transport stdio db -- npx -y @bytebase/dbhub \
--dsn "postgresql://readonly:password@host:5432/analytics"
Configuration scopes
| Scope | Location | Shared? |
|---|---|---|
| Project | .mcp.json at project root |
Yes, via version control |
| Local | ~/.claude.json under project path |
No |
| User | ~/.claude.json globally |
No |
Environment variables expand in all fields: ${VAR} or ${VAR:-default}.
Popular integrations
GitHub, Sentry, PostgreSQL/databases, Notion, Slack, Playwright (browser automation), Stripe, Asana, Figma, and hundreds more at github.com/modelcontextprotocol/servers.
Context budget warning
Every connected MCP server loads tool definitions into the context window before any conversation begins. Real measurements:
- 7 MCP servers consumed 67,300 tokens (33.7% of 200K) just for tool definitions
- One user reported 143K of 200K tokens consumed, with MCP tools eating 82K
MCP Tool Search (shipped January 2026) addresses this: when tool descriptions exceed 10% of the context window, tools load on-demand via search instead of being preloaded. Result: 85% reduction in token overhead.
Monitor context usage with /context. Configure limits with MAX_MCP_OUTPUT_TOKENS.
๐ Official docs: code.claude.com/docs/en/mcp ยท modelcontextprotocol.io
8. Plugins bundle everything for distribution
Plugins package skills, agents, hooks, MCP servers, and LSP servers into installable units. They solve: "how do I share my Claude Code setup with the team?"
Plugin structure
my-plugin/
โโโ .claude-plugin/
โ โโโ plugin.json # Manifest (only "name" required)
โโโ skills/
โโโ agents/
โโโ commands/
โโโ hooks/
โ โโโ hooks.json
โโโ .mcp.json
โโโ .lsp.json
Claude Code auto-discovers components in default locations. Commands from plugins are namespaced as plugin-name:command-name to prevent conflicts.
Installation scopes
- User (default) โ
~/.claude/settings.json - Project (shared) โ
.claude/settings.json - Local (private) โ
.claude/settings.local.json
Marketplaces
Marketplaces are curated collections hosted as GitHub repos. Anthropic maintains the official one at anthropics/claude-plugins-official.
/plugin marketplace add anthropics/claude-plugins-official
The /plugin command opens a tabbed interface for discovering, installing, enabling/disabling, and updating.
Notable official plugins
- code-review โ PR review with 5 parallel Sonnet agents
- feature-dev โ multi-agent development workflow
- security-guidance โ security review
- commit-commands โ git workflow automation
๐ Official docs: code.claude.com/docs/en/plugins-reference ยท code.claude.com/docs/en/discover-plugins
9. Prompt engineering for Claude Code
Prompting Claude Code differs from prompting the Claude API. Your instructions shape multi-step autonomous behavior, not a single response.
Be specific
โ "Add tests for foo.py" โ "Write a test case for foo.py covering the edge case where the user is logged out. Avoid mocks."
โ "Why does ExecutionFactory have such a weird API?" โ "Look through ExecutionFactory's git history and summarize how its API evolved."
Reference specific files and patterns. Claude takes instructions literally.
State what to do, not what to avoid
โ "Do not use markdown" โ "Respond in plain prose paragraphs"
Describing behaviors to avoid can prime those behaviors.
Use Plan Mode as a prompting strategy
Start in Plan Mode โ iterate โ execute. This separation consistently produces better results than jumping straight to coding.
CLAUDE.md is persistent prompt engineering
Treat it like any prompt โ iterate, test, refine. Add emphasis with "IMPORTANT" or "YOU MUST" for critical rules.
Match thinking depth to problem complexity
- Simple task โ no trigger needed
- Multi-file refactor โ "think hard about this"
- Architecture decision โ "ultrathink"
Extended thinking can make Claude more verbose on basic tasks. Don't over-apply.
Use checklists for complex work
Have Claude create a Markdown checklist file and work through items one by one. Creates a durable record that survives context resets and helps Claude track progress.
Course correct early
- Escape to interrupt at any point
- Escape ร 2 to jump back and edit a previous prompt
- After two failed corrections:
/clearand write a better initial prompt
Don't keep correcting in a polluted context.
๐ Official docs: docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview
10. Putting it all together: how power users work
Boris Cherny (Claude Code's creator)
- Runs 5 local + 5-10 remote sessions simultaneously, each in its own git checkout
- Maintains a CLAUDE.md (~2.5K tokens) updated every time Claude makes a mistake
- Workflow: Plan Mode โ iterate on plan โ Auto-Accept Mode โ Claude one-shots the implementation
- Uses
/commit-push-prdozens of times daily - Deploys specialized subagents like
code-simplifierandverify-app - Result: 259 PRs in 30 days
Shrivu Shankar (enterprise, billions of tokens/month)
- Treats CLAUDE.md like "ad space" โ allocates token budgets per tool, only documents tools used by โฅ30% of engineers
- Blocks at commit time using a PreToolUse hook, not at write time
- Avoids custom subagents (prefers Claude's self-orchestration)
- Avoids
/compactโ uses/clear+/catchupfor cleaner restarts - For complex tasks: has Claude dump plan to a
.mdfile, clears context, starts new session reading that file
The pattern both converge on
- CLAUDE.md establishes the constitution
- Plan Mode for every non-trivial task
- Auto-Accept Mode once the plan is solid
- Skills auto-activate based on task context
- Hooks enforce what CLAUDE.md suggests
- Subagents handle exploration and parallel work
- MCP connects to GitHub, Slack, databases, Playwright
/clearoften โ every new task starts fresh
The throughline: context management is the real skill. The 200K token window is your most precious resource. Everything in Claude Code's design โ progressive disclosure of skills, isolated subagent contexts, MCP Tool Search โ exists to use that window efficiently.
11. The Agent SDK (a brief look ahead)
The Claude Agent SDK provides the same tools, agent loop, and context management that power Claude Code โ programmable in Python and TypeScript. It's for building custom AI agents you embed in your own applications.
- Python:
pip install claude-agent-sdk - TypeScript:
npm install @anthropic-ai/claude-agent-sdk
When to use what:
- Claude Code CLI โ you're a developer working interactively on coding tasks
- Agent SDK โ you're building products that embed agentic AI (support bots, research tools, internal automation)
The SDK supports all Claude Code features: built-in tools, hooks as callbacks, subagents, MCP, skills, structured outputs, and budget controls (max_budget_usd).
We'll cover the Agent SDK in depth in the next post.
๐ Official docs: platform.claude.com/docs/en/agent-sdk/overview ยท github.com/anthropics/claude-agent-sdk-python ยท anthropic.com/engineering/building-agents-with-the-claude-agent-sdk