MCP servers, custom agents, skills, hooks, plugins, and CLAUDE.md — each extends Claude Code differently. They load in a specific priority order, and name conflicts are resolved by first-wins deduplication. Bundled skills always beat user skills.
When two extensions share a name, the first one loaded wins. Assembly happens in loadAllCommands() (commands.ts lines 449-469).
registerBundledSkill() at startup. Examples: /schedule, /loop, /claude-api, /simplify. Always override user skills with same name.~/.claude/projects/<slug>/skills/ or ~/.claude/skills/. User-written markdown files with frontmatter. Override built-in CLI commands.~/.claude/workflows/ (if WORKFLOW_SCRIPTS feature enabled). Registered as commands.Add unlimited tools via Model Context Protocol. 6 transports: stdio (subprocess), SSE (HTTP streaming), HTTP (custom), WebSocket (TLS/proxy), SDK Control (embedded), In-Process (zero overhead).
Configured in settings.json under mcpServers. 24 integration files in services/mcp/. OAuth authentication supported. Tool schemas merged at boot.
Markdown files in ~/.claude/agents/ define reusable subagents with system prompts, tool restrictions, and model overrides.
Invoked via Agent tool or /agent command. Can define their own MCP servers in frontmatter (cleaned up on exit).
Markdown files in ~/.claude/skills/ define reusable slash commands. Frontmatter: name, description, model override, allowed tools, execution context (inline or fork).
19 bundled skills compiled into binary. User skills can reference disk files (extracted on first use, memoized).
Shell commands running before/after tool execution. Configured per-tool in settings.json under hooks.
PreToolUse hooks CAN block execution. PostToolUse hooks run after, can transform output. 20 hook events from Setup to PermissionDenied. 15s default timeout. 10min tool timeout. Workspace trust gating.
Community packages installed via /plugin install @author/name. Can provide commands, skills, MCP servers, hooks.
Extra marketplaces configurable. Policy pluginOnlyPolicy restricts MCP to plugin-only mode. Admin-trusted sources: built-ins, policySettings, plugin providers.
Project instruction files discovered by walking directory tree up to git root. Supports @import composition with circular reference prevention.
4-priority hierarchy: global /etc/ → user ~/.claude.md → project ./CLAUDE.md → local overrides. Injected into system prompt. NOT subject to 200-line truncation (unlike MEMORY.md). Committable to VCS.
| Aspect | CLAUDE.md | MEMORY.md |
|---|---|---|
| Purpose | Project instructions | Cross-session memory index |
| Source | Code (version controlled) | Generated (by Claude + user) |
| Truncation | No limit | 200 lines / 25KB |
| Content | Direct instructions | Pointer index to topic files |
| Discovery | Walk dir tree to git root | Fixed path in memory dir |
| Composition | @import with cycle detection | Pointer links to *.md files |
| Injection | User context (system prompt) | Memory section (system prompt) |