Claude Code skills vs CLAUDE.md vs MCP: which to use
CLAUDE.md, skills, slash commands, subagents, hooks, MCP and plugins in Claude Code: when each loads, what it costs in context, and which to use when.
CLAUDE.md is always-on context: it loads in full at session start and costs tokens on every request. A skill is a
SKILL.md playbook: only its description loads up front, the body loads when it is used. MCP connects Claude to
outside tools and data. Subagents run work in their own context, hooks run your scripts on events, and plugins
package all of these. Slash commands are now skills.
The short version
| Feature | What it is | When it loads | Context cost |
|---|---|---|---|
CLAUDE.md | Instructions you write | Session start, full file | Every request |
.claude/rules/ | Instruction files, optionally scoped to paths | Session start, or when Claude touches matching files | Every request once loaded |
Skill (SKILL.md) | Reusable knowledge or a workflow | Description at start, body when used | Low; zero for user-only skills |
| Slash command | A skill you call with /name | When you type it | Same as a skill |
| Subagent | A worker with its own context window | When spawned | Isolated; only the summary returns |
| Hook | A script, HTTP call, MCP tool, prompt or subagent on an event | On its event | Zero, unless it returns output |
| MCP server | Tools and data from an outside service | Tool names at start, schemas on demand | Low until a tool is used |
| Plugin | A package of skills, agents, hooks and MCP servers | When enabled | The sum of what it contains |
Checked November 2026. Sources: Extend Claude Code and the pages linked below.
CLAUDE.md: what Claude should always know
CLAUDE.md holds build commands, conventions, project layout and "never
do X" lines. Files in your working directory and above load at launch, in full. Files in subdirectories load once
Claude reads or edits a file there. All of them add up; none overrides another.
The cost is steady. Every line rides along in every request. Anthropic suggests under 200 lines per file, because
longer files use more context and reduce adherence. @path imports help you organize, but they do not save
context: imported files load with the file that imports them.
To cut the cost, move rules for one part of the codebase into .claude/rules/ with paths frontmatter. Those load
only when Claude works with matching files.
Two limits matter. Claude treats CLAUDE.md as context, not enforced configuration. And it holds only what someone
wrote into it.
Skills: knowledge and workflows on demand
A skill is a folder with a SKILL.md file. Claude Code follows the
Agent Skills open standard and adds invocation control, subagent execution and dynamic
context. Skills live in ~/.claude/skills/ (all your projects), .claude/skills/ (one repo, commit it to share), or
inside a plugin.
How they load:
- Names and descriptions of skills Claude may invoke are in context on every request.
- The full body loads when you type
/nameor Claude matches the description to your task. It then stays in the conversation. - With
disable-model-invocation: true, nothing loads until you call it. Use this for anything with side effects, like/deployor/commit. - After auto compaction, invoked skills are re-attached, up to the first 5,000 tokens each and 25,000 tokens in total.
Anthropic suggests keeping SKILL.md under 500 lines and moving reference material into separate files.
---
name: deploy
description: Deploy the application to production
disable-model-invocation: true
---
Deploy $ARGUMENTS to production:
1. Run the test suite
2. Build the application
3. Push to the deployment target
4. Verify the deployment succeededSlash commands are skills now
"Custom commands have been merged into skills." Files in .claude/commands/ still work, and deploy.md there
gives you /deploy just like .claude/skills/deploy/SKILL.md. The skill form adds a folder for supporting files and
the frontmatter above. Claude can invoke a command on its own unless you set disable-model-invocation: true.
Built-in commands such as /compact or /context run fixed logic. Bundled skills such as /code-review or
/batch are prompts, like your own skills. MCP servers can also expose prompts that show up as commands, in the form
/mcp__servername__promptname (commands reference).
Subagents: work in a separate context
A subagent runs in its own context window with its own system prompt, tools and permissions. Use one when a side task would flood your main conversation with search results, logs or file contents you will not need again. The subagent does the work and returns only a summary.
Define one as a Markdown file in .claude/agents/ or ~/.claude/agents/. Only name and description are
required; Claude uses the description to decide when to delegate.
---
name: code-reviewer
description: Reviews code for quality and best practices
tools: Read, Glob, Grep
model: sonnet
---
You are a code reviewer. When invoked, analyze the code and provide
specific, actionable feedback on quality, security, and best practices.A subagent does not see your conversation, the skills you invoked or the files Claude read. It starts with its
prompt, the task message, CLAUDE.md and a git status snapshot (the built-in Explore and Plan agents skip
CLAUDE.md). Skills listed in its skills field load in full at launch.
Skills and subagents combine. A skill with context: fork runs in a subagent, and a subagent can preload skills.
Hooks: things that must happen every time
Hooks run at lifecycle events such as SessionStart, UserPromptSubmit,
PreToolUse, PostToolUse and Stop. A handler can be a shell command, an HTTP request, an MCP tool call, a
prompt or a subagent. You set them in settings.json, in a plugin, or in skill and subagent frontmatter.
Hooks cost no context unless they return output. A PreToolUse hook can block a tool call, with exit code 2 or a
permissionDecision of deny. A hook can also add text to Claude's context through additionalContext, or plain
stdout on SessionStart and UserPromptSubmit.
This is the one place for guardrails. In Anthropic's words, a line like "never edit .env" in CLAUDE.md or a
skill "is a request, not a guarantee." A hook that blocks the edit is enforcement.
MCP: tools and data from outside
MCP servers give Claude tools for databases, issue trackers, browsers and
other services. Add one with claude mcp add:
claude mcp add --transport http notion https://mcp.notion.com/mcpScopes are local (default, you, this project), project (.mcp.json, shared through git) and user (you, all
projects).
Tool search is on by default. Only tool names and server instructions load at session start; full schemas load when
Claude needs a tool. So an idle server costs little. Tool results are a different matter: Claude Code warns when one
output passes 10,000 tokens, and the default maximum is 25,000 tokens (MAX_MCP_OUTPUT_TOKENS).
MCP and skills work together. MCP gives the connection, a skill teaches Claude how your team uses it, for example your database schema and query patterns.
Plugins: one package for all of the above
A plugin is a directory with a .claude-plugin/plugin.json
manifest plus skills, agents, hooks and MCP servers. Plugin skills are namespaced, like /my-plugin:review. Install
with /plugin from a marketplace, or load a folder with --plugin-dir while you build one.
An enabled plugin is part of every session. The names and descriptions of its skills and agents sit in context on every turn, its MCP servers run, and its hooks fire. Disable plugins you do not use.
Use X when
| Use | When |
|---|---|
CLAUDE.md | Claude gets a convention or command wrong twice, and every session needs it |
.claude/rules/ with paths | The rule matters only for some files or directories |
| Skill | You paste the same playbook or reference doc into chat again |
Skill with disable-model-invocation | A workflow with side effects that only you start |
| Subagent | A task reads many files and you only need the result |
| Hook | Something must happen, or be blocked, every time without Claude deciding |
| MCP server | You keep copying data from a system Claude cannot see |
| Plugin | A second repo or a teammate needs the same setup |
A typical setup: CLAUDE.md says "follow our API conventions", a skill holds the full API style guide, MCP connects
the database, and a PostToolUse hook runs the linter after every edit.
Where memory fits
All of these are files or configs that someone edits by hand. None of them holds what changes while you work: the
correction you gave yesterday, the server that moved, the deploy step a teammate learned. A CLAUDE.md line is also
only guidance.
agexs brain fills that gap over MCP plus hooks. Its hooks push your always-on rules at session start, the memories of a project on the first work there, and matching memories on every prompt. When you correct the agent, it asks it to save the lesson as a short memory, checks for near-duplicates and refuses secrets. One store serves Claude Code, Codex and Cursor. Rules block a command, ask first or remind, from hooks the agent cannot skip.
Setup
Install the agexs CLI, then:
agexs login
agexs install claudeYour existing CLAUDE.md can be imported, one memory per rule or fact, and the file stays as
it is. See Connect your agents.
FAQ
What is the difference between Claude Code skills and CLAUDE.md?
CLAUDE.md loads in full in every session. A skill loads only its description up front and its body when used.
Put "always" rules in CLAUDE.md and reference material or workflows in skills.
Are slash commands and skills the same thing?
Yes, for custom commands. Anthropic merged them: .claude/commands/deploy.md and .claude/skills/deploy/SKILL.md
both give you /deploy. The skill form adds supporting files and more frontmatter.
When should I use a subagent instead of a skill?
When the work would fill your context. A skill adds to your main window. A subagent uses its own window and returns only a summary.
Do MCP servers use up context?
Little while idle. Tool search loads only tool names and server instructions at start. Tool results do count, up to 25,000 tokens per output by default.
Can CLAUDE.md block a command?
No. Claude treats it as context, not enforced configuration. Use a PreToolUse hook to block a command every time.
Last updated on
Claude Code hooks: events, settings.json and examples
Claude Code hooks explained: every hook event, the settings.json format, matchers, exit codes and JSON that block or allow, plus examples and security tips.
CLAUDE.md vs AGENTS.md: one file for all coding agents
CLAUDE.md is Claude Code's instruction file, AGENTS.md the open format Codex, Cursor and others read. How to keep one file for every agent, and its limits.