00:00Hey there
00:00On today's video, I'm going to show you how to properly set up your claude.md file
00:07And for this video, I'm going to assume that you already have Claude Code installed
00:14You already ran the terminal set up, already connected to your account
00:19You are ready to go with Cloud Code
00:22How do you start writing the perfect instructions for Claude? The number one step is the most obvious one
00:30You're going to run the init command
00:33So taking my open source project as an example
00:36Claude, I do trust this folder and then forward slash in it
00:42Claude is going to take a highle overview of your entire codebase and generate a summary inside claude.md
00:53And this command can take a while
00:53So feel free to drink some coffee while you wait
00:58And you can see that I'm already approaching my usage limit because I have been coding the entire morning
01:02By the way, I am on the pro plan, which costs $20 per month
01:08This is a big misconception that people have
01:11They think, "Oh, I would love to use Cloud Code, but it's so expensive because you pay per use." No, that's not true
01:17You can pay per usage if you want to
01:21This way, you can simply add your API key here and you're going to pay as you go, but I don't feel comfortable doing that
01:33I prefer having a predictable billing cycle at the end of the month
01:36So with the prop plan what happens is once you achieve your usage limit then for the next 5 hours you can no longer use claude code but after those 5 hours your limits reset and then you can keep using it
01:56So you can have like a deep three hours long coding session, then pause, go to the gym, leave your house, drink some coffee, work on other non-technical things, wash some dishes, and then once you go back, you can go back to your coding session
02:15Anyways, I do want to change my cloud
02:18MD file, please
02:18So if you open that file, you can see that it's very generic
02:27We have a couple of basic commands, the overall text st key directories
02:33Now, this is great, but it's missing some key information, which is how do AI test and check your code once it finishes writing it
02:43That's where the format and check scripts come into play
02:50you're going to add in your Claude MD file to always run format command once it finishes generating the code
02:57This way, you have 100% guarantee that the code is formatted
03:02And after that, you're going to run your check script to make sure there are no errors or warnings
03:10And this applies to any text
03:13Take for example my personal website
03:15That's a Nex.js app
03:15My format command is using the biome CLI and then my check command runs the linked from biome and then type check which is essentially the TSC
03:30So here I'm checking for lint errors and type errors on this more complex project that I'm working on
03:37I'm using inertia and elixir
03:40So how do I format the code? I created a custom script that runs mix format responsible for formatting the elixir code
03:49And then I also created a format command inside my package.json which is responsible for formatting also the react code
04:00So if I go on the terminal and run mix format.all, I am literally going to format the entire text tag, not only elixir but also react
04:11And I'm also using biome as my formatter here because I think it's much simpler
04:16Then on this inertia project, the check script is fairly complex
04:24First of all, I want to check if my elixir code is formatted
04:26Then I want to run the type check command on my assets folder
04:34Then I want to lint my code
04:38Check if there are unused dependencies in Elixir
04:40Check if there are any errors or warnings in my elixir code and then check if the code quality from elixir is trash
04:52Once you have these two custom scripts, then you can go back to your cloud
04:59MDE file and then write a section about hey always run mix format or npm run format after you write code and only after that you're going to run your check script
05:14The order matters here because if you run format after the check you're always going to get a warning for hey the code is not formatted and then you're going to have to format and then run check for a second time
05:27So always format first and I have the same text for my Nex.js app
05:34The only difference is the command that I'm running on the CLI
05:36So going back to text cool here, you can either type it manually or you can ask claude to write it for you
05:45So going back to my claude in the terminal, I'm going to say remove all the commands section because I honestly think those commands are unnecessary
05:55Claude can simply read my mix file and find out which scripts I have
06:00So I think it's unnecessary and add that you need to run mix format after changing any code and after that run mix check to verify if there are any errors on compilation or improve
06:29improvement to make in the code
06:33Let's let Claude cook
06:33Done
06:33Let's see the final result
06:37Well, that was simple
06:40Just a tiny section
06:40Mix format
06:44Mix check
06:44Then mix format ensures consistent code formatting and check verifies for compilation and checks for improvements
06:53Perfect
06:53And because tech school is just a purely elixir project with no react on the front end, the check script is much simpler
07:01Now the final step claude is now able to generate code, format it, check for warnings or errors
07:11But how about testing the code? How about running commands, opening a browser, clicking around to make sure the front end is working? That's where MCPs steps in
07:26They're different for every tech stack, but my personal preference for Elixir is using Tidewave
07:33And if I have a React front end, I also like adding Playright DMCP to open a Chrome browser and then let Claude click around
07:43Going back to my Nex.js website, you can see at the bottom MCB tools
07:49I actually have another one very cool called context 7
07:56I made a video about it which is the best MCP for fetching updated documentation
08:01So here I am telling Claude that he can use these two tools and here I'm just showing that they exist
08:12But on my inertia project for example I enforce it
08:15So I'm very strict here
08:19Unlike run format, run check
08:19If you change any elixir code, run the tidewave MCP
08:26If you need updated documentation, run contact 7
08:29And if you need to test any front-end changes, so if you changed any React file, then please use the playright MCP
08:38And to make testing even easier, I created a route that is dev only where Claude can go to for/xray slash whatever username and I'm going to log in Claude for that user
08:53So let's say that I'm testing a feature that only works for authenticated users
09:00Then I'm going to say, "Hey Claude, go to X-Ray/D Daniel to log in as me and then test the feature." With MCPs in place and the format and check scripts, you are good to go to use Claude as a fullblown agent
09:21Now Claude has access to every tool it needs to be truly productive
09:28And this way it can finish the entire job and you just hop in to review the code and optionally manually test on your end as well
09:38But those are my pro tips on how to better leverage Claude code and how to create the perfect claude.md file
09:46That's it for today
09:50Hope you guys enjoyed the video
09:50See you next time.