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
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)
Related articles:
- DynatraceがAI Coding Agent監視を拡張:Claude Code・Gemini CLI・Codex CLIをOpenTelemetryで可視化
- 「AIが自らを作る」と予言した8日後、『Claude Fable 5』は消えた――【生成AIストリーム】
- 【AI駆動開発】AIに「図を描いて」と頼むと“それっぽいけど使えない図”が出てくる問題を、draw.io生成スキルで倒した – Qiita
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.
Related new article:
- 4239 – This published update adds current operational context for Steering Claude Code: skills, hooks, subagents and more | Claude.
- 4285 – This published update adds current operational context for Steering Claude Code: skills, hooks, subagents and more | Claude.
- 4308 – This published update adds current operational context for Steering Claude Code: skills, hooks, subagents and more | Claude.
- Essential Prompt Techniques to Unlock Gemini’s Full Potential – This published update adds current operational context for Mastering Claude Code: 7 Ways to Steer Behavior with CLAUDE.md, Skills, Hooks, Subagents and More.
- Introducing Claude Tag: Make Claude a Proactive Team Member in Slack Channels – This published update adds current operational context for Mastering Claude Code: 7 Ways to Steer Behavior with CLAUDE.md, Skills, Hooks, Subagents and More.
- Why “Context Design Power” Matters in the AI Agent Era — From Prompts to Business Process Design – This published update adds current operational context for Mastering Claude Code: 7 Ways to Steer Behavior with CLAUDE.md, Skills, Hooks, Subagents and More.
- Trying Codex Record & Replay to Turn Workflows into Reusable Skills – This published update adds current operational context for Mastering Claude Code: 7 Ways to Steer Behavior with CLAUDE.md, Skills, Hooks, Subagents and More.
- Terminally Ill Woman’s Final AI Dialogue Recorded by NHK — A Moving Story – This published update adds current operational context for Mastering Claude Code: 7 Ways to Steer Behavior with CLAUDE.md, Skills, Hooks, Subagents and More.
- Injecting “7 Ruthless QA Personas” into Claude Code to Plug Test Case Blind Spots – This published update adds current operational context for Mastering Claude Code: 7 Ways to Steer Behavior with CLAUDE.md, Skills, Hooks, Subagents and More.
- leaf TUI Tool for Rich Terminal Markdown Preview: Features and Usage – This published update adds current operational context for Mastering Claude Code: 7 Ways to Steer Behavior with CLAUDE.md, Skills, Hooks, Subagents and More.
- Automating SLO Violation Investigation with Claude Code Skills – This published update adds current operational context for Mastering Claude Code: 7 Ways to Steer Behavior with CLAUDE.md, Skills, Hooks, Subagents and More.
- Stop Misusing Claude Code — Official Best Practices for Correct Usage – This published update adds current operational context for Mastering Claude Code: 7 Ways to Steer Behavior with CLAUDE.md, Skills, Hooks, Subagents and More.
- Copilot in Excel Personalization and Workbook Rules Let You Customize AI Excel Operations to Your Style – This published update adds current operational context for Mastering Claude Code: 7 Ways to Steer Behavior with CLAUDE.md, Skills, Hooks, Subagents and More.
- cc-rsg-web: Reverse-Generate Specs from Code — Turning Legacy Codebases into Maintainable Assets with Claude Code – This published update adds current operational context for Mastering Claude Code: 7 Ways to Steer Behavior with CLAUDE.md, Skills, Hooks, Subagents and More.
- Claude Code Setup plugin: codebase-aware hooks, MCP, skills recommendations – This published update adds current operational context for Mastering Claude Code: 7 Ways to Steer Behavior with CLAUDE.md, Skills, Hooks, Subagents and More.
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.
🔥 Most Popular
- Claude Desktop Won't Install? Windows & Mac Fixes That Worked (2026)
- Claude Pricing: Free, Pro, Max & Team Plans Compared (August 2026)
- Claude Cowork Automation — 5 Real Use Cases (2026)
- AI Code Editor Comparison 2026: 6 Tools Tested, Why I Use Zed + Claude Code
- How to Reduce Verbose Claude Code Comments with WHY Rules (2026)













Leave a Reply