Official Docs Breakdown: Extend Claude Code
💬 hippo: This is the first post in the Claude Code Official Docs Breakdown series. Understanding the extension architecture up front makes it much easier to pick the right tool for each job.
1. What Is the Extension Layer?
At its core, Claude Code combines a code-reasoning AI model with built-in tools for reading and writing files, searching code, running commands, and accessing the web. Those built-in tools already cover the vast majority of day-to-day coding tasks.
This post focuses on the extension layer: custom capabilities you add to give Claude deeper project context, connect external services, and automate workflows. The extension layer consists of 7 core mechanisms: CLAUDE.md, Skills, Subagents, Agent teams, MCP, Hooks, and Plugins. Knowing what each one owns—and when to reach for it—is the key to using Claude Code effectively.
2. Official Docs Breakdown
2.1 Extension Mechanisms at a Glance
Each of the 7 mechanisms hooks into a different part of the Agent Loop (Claude’s “think–act–observe” cycle after receiving a prompt):
| Feature | Role | When to Use | Example |
|---|---|---|---|
| CLAUDE.md | Persistent context loaded automatically in every session | Project conventions, “always do X” rules | “Use pnpm instead of npm; run tests before committing” |
| Skill | Instructions, knowledge, and workflows Claude can invoke | Reusable content, reference docs, repeatable tasks | /deploy checklist; API style-guide Skill |
| Subagent | Runs in an isolated context and returns only a summary | Context isolation, parallel tasks, specialized workers | Read dozens of files and return only the key findings |
| Agent teams | Coordinate multiple independent Claude Code sessions | Parallel research, multi-role reviews, competing-hypothesis debugging | Spin up security, performance, and test reviewers in parallel |
| MCP | Connects to external services via Model Context Protocol | External data reads or actions | Query a database, post to Slack, drive a browser |
| Hook | Deterministic script triggered by lifecycle events (no LLM involved) | Predictable automation | Run ESLint automatically after every file edit |
| Plugin | Packaging layer bundling Skills, Hooks, Subagents, and MCP servers | Cross-repo reuse and sharing with others | Namespaced /my-plugin:review command |
💬 hippo: Plugins are the packaging layer. They bundle Skills, Hooks, Subagents, and MCP servers into a single installable unit. Plugin Skills are namespaced (for example,
/my-plugin:review), so multiple plugins coexist without collisions. When you want to share a setup across a team or publish it to a marketplace, wrap it as a Plugin.
2.2 Comparing Overlapping Features
Several of these 7 mechanisms look similar at first glance. Here is how to draw clean boundaries between them.
Skill vs. Subagent:
| Dimension | Skill | Subagent |
|---|---|---|
| What it is | Reusable instructions, knowledge, or workflow | Isolated worker with its own context window |
| Key strength | Shares content across different contexts | Context isolation—does heavy work separately and returns only a summary |
| Best for | Reference material, invocable workflows (e.g., /deploy) |
Reading many files, parallel work, specialized roles |
Skills come in two flavors: reference (providing knowledge, like an API style guide) and action (triggering a workflow, like /deploy).
Reach for a Subagent when you need context isolation or when the main session’s context window is filling up. A Subagent can read dozens of files and run heavy searches while keeping the main conversation clean with a short summary.
They compose well: a Subagent can preload specific Skills via the skills: field, and a Skill can run inside an isolated context with context: fork.
CLAUDE.md vs. Skill:
| Dimension | CLAUDE.md | Skill |
|---|---|---|
| Loading | Loaded automatically every session | Loaded on demand |
| File imports | Yes, via @path |
Yes, via @path |
| Triggers workflows | No | Yes, via /<name> |
| Best for | Rules that apply on every session | Reference material and invocable workflows |
Simple rule of thumb: if Claude should always know it, put it in CLAUDE.md. If it is reference material or a workflow needed only occasionally, make it a Skill.
CLAUDE.md vs. Rules vs. Skills:
All three store instructions, but they differ in how and when they load:
| Dimension | CLAUDE.md | .claude/rules/ |
Skill |
|---|---|---|---|
| When loaded | Every session | Every session, or when matching files are opened | On demand, when invoked or relevant |
| Scope | Entire project | Can be scoped to specific file paths | Specific task |
| Best for | Core conventions and build commands | Language- or directory-specific guidelines | Reference material, repeatable workflows |
The killer feature of .claude/rules/ is paths frontmatter, which restricts a rule to matching files or directories:
1 |
|
Claude only loads this rule when working on .go files, avoiding unnecessary context overhead everywhere else.
Subagent vs. Agent team:
| Dimension | Subagent | Agent team |
|---|---|---|
| Context | Own context; returns results to caller | Own context; fully independent |
| Communication | Reports back only to the main agent | Teammates message each other directly |
| Coordination | Main agent orchestrates all work | Shared task list with self-coordination |
| Best for | Focused tasks where only the final result matters | Complex work requiring discussion and collaboration |
| Token cost | Lower: only a summary returns to the main context | Higher: each teammate is a separate Claude instance |
MCP vs. Skill:
| Dimension | MCP | Skill |
|---|---|---|
| What it is | Protocol for connecting external services | Knowledge, workflows, and reference material |
| Provides | Tools and data access | Domain knowledge, procedures, and guidelines |
| Examples | Slack integration, database queries, browser control | Code review checklist, deploy workflow, API style guide |
They do not compete—they complement each other: MCP gives Claude the ability to interact with external systems, while Skills teach Claude how to use those tools effectively.
2.3 Scopes and Precedence
Extensions can be defined at multiple levels: user-level (shared across all projects), project-level (scoped to the current repository), plugin-level, and managed policy (enforced centrally by an organization). When the same feature exists at multiple levels, resolution rules differ by feature type:
| Feature | Layering Behavior | Precedence (High → Low) |
|---|---|---|
| CLAUDE.md | Additive: all levels contribute content | More specific wins (subdirectory > repo root > user) |
| Skills | Override by name | Managed > User > Project > Plugin |
| Subagents | Override by name | Managed > CLI flag > Project > User > Plugin |
| MCP servers | Override by name | Local > Project > User |
| Hooks | Merged: all registered hooks run | No override—every matching hook executes |
Because CLAUDE.md is additive, files in the working directory and its parent directories load at startup, while subdirectory CLAUDE.md files load on demand when you touch files inside those subdirectories. When instructions conflict, Claude resolves them by generally favoring the more specific scope.
2.4 Combining Extensions in Practice
In real repositories, you rarely rely on a single extension in isolation. Instead, you combine them to fit your workflow:
| Pattern | How It Works | Example |
|---|---|---|
| Skill + MCP | MCP provides connectivity; Skill teaches Claude how to use it well | MCP connects to the database; Skill documents table schemas and query patterns |
| Skill + Subagent | Skill spawns multiple Subagents for parallel execution | /audit Skill launches security, performance, and style Subagents in parallel |
| CLAUDE.md + Skills | CLAUDE.md holds core rules; Skills hold on-demand reference docs |
CLAUDE.md states “follow our API conventions”; a Skill holds the full API style guide |
| Hook + MCP | Hook triggers external actions through MCP | Post-edit Hook sends a Slack alert whenever Claude modifies critical files |
2.5 Context Window Cost
Every extension you enable consumes part of Claude’s context window. Loading too much not only fills up the window, it also adds noise that degrades performance—Skills misfire, and Claude starts missing your conventions.
| Feature | When Loaded | What Loads | Context Cost |
|---|---|---|---|
| CLAUDE.md | Session start | Full file contents | Paid on every request |
| Skills | Session start + on use | Descriptions at startup; full content when invoked | Low (only descriptions on every request) |
| MCP servers | Session start | Tool names; full JSON Schema deferred until use | Low (tool search is on by default, ~10% overhead) |
| Subagents | On spawn | Fresh isolated context (system prompt, listed Skills, CLAUDE.md, git status) |
Fully isolated from main session |
| Hooks | On trigger | Nothing by default (runs as external script) | Zero, unless the Hook returns output |
Three subtleties worth keeping in mind:
MCP tool search: Enabled by default, tool search loads only tool names at session start and defers full JSON Schemas (tool parameter definitions) until Claude actually invokes a tool. Idle MCP tools therefore consume very little context. However, MCP connections can fail silently mid-session—if a server drops, its tools disappear without warning, and Claude may error out trying to call a tool that is no longer there. Whenever that happens, run /mcp to check server status.
Zero-cost mode for Skills: By default, Skill descriptions load at session start so Claude can decide when to trigger them. For Skills you only ever want to invoke manually, set disable-model-invocation: true in frontmatter:
1 |
|
With this flag set, Claude never sees the Skill in its prompt—it loads only when you explicitly run /db-migration, bringing its idle context cost down to zero.
Subagents do not inherit main-session Skills: A Subagent starts with a clean, isolated context and only receives Skills explicitly declared in its skills: field. Skills already loaded in the main session are not carried over automatically.
3. Field Notes from hippo
💬 hippo: Here are the pitfalls I hit in real projects and how I fixed them:
3.1 CLAUDE.md Bloat
My blog repository’s CLAUDE.md started at 50 lines covering build commands and formatting rules. As the project grew, I kept appending rules—screenshot verification steps, Hook setup notes, series conventions—until it swelled past 300 lines.
The result: Claude started ignoring rules. Not out of refusal, but because the prompt got so long that rules diluted each other and effectively became invisible.
Fix: Split scenario-specific rules into .claude/rules/ with paths frontmatter to scope where they apply. Screenshot verification rules now load only when editing files under _posts, and Go testing rules load only for .go files. I trimmed CLAUDE.md back under 100 lines so it holds only core repository conventions.
3.2 Silent MCP Disconnects
I configured a Puppeteer MCP server for screenshot verification. Mid-session, Claude suddenly errored out saying the screenshot tool did not exist. Digging in, the MCP server process had crashed, but Claude never warned me—it simply tried calling a vanished tool and failed.
Fix: Make /mcp your first reflex whenever an external tool call fails unexpectedly. I also added a session-start Hook to verify MCP server health automatically.
3.3 Vague Skill Descriptions Causing False Triggers
I wrote a Skill for my pre-publish blog checklist, but left the description too generic (“article checking tool”). Claude started loading it even during ordinary code commits because the word “checking” matched too broadly.
Fix: Tighten the description field with concrete boundaries—for example, “Pre-publish content quality checklist for blog posts; use only when editing Markdown files under _posts.” Specific descriptions give Claude the signal it needs to load the right Skill at the right time.
3.4 Subagents Not Inheriting Main-Session Skills
I had a /doc-rewrite Skill defining scoring rubrics and writing standards. When I asked Claude to process several posts in parallel with Subagents, none of the Subagents followed those rules—they could not see the Skill loaded in the main session.
Fix: Declare required Skills explicitly in the Subagent’s skills: field:
1 | skills: |
3.5 Incremental Adoption Strategy
If you are just getting started, add extensions incrementally instead of wiring everything up on day one:
- Start with
CLAUDE.md: Capture core project conventions (package manager, build commands, directory layout). - Add Skills for repetitive tasks: Turn recurring code reviews or deploy checklists into invocable Skills.
- Add MCP when you need external systems: Connect databases, Slack, or browser automation as needed.
- Add Hooks for deterministic automation: Auto-lint after saves or run checks before commits.
- Use Subagents for isolation or parallelism: Offload large-scale file searches and parallel tasks.
- Reach for Agent teams on complex collaboration: Use them for multi-role reviews or competing-hypothesis debugging.
4. FAQ
Q: Both CLAUDE.md and Skills can store instructions. Which should I pick?
A: Ask whether Claude needs it on every session. Always-on rules (build commands, coding standards, directory layout) belong in CLAUDE.md. Occasional reference material (API docs, deploy checklists, review workflows) belongs in Skills. As a rule of thumb, keep CLAUDE.md under 200 lines; once it grows past that, split content into .claude/rules/ or Skills.
Q: What is the difference between a Subagent and an Agent team?
A: A Subagent is a short-lived worker spawned inside the current session—it finishes its task, returns a summary, and exits under the main agent’s control. An Agent team consists of multiple independent Claude Code instances that message each other directly, share a task list, and self-coordinate. Pick Agent teams when teammates need back-and-forth discussion; pick Subagents for focused tasks where you only care about the final output.
Q: What should I do when my context window fills up?
A: Check three things in order: first, see if CLAUDE.md has grown too long (split anything over 200 lines); second, audit your MCP servers (every server’s tool definitions consume context); third, mark rarely used manual Skills with disable-model-invocation: true.
Q: Do Hooks consume context?
A: Not by default. Hooks run as external scripts with zero context overhead. They only consume context if the Hook emits output that gets injected back into the conversation.
Q: How do I scope a rule file to a specific directory?
A: Add paths frontmatter to a Markdown file inside .claude/rules/. For example, paths: ["**/*.go"] loads only for Go files, and paths: ["src/components/**"] applies only inside src/components. Omit paths if you want the rule loaded on every session.
Q: How can I verify that a Skill loaded properly?
A: Type / in a session to list all available Skills. A Skill with disable-model-invocation: true will not appear in Claude’s auto-discovery list, but you can still invoke it manually with /skill-name. If invocation fails, verify that the filename matches the name field in frontmatter.
5. Summary
| Feature | One-Liner | Typical Use Case |
|---|---|---|
CLAUDE.md |
Always-loaded project handbook | Project conventions, build commands |
| Skill | Invocable knowledge pack | Reference docs, deploy workflows |
| Subagent | Isolated temporary worker | Large-scale searches, parallel tasks |
| Agent team | Collaborating specialist team | Multi-role reviews, competing-hypothesis debugging |
| MCP | Connector for external services | Databases, Slack, browser automation |
| Hook | Event-driven automation script | Post-save linting, pre-commit checks |
| Plugin | Installable distribution bundle | Cross-repo reuse, marketplace publishing |
Series Navigation
- Index: Claude Code Complete Guide · Series Index
- Previous: Official Docs Breakdown: CLI Reference
- Next: Official Docs Breakdown: Legal and Compliance
Based on the official Extend Claude Code.
Last updated: 2026-03-31





