Anthropic details seven methods to guide the behavior of Claude Code

Anthropic details seven levers like CLAUDE.md and rules to guide Claude Code, its agentic coding tool, emphasizing deterministic hooks for true guardrails.

Anthropic dedicates a guide to the seven levers that guide the behavior of Claude Code, its agentic coding tool: CLAUDE.md files, rules, skills, subagents, hooks, output styles, and additions to the system prompt. Each is distinguished on three levels: when the instruction enters the context, if it survives long sessions once the conversation is compacted, and what weight it carries on behavior.

The logic contrasts what is always loaded with what is only loaded as needed. A root CLAUDE.md or an unrestricted rule carry team conventions and standards, but cost tokens in each session; skills and subagents are only loaded on use, the latter running in an isolated context to return only a summary; hooks automate deterministically on events, such as running a linter after an edit; output styles and additions to the system prompt, for their part, influence the role and tone.

The most useful point concerns guardrails. According to Anthropic, a "never do that" written in a CLAUDE.md is not one: under pressure, in a long session, or via a prompt injection located in a file read during a task, the model may not adhere to it. A constraint that must truly hold falls under deterministic elements, hooks, permissions, and non-overridable administered settings. Hence the advice to keep CLAUDE.md short and to transfer procedures and constraints to skills and rules.