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.
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.








Leave a Reply