Claude Code is an AI coding assistant that significantly streamlines developers’ workflows. According to the official documentation, there are seven methods for instructing Claude’s behavior: CLAUDE.md files, rules, skills, subagents, hooks, output styles, and system prompts. These methods differ in context loading timing, persistence through compaction, and token costs, making it important to choose the right one for each use case.

📑Table of Contents
  1. Role and Usage of CLAUDE.md Files
  2. Differences and Use Cases for Skills and Hooks
  3. Effective Configuration for Subagents and Rules
  4. Comparison Table of Methods (Loading Timing, Cost, Use Cases)
  5. Practical Decision Framework
  6. Frequently Asked Questions (FAQ)
  7. Summary

Role and Usage of CLAUDE.md Files

CLAUDE.md files placed at the project root are automatically loaded at the start of every session and remain in context throughout. They are ideal for persistent instructions such as build commands, directory structures, and team conventions because they are memoized and re-read after compaction.

Subdirectory versions of CLAUDE.md are loaded on-demand when Claude reads a file in that directory. While they have lower context cost, they are lost after compaction until the subdirectory is touched again. The official blog recommends keeping CLAUDE.md under 200 lines, assigning an owner, and reviewing changes like code.

Source: Claude Official Blog (as of June 2026)


Differences and Use Cases for Skills and Hooks

Skills define specific tasks or domain knowledge. Only the name and description load at session start; the full body loads when the skill is invoked. This keeps context costs low while adding expertise, making them effective for procedural workflows like code reviews or deployment checklists.

Hooks customize behavior through event triggers and bypass compaction entirely for persistent operation. They are suited for workflow automation such as running linters, posting to Slack, or backing up chat history on PreCompact events.


Effective Configuration for Subagents and Rules

Subagents run as independent agents in parallel with their own isolated context, returning only summaries to the main session. They are ideal for large project decomposition, deep searches, or log analysis with low main-context cost.

Rules impose persistent constraints. They load at session start and are re-injected on compaction. Path-scoped rules allow constraints to apply only to specific directories or files, such as enforcing Zod validation on all API handlers.


Comparison Table of Methods (Loading Timing, Cost, Use Cases)

Method Loading Timing Compaction Behavior Context Cost Main Use Cases
CLAUDE.md (root) Session start Memoized & cached High Build commands, team conventions
CLAUDE.md (subdir) On-demand Lost until touched Low Subdirectory-specific work
Skills When invoked Sustained Medium Procedural tasks, domain knowledge
Hooks Event trigger Bypasses compaction Low Workflow automation
Subagents Parallel execution Independent Medium Large project splitting
Rules Always / path-scoped Re-injected Low Enforcing coding conventions
Output Styles Output time Session only Low Format standardization

Source: Claude Official Blog (as of June 2026)


Practical Decision Framework

Follow the official framework: choose based on whether persistence is needed, context cost should be minimized, or event-driven behavior is required. Combining multiple methods maximizes flexibility. For example, use root CLAUDE.md for team norms, skills for procedures, and hooks for automation.


Frequently Asked Questions (FAQ)

Q1. What is the difference between CLAUDE.md and skills?

A. CLAUDE.md is always loaded at session start, while skills load their full content only when invoked. The balance of cost and persistence differs.

Q2. How do I set up Hooks?

A. Place configuration files in the .claude/hooks/ directory and bind them to lifecycle events. The key feature is bypassing compaction.

Q3. What are the benefits of using Subagents?

A. They enable parallel processing in isolated contexts, reducing token costs in the main session. Effective for splitting large tasks.

Q4. Which methods persist through compaction?

A. Root CLAUDE.md, Rules, Hooks, and some Skills have compaction resistance. Refer to the official comparison table for details.

Q5. Which method minimizes token cost?

A. Subdirectory CLAUDE.md, Hooks, and path-scoped Rules are low-cost. Prioritize on-demand loading for non-essential instructions.

Q6. Which method is best for enforcing team conventions?

A. Root CLAUDE.md or path-scoped Rules work best. Assign an owner and review periodically as recommended.

Q7. Can multiple methods be used together?

A. Yes. Combining them improves flexibility. Example: overall view with CLAUDE.md, procedures with skills, automation with hooks.


Related articles:

Summary

Understanding and appropriately using Claude Code customization methods can greatly improve development productivity. Choose according to project scale and team structure based on the official documentation. For more details, see the Claude Official Blog.

krona23

Author

krona23

Over 20 years in the IT industry, serving as Division Head and CTO at multiple companies running large-scale web services in Japan. Experienced across Windows, iOS, Android, and web development. Currently focused on AI-native transformation. At DevGENT, sharing practical guides on AI code editors, automation tools, and LLMs in three languages.

DevGENT about →

Leave a Reply

Trending

Discover more from DevGENT

Subscribe now to keep reading and get access to the full archive.

Continue reading