Claude Code Extensions: The Complete Guide (2026)

Claude Code has four extension systems: MCP servers, Skills, custom Agents, and Hooks. This guide explains what each does, how to set them up, and which one fits your use case.

March 10, 2026 · 1 min read

Claude Code supports four distinct extension mechanisms. Each solves a different problem, and choosing the wrong one wastes time. This is the complete overview.

4
extension types (MCP, Skills, Agents, Hooks)
9,000+
community plugins in active use
60s
to install most extensions
0
build step or compilation required

The short version: MCP servers connect Claude to external tools and APIs. Skills teach Claude custom workflows and create slash commands. Custom Agents isolate tasks in their own context. Hooks run shell commands automatically at lifecycle events.

Plugins are how you package and share any of these. If you just want to extend your own setup, you don't need to create a plugin. If you want to share your extensions with teammates or the community, you package them as a plugin.

The Four Extension Types

MCP Servers

Connect Claude to external APIs, databases, and tools. GitHub, Slack, Postgres, browsers, file systems. Each MCP server adds new tools Claude can call.

Skills

Custom instructions and slash commands injected into Claude's context. SKILL.md files that teach Claude your conventions, deploy workflows, and domain knowledge.

Custom Agents

Specialized AI assistants in their own context window. Define tool restrictions, a custom system prompt, and a specific model. Claude delegates tasks automatically.

Hooks

Shell commands that run automatically at lifecycle events. Format code after edits. Block dangerous commands before they execute. Send notifications when Claude needs input.

Extension TypeWhere It LivesWhat It Does
MCP Server.mcp.json or ~/.claude.jsonAdds external tool calls Claude can invoke
Skill.claude/skills/ or ~/.claude/skills/Injects instructions and slash commands into context
Custom Agent.claude/agents/ or ~/.claude/agents/Runs tasks in isolated context with custom model/tools
Hook.claude/settings.json hooks sectionRuns shell commands automatically on lifecycle events
PluginAny directory with .claude-plugin/plugin.jsonBundles any of the above for sharing and distribution

MCP Servers

MCP (Model Context Protocol) is how Claude Code connects to external systems. You configure an MCP server, and Claude gains new tools it can call: search GitHub repos, query a Postgres database, control a browser, read from Slack.

MCP servers run as separate processes. They expose tools over a protocol that Claude Code understands. Claude decides when to call them based on context, the same way it decides when to use its built-in Bash or Read tools.

MCP vs built-in tools

Claude Code ships with Bash, Read, Edit, Write, Grep, Glob, and a few others. MCP servers extend this list. The Morph MCP server, for example, adds FastApply (35% faster edits) and WarpGrep (parallel codebase search that saves 40% of input tokens).

Setup

Add MCP server configuration to .mcp.json in your project root (shared with team) or ~/.claude.json (personal, all projects):

.mcp.json — project-level MCP configuration

{
  "mcpServers": {
    "morph": {
      "command": "npx",
      "args": ["@morphllm/morphmcp"],
      "env": {
        "MORPH_API_KEY": "sk-...",
        "ALL_TOOLS": "true"
      }
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_..."
      }
    }
  }
}

After saving, restart Claude Code. Ask: "What MCP tools are available?" to confirm the servers loaded.

For a full guide to MCP in Claude Code, including the best servers to install and how they work together, see the Claude Code MCP Servers guide.

Skills and Slash Commands

Skills are Markdown files that inject instructions into Claude's context. Every skill becomes a slash command. A file at ~/.claude/skills/deploy/SKILL.md creates /deploy. A file at .claude/skills/pr-review/SKILL.md creates /pr-review for the current project.

Claude also loads skill descriptions automatically at session start. If a skill's description matches what you're asking, Claude can invoke it without you typing the slash command. Use disable-model-invocation: true in the frontmatter to prevent this and require explicit invocation.

~/.claude/skills/deploy/SKILL.md

---
name: deploy
description: Deploy the application to production. Use when deploying or releasing.
disable-model-invocation: true
---

Deploy the application:

1. Run bun run test and confirm all tests pass
2. Run bun run build
3. Commit any pending changes with message "chore: pre-deploy cleanup"
4. Push to main branch
5. Wait for CI to pass, then confirm deployment succeeded

Do not proceed if tests fail. Report what failed instead.

