Developers on X are sharing “five-layer” setups for Claude Code: a CLAUDE.md rules file at the bottom, then skills, hooks, subagents and plugins stacked on top, plus dozens of GitHub repositories that package all of it. The layers are real, and Anthropic documents each one in its Claude Code documentation. What the viral diagrams leave out is that every layer has a different price: some sit in Claude’s context window in every session, some only load when needed, and one of them runs code on your machine with your permissions. We went through Anthropic’s docs page by page and put the cost and the risk of each layer in one table, so you can decide which layers your project actually needs.
The five layers in one table
| Layer | Where it lives | When it loads | Context cost | Enforced? | Watch out for |
|---|---|---|---|---|---|
| CLAUDE.md | ./CLAUDE.md or .claude/CLAUDE.md (project), ~/.claude/CLAUDE.md (you) | Files above the working folder at launch, subfolder files on demand | Every line, every session; target under 200 lines | No, guidance the model can ignore | Contradicting rules, imports that still load in full |
| Skills | SKILL.md folders, for example .claude/skills/ | Description always, full text only when used | Low: description capped at 1,536 characters, listing about 1% of the context window | No | Too many skills push descriptions out of the listing |
| Hooks | ~/.claude/settings.json or .claude/settings.json | At fixed events: session start, prompt, before and after tool calls | None | Yes, a PreToolUse hook can block a tool call | They run commands on your machine automatically |
| Subagents | ~/.claude/agents/ or .claude/agents/ | Description always, the agent runs in its own context when called | Description in main context; work happens in a separate window | Partly, via tool limits per agent | Extra requests count toward the same usage limits |
| Plugins | Installed from a marketplace (manifest in .claude-plugin/plugin.json) | Their skills, agents, hooks and MCP servers load while enabled | Sum of what they contain | Whatever hooks they ship | Can run code with your user privileges |
Sources: Anthropic Claude Code documentation (memory, skills, hooks, subagents, plugins), read November 30, 2026. Compilation: i10x.
Layer 1: CLAUDE.md, the always-on rules
CLAUDE.md is the project’s standing brief: build commands, coding standards, naming rules. Claude Code loads the files above your working directory at launch, so every line is paid for in every session. Anthropic’s guidance is to stay under 200 lines per file, because longer files consume more context and, in Anthropic’s words, “reduce adherence”. Splitting a long file with @imports does not help, since imported files load together with the file that imports them. What does help is moving rules that apply only to part of the codebase into .claude/rules/ with a path scope, which loads them only when Claude touches matching files.
One more trap: if two rules contradict each other, Claude may pick one arbitrarily. We have reported before how stale CLAUDE.md files override the actual code. Run /context all to see which memory files really loaded.
Layer 2: skills, cheap until used
Skills are folders with a SKILL.md file. Only the name and description sit in context; the full instructions load when Claude decides the skill fits or you call it. That makes skills the cheapest place for long procedures. Two limits matter: each description is cut at 1,536 characters in the listing, and the whole listing gets a budget of about 1% of the model’s context window. When you install too many skills, Claude Code drops the descriptions of the ones you use least, which removes the keywords Claude needs to pick them, and it only notes this in the debug log. /doctor shows what the listing costs.
Layer 3: hooks, the only layer that is not a suggestion
Everything in CLAUDE.md and skills is text the model can ignore. Hooks are not. They are shell commands, HTTP calls or prompts that Claude Code itself runs at fixed points: when a session starts, when you submit a prompt, before and after every tool call. A PreToolUse hook can block a tool call outright, Anthropic’s example blocks rm -rf. So the rule of thumb is simple: if breaking a rule would be expensive, enforce it with a hook, not a sentence. Hooks live in ~/.claude/settings.json for you, or in .claude/settings.json for the whole team, and they cost no context.
Layer 4: subagents, clean context at a price
A subagent is a worker with its own context window, its own system prompt and its own tool permissions. It does the noisy work, such as searching a large codebase or reading logs, and hands back only a summary, which keeps your main conversation clean. But its requests count toward the same usage limits, and its description sits in context like a skill’s (Claude Code warns once your custom descriptions pass 15,000 tokens). A recent study we covered found that parallel coding subagents add 1 to 5 points at up to 3.8 times the cost. Use them for isolation, not as a default.
Layer 5: plugins, where the risk sits
A plugin is a bundle of the other layers (skills, subagents, hooks, MCP servers) installed as one unit from a marketplace. That is convenient, and it is also the layer to be careful with. Anthropic’s plugin overview is blunt: whatever the marketplace tier, “a plugin you install can run code with your user privileges”. And a plugin enabled at project scope is switched on for everyone who clones the repository and installs it.
Anthropic separates official marketplaces (such as claude-plugins-official), community ones and everything else, which counts as third-party, including the roughly 25 repositories currently making the rounds on X. Read the hooks file of any third-party plugin before you install it.
Which layers you actually need
- Solo project, small codebase: a short CLAUDE.md is enough. Add a hook if there is one thing Claude must never do.
- Team repository: CLAUDE.md under 200 lines, path-scoped rules for subfolders, team hooks for tests and formatting in .claude/settings.json.
- Repeated long procedures (release, migration, review checklist): turn them into skills instead of growing CLAUDE.md.
- Large codebases or log-heavy work: one or two subagents for search and analysis, with read-only tools.
- Plugins: only from official marketplaces, or after reading the code. Prefer user or local scope until the team agrees.
What is still open: Anthropic changes these limits often (even the way /context counts skills changed in a recent version), so check /doctor and /context after updates rather than trusting a diagram from last month.






