CLAUDE.md Configuration Cascade¶
Run the CLAUDE.md Cascade MicroSim Fullscreen
Edit the MicroSim in the p5.js Editor
You can include this MicroSim on your website using the following iframe:
<iframe src="https://yarmoluk.github.io/Digital-Transformation-with-AI-Spring-2026/sims/claude-md-hierarchy/main.html" height="612px" width="100%" scrolling="no"></iframe>
Description¶
This MicroSim demonstrates how CLAUDE.md configuration files work in Claude Code — Anthropic's AI coding assistant. CLAUDE.md files act like .editorconfig or .eslintrc but for AI behavior, telling Claude what conventions, constraints, and preferences to follow.
The 4-Layer Cascade¶
Rules are loaded in this order, with each layer adding to (and potentially overriding) the previous:
| Order | Layer | Path | Scope |
|---|---|---|---|
| 1 | Enterprise | /etc/claude/CLAUDE.md |
Organization-wide policies |
| 2 | User | ~/.claude/CLAUDE.md |
Personal global preferences |
| 3 | Project | <repo>/CLAUDE.md |
Repository-specific conventions |
| 4 | Local | <repo>/.claude/CLAUDE.md |
Machine-specific overrides (gitignored) |
How to Use¶
- Click any project tile on a computer in the left panel
- Click "Next Layer" to step through each cascade level
- Observe how rules accumulate from enterprise down to local
- Compare the same project across different computers to see how enterprise and local rules differ
- Use "Auto Play" to watch the full cascade animate automatically
Key Insights¶
- Enterprise rules exist on Work Laptop and Cloud Server but not Home Desktop (personal machine)
- Project rules are identical across all computers (they live in the repo and are version-controlled)
- User rules differ per computer (personal preferences for each environment)
- Local overrides are machine-specific (development vs. production settings) and typically gitignored
Lesson Plan¶
Learning Objectives¶
- Explain the 4-layer CLAUDE.md hierarchy and the order rules are loaded
- Compare how the same project has different effective configurations on different machines
- Identify which layer is appropriate for different types of rules
- Predict the final set of active rules for a given computer + project combination
Target Audience¶
Graduate students in digital transformation, software engineering, or AI courses. Also suitable for professional developers learning Claude Code.
Prerequisites¶
- Basic understanding of configuration files (
.gitconfig,.eslintrc, etc.) - Familiarity with the concept of AI coding assistants
Activities¶
- Predict and Verify: Before clicking "Next Layer," predict what rules will appear at each level. Then reveal to check.
- Compare Environments: Select the same project (e.g., "API Service") on all three computers. Note which rules are consistent and which differ. Why?
- Design Your Own: After exploring, write your own CLAUDE.md rules for each layer for a hypothetical project. What belongs at enterprise vs. local level?
- Discussion: Why are local overrides gitignored? What would happen if machine-specific configurations were committed to the repository?
Assessment¶
- A developer wants to ensure no one on the team pushes directly to main. Which layer should this rule go in?
- You prefer dark mode output on your home machine only. Which layer?
- The project uses React 19. Which layer?
- Your laptop uses GPU 0 for ML training, but the cloud server uses all 4 GPUs. Which layer for each?
References¶
- Claude Code Documentation - Anthropic - Official documentation for Claude Code including CLAUDE.md configuration
- Configuration Files (Wikipedia) - Overview of configuration file patterns and cascading precedence in software systems
- EditorConfig - A similar cascading configuration system for code editors that follows the same enterprise → user → project pattern
- 12-Factor App: Config - Best practices for separating configuration from code, relevant to understanding why local overrides are gitignored