CLAUDE.md, skill, hook or subagent: which one do you need?

Claude Code has several places to put an instruction. They look alike, but they load at different times, cost different amounts of context, and only some of them are enforced.

The short answer

Start from what went wrong

Anthropic's overview suggests adding each piece when a specific thing keeps happening, not all at once:

CLAUDE.md or skill?

Both hold instructions. CLAUDE.md loads at the start of every session. A skill loads its short description each session and its full text only when it is used. So the question is how often Claude needs it.

The documentation gives a rule of thumb: keep CLAUDE.md under 200 lines, and when it grows, move reference material into skills or into .claude/rules/ files. A rule file with a paths entry in its frontmatter only loads when Claude works on matching files. If you want help trimming, our ten-point CLAUDE.md checklist covers it.

Skill or subagent?

A skill adds its text to your main conversation. A subagent has its own context window and returns only a summary. Use a subagent when the work reads many files and you only want the conclusion. Use a skill when the content should sit next to the conversation.

They also combine: a subagent can preload skills, and a skill can run in an isolated context. See how to write a SKILL.md for the file itself.

Instruction or lock?

This is the one that costs people most. "Never edit .env" in CLAUDE.md or in a skill is a request. The model usually follows it, but nothing stops it. A PreToolUse hook that blocks the edit is enforcement. The documentation says to put guardrails in hooks if a rule has to hold every time.

Two guides on this site cover the enforced side: a starter list of permission rules and three hooks to paste.

What each one costs in context

Four small examples

Limits

This follows Anthropic's "Extend Claude Code" overview as we read it in October 2026. That page is the authority, and we are not affiliated with Anthropic. We wrote this from the documentation and have not tested every claim.

If you want a second pair of eyes on your CLAUDE.md and settings, the Tune-Up Kit is a checklist for exactly that.