Initialize and create a CLAUDE.md file for Claude Code
Create and initialize a CLAUDE.md file in Claude Code to store coding guidelines and project details for team collaboration.
Lesson Content
Every time Claude Code loads, it checks for a CLAUDE.md file. This is just a plain markdown file containing your coding guidelines, project-specific info, development workflows, API conventions, testing requirements, and anything else you need Claude to know about your project.
If this file does not exist, you can run /init to have Claude Code create one for you. This command will do a quick scan of your current project directory, analyze the related files, and do its best to create a CLAUDE.md file based on its findings.
Note: Along the way, Claude Code may want to execute some bash commands. This is nearly always ok, as it just wants to learn more about your code. So when these pop up, you can just select the “Yes, and don’t ask again” option from the list.
When it’s complete, we can go ahead and review this document. For now, let’s go ahead and just allow Claude to create this file.
After it’s complete, you can just go ahead and open up the file to check it out. It’s important to note that you shouldn’t ever trust what the AI came up with — some of the info could either be wrong, or won’t align with your project specs. Think of CLAUDE.md as a living document written in plain English.
This means that you can update it however you wish. I’ll take a few moments to proceed and make some updates based on my project spec. Treat it like the living, breathing document it is, and don’t be afraid to modify it whenever your specs or needs change.
Anytime you want context to persist through every single session or be retained in a memory, such as:
Teams: When sharing this project across a team, put guidelines here for everyone should follow
Project guidelines: Coding standards, file structures, or naming conventions
Common commands: How to start the development server, deploy code, or test what it wrote
After editing, go ahead and save the file. And then you’ll also want to go ahead and commit this file to version control. Once you’ve committed it, go ahead and push it up stream to sync it with the rest of your team, to keep everyone on the same page:
git add CLAUDE.md
git commit -am "CLAUDE.md file"
git push
Join the discussion!
Comments
Want to comment on this lesson?
Enroll in a premium course or the University for comment access.