The official article says both Rules and Skills can be scoped to load only in specific contexts — how should you actually choose between them?
The key difference lies in the nature of the content, not the loading mechanism itself. A path-scoped rule fits a specific constraint that fits in a single sentence — something like "migration files are append-only, never modify existing content," controlled by the paths field in the frontmatter for when it loads. A Skill fits procedural instructions with steps that need to unfold into a process — a full deployment checklist, for instance. The official article's concrete criterion: if you find yourself cramming a thirty-line procedure into CLAUDE.md (or trying to force it into rules), that's the signal it belongs in a skill instead — rules are meant to handle a concrete constraint that applies across multiple, but not all, corners of the codebase, not a complete operational procedure.
How are the prompt and agent hook types substantively different from the other deterministic types, and why does the official article specifically call them out?
The official article explicitly states that command, HTTP, and mcp_tool are deterministic types — meaning that as long as the Trigger Condition is met, they do exactly the same thing every time, fully predictable in behavior. The prompt and agent types, by contrast, rely on Claude's own judgment to determine the output, rather than a fixed rule set. This means that although all five are called "hooks," only the first three genuinely deliver the "deterministic guarantee" the hook mechanism was originally meant to provide — the latter two are, in essence, closer to "making an extra call to Claude at a certain point in the lifecycle to make a judgment call." Their reliability tier is actually closer to a Skill or an instruction than a genuine deterministic guardrail.
This distinction matters because if your need is "this must happen every single time, no exceptions" (blocking a dangerous command, say), you should choose a deterministic hook type like command or HTTP. If your need is "at a certain point, I want Claude to make one extra judgment about the current situation," a prompt or agent hook fits — but that usage is, in essence, quite similar to just inserting a judgment step directly into the process, and it shouldn't be treated as a genuinely "guaranteed to happen" guardrail.
Subagents can nest up to five levels deep, and the article mentions dynamic workflows orchestrating tens to hundreds of background agents — how does collaboration at that scale avoid flooding context?
The key is a specific design detail the official article points out: the orchestration plan and intermediate results live in script variables, not in Claude's Context Window. This means that when a workflow needs to coordinate tens or even hundreds of background agents, the main Claude instance responsible for coordination doesn't need to read every Subagent's full execution detail into its own context — it only needs summary-level information like which subagents are currently running and each one's status. The actual execution detail stays inside each subagent's own isolated context, without contaminating each other.
This is also exactly why subagent isolation matters so much at scale: without this layer of isolation, simply reading every subagent's intermediate output into the main context while coordinating dozens of subagents would be enough on its own to flood the context and crowd out the space actually needed for coordination decisions. Keeping intermediate results in script variables rather than the model's context is the key design that lets this kind of large-scale collaboration remain scalable without sacrificing instructional fidelity.
If my current project already has a long CLAUDE.md mixing together all kinds of different instructions, how should I start sorting it out?
A more efficient approach is to sort every piece of content in CLAUDE.md against the criteria table the official article provides. First ask: "is this a fact Claude should hold essentially all the time, or something only needed in a specific context?" If it's the latter, ask further: "is this a concrete constraint that fits in a single sentence, or does it need to unfold into a multi-step procedure?" The former (a concrete constraint) fits moving into path-scoped rules; the latter (a multi-step procedure) fits moving into a Skill. What genuinely belongs staying in CLAUDE.md should only be facts Claude should hold at all times — build commands, directory layout, core conventions the whole team follows.
Another signal worth checking for is any rule that says "absolutely must not be violated." If CLAUDE.md contains any rule at that level of seriousness — where failing to follow it has real, significant consequences — that rule shouldn't sit at the instruction level alone; it should be paired with a hook (a PreToolUse hook, for instance, which can inspect a tool call and exit with code 2 to Block it directly), upgrading that constraint from "a suggestion hoped to be followed" to "a deterministically enforced guardrail." The official article also notes that a common problem with a team-shared CLAUDE.md is that nobody genuinely owns the file, so content just keeps piling up with nothing ever cleaned out — it's worth assigning an owner to CLAUDE.md and reviewing changes to it the way you'd review code, to keep it from expanding indefinitely.
An Anthropic blog post published in June 2026 systematically maps out the seven methods for steering Claude's behavior in Claude Code: CLAUDE.md files, rules, skills, subagents, hooks, output styles, and appending the System Prompt. These seven methods look like they overlap in places, but each actually maps to three distinct decision axes: when an instruction loads into context, whether it survives conversation Compaction, and how much authority it carries.
Every method trades context cost against authority. A root CLAUDE.md file loads at session start and stays in context for the entire session — even if a given line isn't relevant to the current task, it still gets read in, meaning its context cost is high, making it a fit for facts Claude should hold essentially all the time: build commands, directory layout, project conventions. By contrast, a CLAUDE.md file in a subdirectory loads on demand, only when Claude actually reads a file under that subdirectory, and isn't retained through compaction — its context cost is much lower, making it a fit for conventions specific to just that one subdirectory.
Rules live in .claude/rules/, split into unscoped and path-scoped. Unscoped rules behave much like CLAUDE.md — loaded at session start, re-injected on compaction. Path-scoped rules use a paths field in the frontmatter and only load when Claude actually touches a file matching that path, making them a fit for specific constraints that apply only to a certain directory or file type — something like "all API handlers must validate input with Zod."
Skills live in .claude/skills/; only the name and description preload at session start, and the full body loads once the Skill is actually invoked (whether via a slash command or auto-matched to the task). On compaction, invoked skills get re-injected up to a shared budget across all invoked skills, with the oldest dropped first once that budget's used up. This makes skills a fit for procedural instructions — a deploy workflow, a release checklist — things you want to see play out step by step in the main thread, where you can intervene and adjust at any point.
Subagents live in .claude/agents/ and look similar to skills on the surface — same preloading of name, description, and tool list at session start — but the key difference is that the much larger instructional content in a Subagent's body never auto-loads and never actually enters the main conversation's context at all. Claude calls it via the Agent tool, passing in a prompt string, and the subagent then runs in its own fresh, isolated Context Window — only its final message (often an aggregated result) plus metadata gets returned to the main session. This isolation is exactly the deciding factor for choosing a subagent over a skill: if a side task (deep search, a log analysis pass, a dependency audit) produces intermediate results you'll never reference again afterward, use a subagent so those details never touch the main conversation; if you want the whole procedure to play out inside the main thread where you can see and steer each step, use a skill instead.
Hooks are user-defined commands, HTTP endpoints, or LLM prompts triggered by specific events in Claude's lifecycle (a file edit, a tool call, session start), and can be registered in settings.json, managed policy settings, or a skill/agent's frontmatter. Hooks split into five types — command, HTTP, mcp_tool, prompt, and agent — with the first three executing deterministically, while the latter two (prompt and agent) rely on Claude's own judgment rather than a fixed rule set to determine the output. Hooks carry a low context cost, since the configuration or instruction itself lives outside the main context; most hooks' output isn't saved into the main context window unless the configuration explicitly returns it (a blocking hook's stderr, for instance, does get saved into context so Claude knows why a call was denied).
The official post directly names several common misuse patterns worth checking your own setup against. If you're writing "every time X, always do Y" in CLAUDE.md for behavior that should happen reliably (running a formatter after every edit, say), you should use a hook instead of an instruction — the model choosing to run a formatter is a fundamentally different level of reliability than the formatter running automatically. If you're writing "never do this" in CLAUDE.md, that's also a sign of the wrong tool: an instruction gets followed most of the time, but the model can fail to follow a prompted rule under pressure, in a long session, in an ambiguous situation, or when a Prompt Injection is hidden in a file it read as part of a task. A real guardrail needs to be deterministic — that means hooks and permissions, and managed settings go even further, deployed by an admin and unable to be overridden by a user's local config, the only way to actually enforce a deterministic, organization-wide guardrail. And if you've crammed a thirty-line procedure into CLAUDE.md, that content belongs in a skill instead — CLAUDE.md is for facts Claude should hold at all times, not a procedure that only needs to unfold in a specific situation. Before adding your next instruction, running it through this decision criteria table first is usually far more efficient than discovering later that an instruction wasn't reliably followed, or that context got flooded with irrelevant content, and having to fix it after the fact.