Skills support $ARGUMENTS substitution, so /fix-issue 123 becomes "Fix issue 123 following our conventions" when the skill contains Fix issue $ARGUMENTS.

Skills vs CLAUDE.md

CLAUDE.md is always-loaded context. Skills are on-demand. Use CLAUDE.md for things Claude should always know (project stack, conventions, critical rules). Use Skills for specific workflows you invoke when needed (deploy, PR review, database migration).

Skill directory structure

~/.claude/skills/           # Personal skills, all projects
  deploy/
    SKILL.md              # Required entry point
    checklist.md          # Supporting docs Claude can reference
  pr-review/
    SKILL.md
    examples/
      good-pr.md

.claude/skills/            # Project skills, current project only
  db-migrate/
    SKILL.md
    scripts/
      validate.sh

For the full skills reference including context: fork (run in a subagent), dynamic context injection, and sharing skills via plugins, see the Claude Code Plugins guide.

Custom Agents

Custom agents are specialized AI assistants that run in their own context window. Each agent has a custom system prompt, specific tool access, and optionally a different model. When Claude encounters a task matching an agent's description, it delegates automatically.

When to use agents over skills

  • The task produces verbose output you don't want in main context
  • You want to use Haiku instead of Sonnet to cut costs
  • You need strict tool restrictions (read-only, no Bash, etc.)
  • The task is self-contained and returns a summary

When to use skills instead

  • The task needs your conversation history for context
  • You're adding reusable instructions, not isolating a task
  • You want Claude to invoke the workflow inline
  • Latency matters and agent startup overhead is a concern

Creating a custom agent

Agent files use Markdown with YAML frontmatter. The body becomes the system prompt. Store them in .claude/agents/ (project) or ~/.claude/agents/ (personal).

.claude/agents/code-reviewer.md

---
name: code-reviewer
description: Expert code review. Use after writing or modifying code to check for issues.
tools: Read, Grep, Glob, Bash
model: haiku
---

You are a senior code reviewer. When invoked:

1. Run git diff to see recent changes
2. Focus review on modified files only
3. Check for: security issues, error handling gaps, naming clarity, test coverage

Organize feedback as:
- Critical (must fix before merge)
- Warnings (should fix)
- Suggestions (optional improvements)

Include specific file:line references and show the fix, not just the problem.

Key agent frontmatter fields

FieldOptionsPurpose
modelhaiku, sonnet, opus, inheritPick a cheaper model for routine tasks
toolsRead, Grep, Glob, Bash, Edit, Write, Agent...Restrict what the agent can do
permissionModedefault, acceptEdits, dontAsk, bypassPermissions, planControl how permissions work
memoryuser, project, localPersist learnings across sessions
isolationworktreeRun in isolated git worktree, auto-cleaned up
maxTurnsintegerLimit agentic turns to control cost and runtime

Claude Code includes built-in agents you can rely on: Explore (read-only, Haiku, for codebase search), Plan (read-only, used in plan mode), and general-purpose (all tools, for complex tasks). Custom agents stack on top of these.

Persistent memory

Set memory: user in a code-reviewer agent and it builds up knowledge about your codebase over time. Patterns it discovers in Monday's review inform Friday's review. Memory lives at ~/.claude/agent-memory/code-reviewer/.

Hooks

Hooks run shell commands, HTTP endpoints, or LLM prompts automatically at specific points in Claude Code's lifecycle. They provide deterministic control over Claude Code's behavior, something the LLM alone cannot guarantee.

If you want code formatted after every edit, hooks do this reliably. If you want to block writes to .env files, a hook enforces this every time. If you want a desktop notification when Claude needs your attention, hooks handle that.

Hook events

EventWhen It FiresCommon Use
PreToolUseBefore any tool call (can block it)Block writes to protected files, validate Bash commands
PostToolUseAfter a tool call succeedsAuto-format edited files, run linter, log commands
NotificationWhen Claude needs inputDesktop notification so you can multitask
SessionStartWhen a session begins or resumesRe-inject context after compaction (matcher: compact)
StopWhen Claude finishes respondingVerify all tasks are done before Claude stops
UserPromptSubmitWhen you submit a promptInject dynamic context before Claude processes it
SubagentStart/StopWhen a subagent starts or finishesSet up / tear down external connections
ConfigChangeWhen a settings file changesAudit configuration changes

Setup

