Skip to content

🌐 日本語

Part 4: Conditional Context — Rules ​

NOTE

Injection that activates only when needed.
Conditional distribution keeps Priority Saturation in CLAUDE.md in check.
.claude/rules/ is a representative example in Claude Code. Not loading unused rules all the time is not product-specific.

Why It Exists ​

If you put all rules in CLAUDE.md, then API validation rules are loaded alongside React component conventions, and they compete for attention. .claude/rules/ maximizes the effective density of instructions within a limited context by showing the LLM "only rules relevant to the file being modified."

→ Why: Which Structural Problems Does It Address? ​

IMPORTANT

  • Priority Saturation: Reduces simultaneously active instructions by distributing rules conditionally rather than keeping all rules loaded
  • Lost in the Middle: Injects only necessary rules at the end (high-attention position)

Documentation in This Part ​

DocumentContent
Design Principles of .claude/rules/Why it exists and how to design it
Practical glob Pattern DesignConcrete examples of effective pattern design

Previous: Part 3: Always-Loaded Context
Next: Part 5: On-Demand Context

Released under the CC BY 4.0 License.