How to Improve Claude Code Performance with Automated Testing

Claude's code works very well. You can enter a series of commands and it will generate code or other output for you. However, there are a few things you can do to greatly increase the performance of Claude Code, especially when it comes to programming.
In this article, I will talk about the first method that I use every day to make my Claude Code work many times: automatic / active testing.
At first glance, this may sound like a boring topic, but if you read more about it, testing, especially if it is automated or done very efficiently, is a great way to save a lot of time. If you can get the agent to test their usage, that will make them more effective in producing the solution you wanted to create.
Why automatic testing
The number one reason why you should automate testing is that it just makes you more efficient. If you can have an agent check its usage automatically, it will be much better at managing to implement the solution you describe in your notification. Ultimately, this leads to you saving a lot of time because you don't have to talk to the agent multiple times to get the exact solution you're looking for.
In addition, another important point is that now that coding agents have been so effective in generating code, the real barrier to programming has become testing. You need to check if the implementation really works according to what you think. I find that I spend most of my time planning, testing different solutions, and making sure everything works as expected. If you could make testing more efficient or completely automated, that would solve the biggest problem I have with the system, which would make me more efficient.
I believe this applies to many people who fully utilize coding agents to program, and I'm just sharing how I automate them and make my testing more efficient.
How to check automatically
I'm going to talk about a few things about testing. First, I'll talk about automated testing, which is where you give your agent access to run tests on their own. This can happen in many different ways. You can, for example, give it test scripts to run, unit tests to run, or full integration tests. Next, I'll discuss how to make testing with people more effective. Sometimes it is not possible for the code agent to fully perform the test itself. Maybe it needs special context or permissions. Maybe it's a complex action within the UI that you don't want the code agent to do, or the code agent can't do, etc.
Automatic checking of the Agent
Here are the three main steps of automated testing:
- Make sure the agent has all the permissions it needs
- Notify the agent to set up tests and check your usage
- Make sure the test is always running before committing or merging, depending on when you want it to run.
- Make sure all new code gets updated tests and occasionally look at the tests to make sure they work and do what you think they do.
I'll start by discussing how to give an agent access to start testing. The most important point to note here is that you should enable the agent to perform tests. This is done by giving it enough access, for example, maybe it needs access to AWS to access data, or maybe it needs access to a browser to navigate the application. So, the first step here is to make sure that the agent has all the permissions it needs.
In my experience, you can use Code Claude with Dangerously Bypass Permissions or Auto Mode, which was recently released, and it works very well. Unfortunately, when I use other coding agents like Gemini or Chachipetee, I haven't done this yet because I have some experience where coding agents did unintended actions that were irreversible. However, this never happened when I used Claude's models.
The second part of an automated test is to notify the agent to set up the test. For example, I ask my model to set up integration tests. Integration testing is essentially a series of API calls that verify that the application flows as expected. And with coding agents, this works very well. For example, have an LLM wire leading to a classification pipeline and so on. You can automate the process and ensure that the results are correct every time. Simply telling the agent to set up integration tests will work very well; the model will set the tests and actually work better quickly.
You can also ask the model to create test scripts that test the usage and tell it to run that test script to make sure everything works as intended, and not stop until the test script runs successfully. The last part is very important because sometimes the models are lazy, and you need to clearly inform them that they are not allowed to stop before the implementation is successful. This, of course, assumes that use is possible given the permissions and actions you've given the coding agent.
Furthermore, it is also important that you make sure that these tests run before the code is pushed to production. You can run tests like commit hooks before, although this can be slow at times because testing has to start before all commits, and if testing takes some time, it will slow you down. You can also make them run every time you have a push, a new push pull request. That is, if the pull request is updated, then perform integration tests. These tests can also be part of GitHub actions, for example, to run automatically, and you don't have to run them on your computer. However, in my experience, it is often good to have these tests on your computer, as they are quick and easy to set up.
Finally, in the test automation section, I want to highlight how you need to make sure you're always updating your tests given new code is being generated. For example, when you generate a new piece of code, make sure you add new tests for it. And if you remove old code, make sure you remove the corresponding tests. It is important to take care of the tests so that they work effectively. Although this optimization may sound like extra work up front, it will save you time in the long run because you are not running unnecessary tests, and you are making sure that all your code is tested, which reduces the chances of bugs.
In addition, I recommend that you sometimes test the tests yourself by physically looking at the input and output and asking the agent to show you the results. This manual testing of tests can sometimes be very effective in ensuring that tests are working as expected and make it easier to find bugs in tests.
Make manual checks more efficient
The second point in testing that I want to include is to make manual testing more efficient. When I talk about manual testing, I mean testing that requires a human to do, and that cannot be done by AI. Unfortunately, some of the testing has to be done by you, and you can't just outsource it to AI. This can happen for several reasons:
- The task is too difficult for AI to handle, and you need to do it yourself
- The task involves something that the AI does not have access to or your permission. For example, it requires director access that your AI doesn't want to give you, or it uses audio that the AI doesn't currently have access to.
- The task is too difficult for AI to do, and you can't trust it to do it right.
In these cases, the best thing to do is to make the test more efficient for you. Of course, your first instinct when generating tests should always be to try to automate them so you never touch them yourself, and AI always runs them automatically. But honestly, you need to check it out a lot too.
My number one trick to make testing more efficient is to use visual testing. For example, if I have an AI that solves multiple tasks for me, I first have it create an HTML report that includes each task and a checkbox next to these tasks so that I can mark any tasks that are set to be executed. I also tell the AI to provide me with links to pages that contain the content I need to test and an explanation of how to test it to see if it works. This makes the process much easier because I don't have to remember everything I need to test and how to test it. But it was presented to me with caution in the report. You can see an example of this below:

Another point in how I simplify testing is that I try to outsource as much work as possible to the coding agent. For example, if I need some data to test something manually, I don't spend a lot of time manually looking for the data. I ask the code agent to access the necessary resources and get the data for me automatically.
The conclusion
In this article, I've discussed how you can experiment with Claude Code to get the most out of Claude Code or any other writing agent you use. I've talked a lot about how you can automate testing, which is the best way, or you can do manual testing more efficiently. When coding agents are as good as they come, especially after the release of the latest Opus models, I believe testing has become a bottleneck. Whereas before you spent a lot of time writing code by hand, you no longer spend a lot of time writing code, and you spend a lot of time testing the actual implementation. Therefore, it makes sense to try to improve the evaluation process to make it more effective. To increase your efficiency as a programmer, I would focus on the testing part and think about how you can be more efficient there. The techniques I've presented in this article are just a few examples of what I personally do to make testing more effective.
👋 Touch
👉 My Free eBook and Webinar:
🚀 10x Your Engineering with LLMs (Free 3-Day Email Course)
📚 Get my free ebook Vision Language Models
💻 My webinar on Vision Language Models
👉 Find me on social media:
💌 Stack
🐦 X / Twitter
Also, check out my article on How to Grow Claude Cowork.