Hooks go in the hooks section of .claude/settings.json (project) or ~/.claude/settings.json (global). Use the /hooks interactive menu in Claude Code to create them without editing JSON by hand.

.claude/settings.json — two common hooks

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "jq -r '.tool_input.file_path' | xargs npx prettier --write"
          }
        ]
      }
    ],
    "Notification": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "osascript -e 'display notification "Claude Code needs attention" with title "Claude Code"'"
          }
        ]
      }
    ]
  }
}

How hooks communicate

Hooks receive event data as JSON on stdin. They communicate back via exit codes: exit 0 to allow, exit 2 to block (stderr becomes feedback to Claude). For example, blocking writes to .env:

.claude/hooks/protect-env.sh

#!/bin/bash
INPUT=$(cat)
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')

if [[ "$FILE_PATH" == *".env"* ]]; then
  echo "Blocked: .env files are protected. Edit manually." >&2
  exit 2
fi

exit 0

Hooks also support type: prompt (single-turn LLM evaluation) and type: agent (multi-turn with tool access) for decisions that need judgment rather than deterministic rules.

For the complete hooks reference including all event schemas, JSON output format, and advanced patterns, see the Claude Code Hooks guide.

Plugins: Packaging and Sharing

A plugin is a directory with a .claude-plugin/plugin.json manifest. It can contain any combination of skills, agents, hooks, and MCP servers. Install a plugin once and all its components become available.

Use standalone .claude/ config when

  • Customizing Claude Code for one project
  • Personal workflows that don't need to be shared
  • Experimenting before packaging
  • You want short slash commands like /deploy (not /my-plugin:deploy)

Use plugins when

  • Sharing functionality with teammates or the community
  • Distributing the same setup across multiple projects
  • You want versioned releases and marketplace distribution
  • Bundling MCP servers + skills + hooks together

Minimal plugin structure

my-plugin/
├── .claude-plugin/
│   └── plugin.json       # Manifest (name, description, version)
├── skills/
│   └── deploy/
│       └── SKILL.md
├── agents/
│   └── code-reviewer.md
├── hooks/
│   └── hooks.json
└── .mcp.json             # MCP server config for this plugin

.claude-plugin/plugin.json

{
  "name": "my-team-tools",
  "description": "Shared tools for the engineering team",
  "version": "1.2.0",
  "author": { "name": "Engineering Team" }
}

Test locally with claude --plugin-dir ./my-plugin. Plugin skills are namespaced: /my-team-tools:deploy to avoid conflicts.

To distribute, create a marketplace repository and share it. Team members install via /plugin in Claude Code.

For full plugin development coverage, see the Claude Code Plugins guide. For how MCP, Skills, and Plugins relate, see Claude Code Skills vs MCP vs Plugins.

Which Extension to Use

Most Claude Code workflows fit one of four patterns. Here is which extension applies to each:

What You Want to DoUse This
Connect Claude to GitHub, Jira, Slack, your databaseMCP Server
Create a /deploy or /pr-review slash commandSkill
Speed up file edits, reduce context rotMCP Server (Morph)
Run code review in isolation with read-only toolsCustom Agent
Use Haiku for routine tasks to cut costsCustom Agent with model: haiku
Auto-format code after every editPostToolUse Hook
Block writes to .env and secrets filesPreToolUse Hook
Get a notification when Claude needs inputNotification Hook
Share your setup with teammatesPlugin
Enforce standards org-widePlugin + managed settings

The recommended baseline setup

Most developers benefit from starting with three things:

  • Morph MCP server: FastApply (35% faster edits) + WarpGrep (40% fewer tokens from parallel search)
  • 1-2 project Skills: deploy workflow, PR review checklist, or team conventions
  • 1-2 Hooks: auto-format on edit, notification when Claude needs input

How to Build Your Own Claude Code Extension

The fastest path depends on what you're building. Here is the minimum viable setup for each type:

Build a Skill (5 minutes)

# Create a global skill
mkdir -p ~/.claude/skills/commit
cat > ~/.claude/skills/commit/SKILL.md << 'EOF'
---
name: commit
description: Create a conventional commit with a clear message
disable-model-invocation: true
---

Review staged changes with git diff --staged, then create a commit with:
- Type prefix: feat, fix, refactor, docs, chore, test
- Concise subject under 72 characters
- Body explaining the why, not the what, if needed

