Post

Claude Code Extension Mechanisms: Skills, Agents, MCP, and Slash Commands Compared

A comprehensive comparison of Claude Code's four extension mechanisms—slash commands, MCP servers, skills, and subagents—including context impact, interaction patterns, and when to use each.

Claude Code Extension Mechanisms: Skills, Agents, MCP, and Slash Commands Compared

Extending Claude Code’s capabilities can feel overwhelming. There are slash commands, MCP servers, skills, and subagents—each serving different purposes with different trade-offs. After spending time researching how these mechanisms work, interact, and affect Claude’s context window, I’ve compiled this comprehensive guide.

Table of Contents


Overview: The Four Extension Mechanisms

Mechanism Invocation Context Isolation Context Impact Best For
Slash Commands Manual (/cmd) No Minimal Quick, reusable prompts
MCP Automatic No Significant External integrations
Skills Automatic (Claude decides) No Moderate Complex automatic workflows
Subagents Automatic/explicit Yes Major (isolated) Verbose/isolated tasks

The key distinction: invocation style and context isolation. Slash commands require you to type /command, while skills and subagents activate automatically based on Claude’s judgment. Only subagents provide true context isolation—their verbose output doesn’t pollute your main conversation.


Slash Commands

What They Are

Slash commands are Markdown files stored as reusable prompts. You invoke them explicitly by typing /command-name. Each command is a single .md file in either .claude/commands/ (project) or ~/.claude/commands/ (personal).

1
2
3
4
5
6
7
8
# .claude/commands/review.md
---
description: Review code for security vulnerabilities
allowed-tools: Read, Grep
---

Review this code for security vulnerabilities and suggest fixes.
Focus on OWASP Top 10 issues.

Context Impact: Minimal

  • Metadata loaded at startup (~100 chars each) up to 15,000-char budget
  • Full content loaded only when executed
  • If never invoked, consumes almost no context

Pros and Cons

Pros:

  • Simple to create (single Markdown file)
  • No startup overhead if unused
  • Support arguments ($ARGUMENTS, $1, $2)
  • Support file references (@file) and bash execution (!command)
  • Easy to share via git

Cons:

  • Require explicit invocation (not automatic)
  • Limited to single file (no progressive disclosure)
  • Cannot invoke other slash commands directly

When to Use

Use slash commands when you:

  • Invoke the same prompt repeatedly
  • Want explicit control over execution
  • Need quick, frequently-used templates
  • Have simple, self-contained workflows

MCP (Model Context Protocol)

What It Is

MCP is an open-source standard for connecting Claude to external tools, databases, and APIs. MCP servers expose tools that Claude can discover and use dynamically. Think of it as the infrastructure layer for external integrations.

1
2
3
4
5
# Add an MCP server
claude mcp add --transport http github https://api.github.com/mcp/

# Or via stdio for local processes
claude mcp add --transport stdio --env API_KEY=YOUR_KEY airtable -- npx -y airtable-mcp-server

Context Impact: Significant

  • Tool catalogs fetched dynamically when needed
  • Output capped at 25,000 tokens by default (configurable via MAX_MCP_OUTPUT_TOKENS)
  • Warning threshold at 10,000 tokens

What MCP Provides

