What's this Claude.md file about?
It's an important file you should create in any Claude code project you
are working on. And you're also not limited to just one
Claude.md file, but I'll get back to that.
Your Claude code projects should typically at least have one
Claude.md file in the root project folder, and this
file and its content will automatically be loaded into every
new session you create with Claude code.
And also, if you clear the context of a session,
loaded into the newly created context. So what should be in that file?
Well, general rules and general pieces of
information you think are relevant to Claude code.
For example here, the information that we're using Bun and that it
should use Bun for executing the scripts in this
project. That is important. And indeed, there is one change I wanna make
here real quick in this package JSON file.
For the dev server and for building and for start, I'll
execute them with this command here, bun run
--bun to ensure that the Bun runtime gets used for these commands,
because that allows me to then use Bun APIs.
So that's an important piece of information.
We also have some general information about the architecture in there,
see, it's a rather slim and simple file,
and that's deliberately so because, as mentioned,
prompt and therefore it shouldn't be super large because you'll just pollute
your context if you have a lot of information in there.
There are a couple of tweaks I wanna make though.
For example, I'll add, we're building the app
described in @spec.md
to point at this spec.md file, which of course includes a more
detailed description of the app we're building.
And to ensure that Claude will not always read that file, which
is rather large, I'll give it some hint on
at this spec.md file, specifically here when tackling
general architectural tasks or to double-check
the database structure, tech stack, or just application architecture as a
whole. I also have one other instruction I
I want Claude code to give me short replies, no long
essays with lots of code snippets in there because all that
will be tokens I'm paying for and all that will be tokens that
pollute the context as a conversation goes on for
longer. So that's one additional instruction I
Claude.md files. And then there are more tweaks we'll make
throughout this project, but for now that's it.
Now, I did mention that you can have multiple Claude.md files
project, and you can indeed add as many as you want
putting them into subfolders. The important thing there will
just be that those nested Claude.md files will only
be read and loaded by Claude when it works on
files in that subfolder. So if I added a Claude.md
file here in the app folder, the content of this file, this
Claude.md file will be loaded and considered whenever Claude does
work on any file in the app folder, which for this project would very often be
case since a lot of our code will go in there, but you get the
point, and you can have as many levels of nesting
then add your folder-specific Claude.md files
as needed. The core purpose of this Claude.md
file, therefore, simply is to store some
long-term memory that should be accessible across different
sessions and about having those core
instructions that will apply to essentially every prompt