Stage all changed files first. Use git commit -m with the message.
EOF

Build a Custom Agent (10 minutes)

# Create a project-level agent
mkdir -p .claude/agents
cat > .claude/agents/security-reviewer.md << 'EOF'
---
name: security-reviewer
description: Security review specialist. Use after auth changes or before releases.
tools: Read, Grep, Glob
model: sonnet
---

You are a security reviewer focused on OWASP Top 10 vulnerabilities.

When invoked:
1. Run git diff to identify recent changes
2. Check for: hardcoded secrets, SQL injection, XSS, insecure dependencies
3. Report by severity: Critical, High, Medium, Low

Include file:line references and recommend fixes.
EOF

Build a Hook (2 minutes)

# Add a Prettier hook via /hooks menu in Claude Code
# Or edit .claude/settings.json directly:
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "jq -r '.tool_input.file_path' | xargs npx prettier --write 2>/dev/null || true"
          }
        ]
      }
    ]
  }
}

Build an MCP Server (requires coding)

MCP servers are Node.js or Python processes that implement the Model Context Protocol. Anthropic provides an SDK for both languages. Most developers use an existing community server rather than building from scratch.

Minimal MCP server skeleton (TypeScript)

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";

const server = new McpServer({ name: "my-tools", version: "1.0.0" });

server.tool("get_ticket", { id: z.string() }, async ({ id }) => {
  const ticket = await fetchTicket(id);
  return { content: [{ type: "text", text: JSON.stringify(ticket) }] };
});

const transport = new StdioServerTransport();
await server.connect(transport);

Frequently Asked Questions

What is the difference between a Claude Code extension and a plugin?

Extensions is the general term for anything that adds capabilities to Claude Code: MCP servers, Skills, custom Agents, and Hooks. Plugins are the packaging format that bundles one or more of these into a shareable, installable unit with a plugin.json manifest. All plugins are extensions, but not all extensions need to be plugins.

How do I install a Claude Code extension?

It depends on the type. MCP servers go in your .mcp.json or ~/.claude.json under mcpServers. Skills go as .md files in .claude/skills/ or ~/.claude/skills/. Custom Agents go as .md files in .claude/agents/ or ~/.claude/agents/. Hooks go in the hooks section of .claude/settings.json. Plugins wrap these and are installed via the /plugin command.

Can I use Claude Code extensions with VS Code?

Yes. Extensions configured at the user level (~/.claude/settings.json, ~/.claude/agents/, ~/.claude/skills/) work in both the terminal CLI and the VS Code extension. Project-level extensions in .claude/ also work in both.

How many MCP servers can I add to Claude Code?

There is no hard limit on the number of MCP servers. Each server adds tools to Claude's tool list. The practical limit is that too many tools increases prompt size and can dilute Claude's tool selection quality. Most developers run 3 to 6 MCP servers.

Do Claude Code extensions work in headless/CI mode?

MCP servers and Skills work in headless mode (claude -p). Hooks also work, with one exception: PermissionRequest hooks do not fire in non-interactive mode. Use PreToolUse hooks for automated permission decisions in CI.

What is the difference between a Skill and a custom Agent in Claude Code?

Skills run in the main conversation context. They inject instructions into Claude's existing context window and run inline. Custom Agents spawn a separate context window with their own system prompt, tool restrictions, and optionally a different model. Use Skills for reusable instructions and workflows. Use Agents when you want isolation, cost control via a cheaper model, or strict tool restrictions.

How do I create a custom slash command in Claude Code?

Create a .md file in .claude/skills/ (project-specific) or ~/.claude/skills/ (global). The directory name becomes the slash command. For example, ~/.claude/skills/deploy/SKILL.md creates the /deploy command. Add a description field in YAML frontmatter so Claude knows when to invoke it automatically.

Are there security risks with Claude Code extensions?

Yes, particularly with MCP servers and Hooks. MCP servers run as separate processes with whatever permissions they have on your system. Hooks execute shell commands automatically. Review the source of any community extension before installing it. Anthropic's official marketplace plugins are reviewed for safety. Use .claude/settings.json permissions rules to restrict what Claude can do.

Add Fast Edits and Parallel Search to Claude Code

The Morph MCP server is the most-installed Claude Code extension. FastApply delivers 35% faster edits. WarpGrep reduces context rot by 40% through parallel codebase search. Install in 60 seconds.