Claude Code
The terminal-native coding agent — its layers, what each one is for, and the loop that uses them well.
← Back to Reference HubBest for: Long-horizon agent work, refactors, debugging autonomously, scripted runs.
- Install: npm i -g @anthropic-ai/claude-code, then run "claude" in any directory
- Reads CLAUDE.md at project root automatically for working memory
- Full filesystem read/write and shell execution — no copy/paste needed
- Models: Opus 4.7 (planning), Sonnet 4.6 (default), Haiku 4.5 (fast/cheap) — switchable per session
- Context: 200K standard · 1M beta on supported surfaces · 500K on Enterprise
- --dangerously-skip-permissions disables per-action approvals for fully autonomous runs
Limitations: No traditional inline tab-completion — designed for chat/agent interaction, not keystroke completion. Anthropic models only. Heavier resource use than completion-first tools like Copilot.
Best for: Non-trivial changes where you want alignment before code is written.
- Toggle with Shift+Tab — explicit, visible mode in the prompt indicator
- Read-only: file reads, greps, web search, MCP queries — no writes
- Output is a structured plan with files-to-touch and a step-by-step approach
- Use ExitPlanMode to commit to the plan; the agent then drops into execute mode
- Best paired with subagents for parallel exploration before planning
Limitations: Plan Mode quality is bounded by what the agent can read. If context is scattered across services Claude can't reach, the plan will hand-wave that section. Add MCP servers for those data sources.
Best for: Patterns that recur (rule of three) where you want consistent execution.
- Location: .claude/skills/<name>/SKILL.md (project) or ~/.claude/skills/ (user)
- Description field is the trigger contract — write it the way the user would phrase the request
- Body is normal Markdown — checklists, examples, gotchas, references to files in the same skill folder
- Can ship supporting files (templates, scripts) alongside SKILL.md
- Use the skill-creator skill (built-in) to scaffold new ones with good triggers
Limitations: Skills only fire if the description matches. Vague or generic descriptions ('does code review') will misfire — under-fire on real cases, over-fire on lookalikes. Test the trigger by paraphrasing what you'd actually ask.
Best for: Parallel exploration, specialized roles, tasks that would pollute main context.
- Defined in .claude/agents/<name>.md with a description, tool allowlist, and system prompt
- Invoked via the Task/Agent tool with a self-contained prompt
- Each subagent gets its own context window — long agents stay focused
- Parallel subagents work well for "explore four directories simultaneously" patterns
- Common roles: code-reviewer, explorer (read-only search), planner, verifier
Limitations: Subagents have no memory of the parent conversation — prompts must be self-contained. Don't expect the subagent to 'know what you've tried' unless you tell it. Cost is real: each subagent run is its own model call.
Best for: Quality gates that must run regardless of what the agent decides to do.
- Configured in .claude/settings.json under hooks{} — matcher + command + event
- PreToolUse can block a tool call (non-zero exit cancels the action)
- PostToolUse fires after — perfect for autoformatters, test runs, validators
- SessionStart/SessionEnd good for logging, briefing notes, or memory sync
- Hooks are deterministic — not AI. Use them when "AI decides" is the wrong control plane.
Limitations: Hooks run every time their matcher matches — over-broad matchers will slow every action to a crawl. Start narrow (specific tool + specific path), expand only when needed. Failures in PostToolUse don't roll back the action; use PreToolUse for blocking.
Best for: Frequent prompts (review-pr, ship-it, write-tests) that benefit from one-keystroke recall.
- Location: .claude/commands/<name>.md (project) or ~/.claude/commands/ (user)
- Body is the full prompt — Markdown formatting is fine
- Arguments via {{ARG}} placeholders that the user fills at invocation time
- Show in the prompt with /<name> — autocomplete by name
- Often the cheapest first step before promoting to a skill (no trigger to design)
Limitations: Slash commands are explicit — you have to remember to type them. If you want the agent to apply the pattern automatically when it sees the right shape of work, write a skill instead.
Best for: Letting the agent reach systems it doesn't natively know about.
- Configure project-scoped servers in .mcp.json (committed to repo)
- User-scoped servers in ~/.claude.json
- Transport: stdio (local subprocess), HTTP, or SSE
- Official Anthropic registry of trusted MCP servers — searchable from inside Claude Code
- Tools appear with prefixed names: mcp__<server>__<tool>
Limitations: Every MCP server you add expands the agent's reach — and the prompt-injection surface. Treat MCP servers like dependencies: review code, prefer first-party or well-known sources, and use Hooks to gate writes that go through MCP.
Best for: Sharing reusable Claude Code customizations across a team or the public marketplace.
- One package, many primitives — no more "install these eight files in this order"
- Versioned and pinnable — teams stay on a known-good build
- Marketplaces aggregate plugins, public or private
- Inspect with /plugin list; manage with /plugin enable/disable
- Build your own with the plugin scaffolding tools (a single-sentence brief is often enough)
Limitations: A plugin's skills and hooks run with the same trust as anything else in .claude/. Audit before installing third-party plugins, especially ones with hooks or MCP servers that write or call external services.
Skills, slash commands, and subagents are not the same thing
| Phase of work | Reach for | Why | Common mistake |
|---|---|---|---|
| Orienting in a new repo | Plan Mode + a read-only "explorer" subagent | Read-only safety + isolated context for the search | Jumping straight to edits before reading CLAUDE.md |
| Designing a non-trivial change | Plan Mode | Forces a written plan before any writes | Asking for the change directly and getting a half-right diff |
| Executing the change | Main session + skills for the recurring sub-tasks | Skills compress the boilerplate; main session keeps narrative continuity | Over-fragmenting into subagents that lose the through-line |
| Verifying / reviewing | A "code-reviewer" subagent + PostToolUse hooks for lint/test | Subagent gives an independent second read; hooks enforce the mechanical checks | Trusting the same agent that wrote the code to also review it |
| Shipping / committing | A slash command (e.g., /ship) + PreToolUse hook to block bad commits | Slash command captures your house style; hook enforces it | Hand-typing the same commit-prep prompt every time |
| Reaching external systems | MCP servers | Standard protocol; the agent calls tools, not raw HTTP | Pasting API responses into the prompt instead of wiring an MCP |
| Sharing customizations | Plugins | One install for the whole team; versioned and revertible | Copy-pasting SKILL.md files across repos by hand |
| Working in an IDE | VS Code / JetBrains / Visual Studio plugin | Same agent, same skills, same hooks — surfaced inside the editor | Treating the IDE plugin as a different product (it isn't) |
The high-leverage loop
Plan Mode → ExitPlanMode → execute → subagent review → hook-enforced ship. Plan Mode is the cheapest quality upgrade in the entire tool. A code-reviewer subagent on top is the second cheapest. Hooks are where you put the rules you don't want to debate every session — formatters, test runners, write-locks on dangerous paths. CLAUDE.md carries the working memory between sessions. Everything else (skills, slash commands, plugins, MCP) is leverage you add as patterns repeat.