iTranslated by AI
Essential Practices for Practical Claude Code Usage
I have introduced Claude Code into my personal projects, and it has been delivering great results. Currently, I have Claude Code handle almost all of the implementation.
In the process, I’ve identified several points where I feel that if you don't do these things, you haven't even reached the starting line for using Claude Code. Let me share them here.
Let it do everything a developer can do
Claude Code is, after all, an AI. No matter how much you enrich CLAUDE.md or how well you write your prompts, it won't perform perfect work every time.
In light of this, think back to what a developer does before committing code of acceptable quality.
- Fix any errors or warnings shown in the editor
- Run a formatter upon saving
- Confirm that the application at least runs and basic operation is verified
If you want to demand a minimum level of quality from Claude Code and avoid unnecessary back-and-forth, it is important to provide an environment where it can perform these basic tasks.
Fortunately, Claude Code runs locally, so it often has an environment similar to yours. However, Claude Code executes everything via the CLI. Therefore, there might be things you rely on your editor for that cannot actually be executed via the CLI. Make sure to check if it can truly perform the same actions you do.
Also, be careful if you are using WSL on Windows or if you have set up a separate server to interact via GitHub issues, as the environment might not match yours at all.
If these things are guaranteed, adding instructions like the following to CLAUDE.md increases the likelihood that it will resolve issues before reporting completion.
- Format updated files
- Confirm that the final build is successful
Enable it to run tests
Always make it confirm that tests pass before reporting completion.
- Confirm that relevant tests pass at the end
Of course, as mentioned earlier, you need to provide an environment where Claude Code can execute the tests.
If you can't do that, Claude Code ends up being a low-quality tool where it creates "gamble code" that may or may not work, and you'll have to send back wasteful correction requests.
By utilizing tests, you eliminate code built on mere intuition and increase the possibility of guaranteeing expected behavior. This significantly raises the probability of receiving a completion report that maintains a minimum level of quality.
Don't bloat CLAUDE.md unnecessarily
CLAUDE.md is certainly important for helping the AI grasp key instructions and the overall structure of the project.
However, it's still just an AI, and it cannot perfectly maintain full awareness of every single context at all times. Additionally, it will end up containing a lot of information irrelevant to the task you want it to do right now.
Ultimately, AI coding works most effectively by focusing on the very last set of instructions provided. If you want it to work accurately, instead of cramming everything into CLAUDE.md, you should break out specific instruction documents as needed.
Create instruction documents
Prepare instruction documents in Markdown for the specific tasks you want it to perform. For example, if you are adding an API endpoint, it's helpful to write down:
- How to add routing
- How to add controller actions
- How to add use cases accessed from actions
- How to manipulate the DB within a use case
- Naming conventions for each
It will do a nearly perfect job if you also include samples of what each file should look like.
If you issue instructions by specifying this created document using the @ symbol, it will read the content and proceed accordingly. Conversely, this might eliminate the need to include that information in CLAUDE.md, which can lead to a leaner CLAUDE.md.
This method is convenient because if you have created "Instant Rules" in Cursor, you can often use them as they are (though it's currently a bit tedious because hidden folders cannot be specified with @, so you have to provide the full path).
Give instructions in small chunks
If you try to have it build a huge feature all at once, there will be many parts that differ from your expectations, leading to a significant amount of rework for corrections.
In practice, I think efficiency increases when you experiment to determine an appropriate size and then request tasks within that scope.
With smaller sizes, any mistakes are easy to fix, and even if you make a mistake in your instructions that leads to an odd implementation, correcting it isn't that difficult.
If the task is too large, finding the mistakes becomes difficult, and the time required for correction instructions increases, making it quite a burden.
Conclusion
I've written about things that I personally felt were the bare minimum after using it in practice.
I believe this knowledge is applicable not only to Claude Code but also to other autonomous AI agents. If you're concerned about things not going well in your projects, please review the environment where the AI is working hard. Be careful not to let the AI feel like, "Humans are just complaining when I can't even check the behavior, so there's no way I can deliver perfect quality! 😭😭"
In fact, if Copilot or Cursor's Agents become capable of command execution in the same way, their autonomy would strengthen significantly, potentially even making Claude Code unnecessary. However, at the moment, they don't seem to have very good integration with the CLI, so I'm looking forward to improvements in that area.
Discussion