Optimizing Claude Code

Optimizing Claude Code

I was chatting with one of my colleagues and I realized they weren’t getting the most out of the CLAUDE.md files for Claude Code.  I thought I’d take a minute to share four tips that have served me very well.

  1. Create a hierarchy of CLAUDE.md files.  Your personal file is used for all projects, so it should have your personal work style and preferences.  The one in the top level of any project dirtree has project-specific information.  Then you can have them in lower level directories: I typically code microservices in a monorepo, so each of those directories has one specific to that service.
  2. Make it modular. You don’t have to have everything in the CLAUDE.md, it can contain guidance to read other .md files.  Claude understands “modular documentation” so you can ask it to do this, creating a high level file with guidance on when to consult detailed doc files.  This saves you tokens.  Again, this can be hierarchical.
  3. Regularly capture learnings from a “good session”.  When I see I’m getting close to the compaction limit in a particularly productive session, I use this prompt: “Review all of the relevant CLAUDE.md and other .md files and compare them to what you know now.  If you can improve them, please do so.”  This works surprisingly well, though over time the files get pretty long, which leads to my final tip.
  4. Occasionally ask Claude to optimize the CLAUDE.md files.  Tell it to review the file and compact it for ready use but preserve all of the critical information.  This also works quite well.

I hope that helps.  If anyone has any other tips, I’d love to hear them.  I’m always trying to get better at driving LLMs!

This is really helpful thanks for sharing. 🙏 I've started a Group to post my Claude-Code prompting sessions and gather insights from other Claude-Code users. Intro: https://www.garudax.id/feed/update/urn:li:activity:7401603611321159680 Group: https://www.garudax.id/groups/16171006/

Like
Reply

That's a fantastic idea to share your working $CLAUDE.md$ files! It's so helpful to see how others are structuring their project configurations for LLM applications. I'm especially curious about what specific **"Core Principles (Non-Negotiable)"** you've found most critical for robust and predictable Claude Code performance. What's one tip that has made the biggest difference in your workflow? I'd love to try it out!

Like
Reply

To view or add a comment, sign in

More articles by Michael Rothrock

  • Context is Key: The Missing Link in Enterprise Artificial Intelligence

    One of the things my years of working with enterprise systems has shown me is that the value new technology can unlock…

    2 Comments
  • The Agile Journey of AI Integration: Lessons from a CTO

    There is always a gulf between the promise of technology and its delivery. As CTO, part of my job is to watch the…

    2 Comments
  • Sharks and Cowboys

    It's quite the experience, being bitten by a shark. You go directly from the idle joy of splashing in the ocean…

  • No More Heroes

    People say it’s necessary to have a purpose in life. As we age, our priorities and purpose can change, and we…

    2 Comments
  • A Lesson in Resilience

    I consider myself lucky that I am building distributed systems in the modern age. Long gone are the days where we had…

  • Design First, Code Later

    I’m fortunate to work with a team of high performing engineers. They clearly love their craft and are always keen to…

    3 Comments
  • The Real Cost of Software

    As a CTO who specializes in distributed systems, I've had the opportunity to witness firsthand the evolution of the…

    2 Comments

Explore content categories