Ai Coding 3 min read

How to Manage Claude Code Workflows via CLAUDE.md

Learn how to control Claude Code's agentic behavior using CLAUDE.md files, reusable skills, lifecycle hooks, and isolated subagents.

Anthropic’s new steering guide details how to control Claude Code beyond basic system prompts. Released on June 19, 2026, alongside version 2.1.176, this layered architecture allows you to define rigid repository conventions, automate lifecycle events, and compartmentalize complex tasks. You will learn how to configure context-efficient instructions using a hierarchy of markdown files, skills, hooks, rules, and subagents.

Managing Project Memory with CLAUDE.md

The foundation of your steering architecture is CLAUDE.md. Placed at the root of your repository, this file acts as a persistent constitution loaded at session start. It is memoized and re-read automatically after context compaction. Anthropic recommends keeping the root CLAUDE.md under 200 lines to minimize recurring input costs.

For localized conventions, you can place additional CLAUDE.md files in specific subdirectories. Claude Code loads these on-demand only when interacting with files in that directory. Once the agent stops working in that area, the directory-specific instructions drop from context to save tokens. When navigating large codebases, use the /cd command to change directories without rebuilding the prompt cache. The new directory’s rules append as a message rather than replacing your system prompt.

Defining Reusable Skills

Monolithic system prompts waste tokens. Skills solve this by offering progressive disclosure of instructions. Defined in .claude/skills/<name>/SKILL.md, a skill only loads its name and description at session start. The full procedural workflow loads into context only when triggered autonomously or manually via /name.

Active skills share a token budget within the context window. When this budget fills up, Claude Code drops the oldest invoked skills first. You can read the Skills documentation for details on formatting procedural workflows. If you are deciding how to divide logic, consider the tradeoffs between agent skills and standard instructions.

Enforcing Constraints with Rules and Hooks

When you need absolute compliance, use Rules and Hooks. Rules live in .claude/rules/*.md and define strict constraints, such as requiring Zod validation for all API handlers. Unlike standard memory, rules inject into the prompt cache on every compaction cycle, ensuring the model never forgets them.

Hooks operate as deterministic pipeline machinery that the LLM cannot ignore. You can map shell commands or prompts to lifecycle events like SessionStart, PreToolUse, or PostToolUse. A PreToolUse hook can block a git push if automated tests fail.

Isolating Tasks via Subagents

Complex tasks can quickly fill the main context window with tool-execution logs. Subagents fix this by spinning up specialized instances of Claude Code with isolated contexts and restricted tool access. The main session invokes them using the Agent tool. Once the subagent finishes, only its final summary and metadata return to the primary thread.

Subagents can inherit skills from their parent session or load unique capabilities via frontmatter definitions in .claude/agents/*.md. This pattern is critical when you orchestrate parallel subagents in Claude Code. Reviewing standard multi-agent coordination patterns will help you divide tasks efficiently.

Pricing and Usage Limits

Agentic execution relies on a separate billing structure introduced on June 15, 2026. Standard chat interactions do not consume your agentic quota, but heavy autonomous task execution requires higher tier plans.

Plan TierPriceAgentic Usage Limit
Claude Code Pro$20/monthStandard caps applied
Max 5x$100/month5x base agentic limit
Max 20x$200/month20x base agentic limit

These limits govern how long subagents and skills can run unattended.

Start by extracting your longest generic instructions from your system prompt into isolated skills. Move directory-specific standards into nested CLAUDE.md files to immediately lower your per-turn token usage.

Get Insanely Good at AI

Get Insanely Good at AI

The book for developers who want to understand how AI actually works. LLMs, prompt engineering, RAG, AI agents, and production systems.

Keep Reading