How to Fix Claude Code Not Reading Your RULES File - A Debugging Journey

Ever wondered why Claude Code keeps ignoring the rules you carefully wrote in a dedicated RULES file? I found myself in this exact trap today morning. The files were right there. The instructions were clear. But something wasn't clicking.
The Problem: Rules File Not Loading
I had my project structure set up perfectly, with a dedicated RULES file containing all the guidelines I wanted Claude to follow. Yet, Claude seemed completely oblivious to its existence.
Asking Claude Itself for Help
When I asked Claude directly why it didn't read the RULES file, the response was shocking - it claimed the system didn't provide access to that file!
The Cryptic Initial Advice
I pressed further, asking Claude how to get the RULES file loaded. The answer was cryptic at best:
"create a small reminder at the top that's more explicit"
This felt like a hack, and I wasn't satisfied with this solution. There had to be a proper way to make Claude aware of project-specific rules.
Finding the Golden Solution
Determined to find a better way, I decided to dig into the official documentation. And there it was - the golden way to enforce file inclusion in Claude Code!
The Fix: Proper File References
The solution was to properly reference the files using the correct format. Instead of just having a RULES file sitting in the project directory, you need to use the CLAUDE.md file with proper references.
Success: Rules Finally Loading
After making these changes and restarting Claude, I asked about its context again. Ta-da! The rules were finally being loaded and followed.
Key Takeaways
- Use CLAUDE.md: Claude Code specifically looks for a
CLAUDE.md
file in your project root for project-specific instructions - Proper File References: Simply having a RULES file isn't enough - you need to properly reference it in CLAUDE.md
- Documentation is Gold: When Claude's advice seems hacky, dig into the official documentation for the proper solution
- Restart After Changes: After updating your CLAUDE.md file, restart Claude Code to ensure the new context is loaded
The Correct Way to Set Up Project Rules
Based on this debugging journey, here's the proper way to set up project-specific rules for Claude Code:
- Create a
CLAUDE.md
file in your project root - Add your rules directly in this file or reference other rule files
- Use clear, explicit instructions
- Restart Claude Code after making changes
This approach ensures Claude Code properly loads and follows your project-specific guidelines without relying on workarounds or hacks.
Conclusion
Sometimes the most frustrating debugging sessions lead to the most valuable lessons. What seemed like a simple oversight turned into a deep dive into how Claude Code handles project context and rules. Now that I understand the proper way to configure project rules, Claude Code has become an even more powerful development assistant.