MCP servers expose three types of resources:

  1. Tools - Functions Claude can call (query databases, create issues, post messages)
  2. Prompts - Become slash commands automatically (/mcp__github__list_prs)
  3. Resources - Fetch data via @ mentions (@github:issue://123)

Pros and Cons

Pros:

  • Access to 1,200+ external tools and services
  • Dynamic tool discovery
  • Three transport options (HTTP, SSE, stdio)
  • Resources accessible via @mention syntax
  • Shareable via .mcp.json

Cons:

  • Requires external infrastructure/network
  • Setup complexity (authentication, configuration)
  • Security risk with untrusted servers
  • Can be verbose (needs output tuning)

When to Use

Use MCP when you need:

  • Access to external APIs or databases
  • Integration with third-party services (GitHub, Notion, Slack, Stripe)
  • Dynamic, tool-based interactions with external systems
  • Team-shared configurations for common integrations

Skills (Agent Skills)

What They Are

Skills are directories with a SKILL.md file plus optional supporting files. The key difference from slash commands: Claude automatically decides when to use them based on matching your request to the skill’s description.

1
2
3
4
5
6
.claude/skills/code-review/
├── SKILL.md          # Required: overview and workflows
├── SECURITY.md       # Optional: security checklist
├── PERFORMANCE.md    # Optional: performance patterns
└── scripts/
    └── run-linters.sh
1
2
3
4
5
6
7
8
9
10
11
# SKILL.md frontmatter
---
name: code-review
description: Expert code reviewer that analyzes for quality, security, and performance
allowed-tools: Read, Grep, Glob, Bash
---

When reviewing code:
1. Check for security vulnerabilities
2. Analyze performance implications
3. Verify coding standards compliance

Context Impact: Moderate (Lazy Loading)

  1. Only names/descriptions loaded at startup
  2. Full SKILL.md loaded when Claude decides to use it
  3. Supporting files loaded on-demand (progressive disclosure)

Skills vs Slash Commands

Aspect Slash Commands Skills
Invocation Manual: /command Automatic: Claude decides
Structure Single .md file Directory with multiple files
Discovery Explicit naming Based on description matching
Complexity Simple prompts Complex workflows
Context Loaded at execution Lazy loading, progressive

Pros and Cons

Pros:

  • Automatic invocation (more autonomous)
  • Supports complex workflows with multiple files
  • Progressive disclosure keeps context focused
  • Can include scripts and utilities
  • Tool restrictions via allowed-tools
  • Supports hooks and forked context

Cons:

  • Requires careful description writing for activation
  • Vague descriptions won’t trigger the skill
  • More complex to set up than slash commands
  • Not suitable for quick, simple prompts

When to Use

Use skills when:

  • Claude should discover the capability automatically
  • Multiple files or scripts are needed
  • Complex workflows with validation steps
  • Team needs standardized, detailed guidance
  • You want progressive disclosure to manage context

Subagents (Agents)

What They Are

Subagents are specialized AI assistants that run in isolated context windows. Each has its own system prompt, tool access, permissions, and conversation history. This is the only extension mechanism with true context isolation.

Built-in Subagents

Agent Model Tools Purpose
Explore Haiku Read-only Fast codebase exploration
Plan Inherited Read-only Research during plan mode
General-purpose Inherited All Complex multi-step tasks
Bash - Bash Terminal command isolation
Claude Code Guide - Read, Search Claude Code feature questions

Context Impact: Major (But Isolated)

The key benefit: isolation prevents context pollution.

  1. Subagent gets fresh, separate context
  2. Main conversation unaffected by verbose output
  3. Only summary/results returned to main
  4. Perfect for test runs, log analysis, documentation research
1
2
3
4
5
6
7
8
9
10
11
# .claude/agents/code-reviewer.md
---
name: code-reviewer
description: Expert code reviewer. Proactively reviews for quality and security.
tools: Read, Grep, Glob, Bash
disallowedTools: Write, Edit
model: sonnet
skills: security-check, performance-review
---

You are a senior code reviewer. Review code for quality, security, and best practices.

Pros and Cons

Pros:

  • Complete context isolation
  • Independent permissions per agent
  • Custom system prompts
  • Faster models (Haiku) for exploration
  • Resumable (full history preserved)
  • Parallel execution possible

Cons:

  • Cannot spawn nested subagents (design limitation)
  • Added latency (startup overhead)
  • More complex to configure
  • Don’t inherit parent’s skills by default
  • MCP tools unavailable in background agents

When to Use

Use subagents when:

  • Task produces verbose output you don’t need in main context
  • You want to enforce strict tool restrictions
  • Complex multi-step work that’s self-contained
  • Running tests, log analysis, documentation research
  • You want to run parallel research/work

Interaction Matrix

This is where things get interesting. Can these mechanisms call each other?

Interaction Possible? Notes
Skills → Skills ⚠️ Indirect Skill can encourage Claude to use another skill
Skills → Agents ✅ Yes Via context: fork + agent: agent-name
Agents → Agents ❌ No Prevented by design (avoids infinite chains)
Agents → Skills ✅ Yes Must be configured via skills: field
Slash → Slash ❌ No Cannot invoke directly
Slash → Skills ⚠️ Indirect Output may trigger skill discovery
Slash → Agents ✅ Yes Via context: fork
Skills → MCP ✅ Yes MCP tools available if not restricted
Agents → MCP ⚠️ Limited Not available in background agents

Why Agents Can’t Call Agents

This is a deliberate design decision to prevent:

  • Infinite delegation chains
  • Unbounded context fragmentation
  • Runaway resource consumption

Workaround: Return to main conversation and delegate sequentially.

Skills Running in Agent Context

1
2
3
4
5
6
7
---
name: complex-analysis
description: Complex analysis requiring isolation
context: fork          # Runs in isolated context
agent: general-purpose # Specifies which agent type
---
This skill runs in an isolated subagent context.

Decision Framework

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
┌─────────────────────────────────────────────────────────────┐
│              WHEN TO USE WHAT?                              │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  Need external API/database/service?                        │
│  └─ YES → Use MCP                                           │
│                                                             │
│  Want explicit control (type /command)?                     │
│  └─ YES → Use Slash Command                                 │
│                                                             │
│  Want Claude to decide when to use it?                      │
│  └─ YES → Is it a simple prompt?                            │
│           ├─ YES → Use Skill (simpler)                      │
│           └─ NO → Does it produce verbose output?           │
│                   ├─ YES → Use Subagent (isolation)         │
│                   └─ NO → Use Skill                         │
│                                                             │
│  Need strict tool isolation or different permissions?       │
│  └─ YES → Use Subagent                                      │
│                                                             │
└─────────────────────────────────────────────────────────────┘

Context Window Impact

Understanding how each mechanism affects your context budget is crucial for long conversations.

Ranking by Context Consumption

  1. Slash Commands (Minimal) - Only metadata if unused
  2. Skills (Moderate) - Lazy loading, progressive disclosure
  3. MCP (Significant) - Tool catalogs, output limits
  4. Subagents (Major but isolated) - Full context isolation benefits

Example with 200k Context

1
2
3
4
5
6
7
8
9
10
11
12
13
MAIN CONVERSATION (~120k available)
├── History: ~80k
├── Skills metadata (50 skills): ~5k
├── MCP tool catalogs: ~10k
├── Current request: ~25k
│
├── When Skill invoked: +10-15k additional
│   └── Full SKILL.md + supporting files
│
└── When Subagent invoked:
    ├── Subagent gets fresh ~100k+ context
    ├── Main conversation UNAFFECTED
    └── Only summary returns (~1-5k)

This is why subagents are powerful: verbose test output, log analysis, or exploration stays in the subagent context. Only the summary comes back.


Top Resources for Each Category

Slash Commands

Resource Description Link
Claude Command Suite 148+ commands for development workflows GitHub
wshobson/commands 57 production-ready commands GitHub
Awesome Claude Code Curated list of commands and workflows GitHub

MCP Servers

Server Description Link
GitHub PR/issue management, code search Official
Notion Workspace pages and databases Official
Slack Read channels, summarize threads Official
Stripe Payments and subscriptions Stripe Toolkit
PostgreSQL Database queries Official
MCP Awesome Directory of 1,200+ servers mcp-awesome.com

Skills

Resource Description Link
Anthropic Official Skills Creative, technical, enterprise skills GitHub
awesome-claude-skills Curated list (17.7k ⭐) GitHub
SkillsMP Marketplace Smart search, quality indicators skillsmp.com
claude-code-plugins-plus-skills 739 production-ready skills GitHub

Subagent Patterns

Pattern Description
Code Reviewer Agent Isolated review with restricted write access
Test Runner Agent Run tests in isolation, return summary
Log Analyzer Agent Process large logs without polluting context
Documentation Researcher Explore docs, return distilled findings

Conclusion

Claude Code’s four extension mechanisms serve complementary purposes:

  • Slash Commands - Simple, manual, single-file prompts for quick tasks
  • MCP - Infrastructure for accessing external tools and data
  • Skills - Auto-discovered capabilities with progressive disclosure
  • Subagents - Isolated execution contexts for complex/verbose tasks

Most production setups use a combination:

  • MCP for integrations (GitHub, Slack, databases)
  • Skills for team workflows (code review, documentation)
  • Subagents for exploratory/verbose tasks (tests, logs, analysis)
  • Slash commands for quick, frequently-used templates

The interaction patterns show that skills and subagents can work together via explicit configuration, while MCP provides the bridge to external systems that all other mechanisms can leverage. The key insight is that only subagents provide true context isolation—choose accordingly based on whether you need Claude to keep your main conversation clean.


Last updated: January 2026

Resources:

This post is licensed under CC BY 4.0 by the author.