AI code overturned countless times, and I found that as long as these 3 steps are done in advance, bugs will be reduced by 80%.

From “100,000 lines of code are all bugs” to “the submission process is a one-time process”, the author used a three-week history of blood and tears to summarize a three-step method of AI programming to prevent rollovers: locate first, then understand, and then output. As long as the AI understands the context thoroughly, the bug rate will be reduced by 80%. If you’re also using Cursor or Claude Code, this article is your guide to pitfalls.

Recently, most of my energy has been focused on the development of the 2.0 version of the “Prompt Management Assistant”, and I have been working hard with my good partners Claude Code and Cursor.

Last night, I finally completed the pre-launch testing link, packaged it and submitted it for review, and now I am waiting for Google to pass the review and meet with you~

This iteration is the most time-consuming and difficult in my current AI programming.

During the development of the 2.0 version of the “Prompt Management Assistant”, I summarized the things I did the most: writing bugs and correcting bugs.

In the first two weeks, I completely listened to AI’s architecture changes, and wrote 100,000 lines of code full of bugs.

As a result, I didn’t gain anything and consumed 40 dollars of tokens…

I can only start over from the beginning, I gritted my teeth to cheer myself up, you can, continue to liver.

Then I continued to iterate on my programming methods with claude code and cursor to reduce the frequency of bugs as much as possible.

The moment I finished packing and submitting the review, I felt relieved, and finally made it, and I could still do a lot of things with my AI partners.

To achieve these three challenges, product managers will only continue to appreciate
Good product managers are very scarce, and product managers who understand users, business, and data are still in demand when they go out of the Internet. On the contrary, if you only do simple communication, inefficient execution, and shallow thinking, I am afraid that you will not be able to go through the torrent of the next 3-5 years.

View details >

Two days ago, I shared with you the overall programming idea of Claude Code, and this time I would like to focus more on a more critical issue:

How can AI programming write fewer bugs and make development more efficient?

To truly solve the problem of high bug rate in AI programming, we must first figure out why it makes mistakes in the process of writing code.

Taking the “prompt management assistant” as an example, I have experienced the whole process from almost no bugs to writing something.

In the early days of developing with cursor, there were very few bugs. cursor development is all through one version, and then I just tinkered with some details.

As the functionality increases, so does the amount of code, and the corresponding bug rate increases a lot.

The most obvious thing is that after version 1.6.6, I want to optimize the authorization problem of Feishu, and after two hours, I didn’t change anything except make it more difficult to use…

The larger the project and the more code it is, the more difficult it is for AI to accurately understand the existing logical structure, and bugs will appear more frequently.

In the final analysis, it is actually insufficient contextual information, resulting in AI not being able to correctly complete the corresponding task.

In fact, as long as we can find a way to get enough context for the AI to write code, the bugs will be reduced a lot.

So I began to adjust the way I collaborated with AI, and after getting a requirement, I didn’t rush to let it write code, but followed this process:

1. Locate the code location: First, let the AI find out all the code related to this requirement and clearly explain where these code files are stored.

2. Understand the logic: Figure out how existing features work and where they need to intervene.

3. Output plan: Start writing code and get the requirements

The focus of the first two steps is to let the AI see the current situation clearly and provide more contextual information.

When AI has enough contextual information and then writes code, the success rate will be high and the bugs will be greatly reduced.

In the development progress of the 2.0 version of prompt management, I also adopted this method, compared with the previous development efficiency has improved too much, or there are so many new features and architecture adjustments, I can’t finish it at all…

So how easy is this process? I picked two cases where I stepped on the pit with my own hands and later relied on it to rescue it, and take you to experience its silkiness.

1. Cursor case: Bug fix for version number management

This is a small bug, mainly because I moved too much when adjusting the architecture, causing my version number management file to seem to have been deleted by mistake, and the existing version management logic does not match the old one.

Step 1: Use Cursor to quickly locate the file

I need cursor to help me fix this, so I first asked it to find the corresponding file:

Cursor looked up the corresponding code and told me which files are controlled by the current new and what the current logic is.

Step 2: Sort out the logic with Cursor

Then continue to discuss with cursor to come up with a logic for feature development.

Step 3: Let Cursor generate a repair plan

If you make sure that the cursor is understood, just let it develop.

Then I tested the effect and changed it without any problems.

2. Claude code: Prompt word addition, deletion, modification, and bug fix

This is a huge bug, and it took me several days to fix it.

When I wrote code before, I let AI play too much, so it made 3 sets of systems for me to add, delete, and change the prompt, resulting in more bugs being superimposed each time I made subsequent modifications.

Step 1: Let Claude code locate the file

So I need claude code to help me solve this problem completely, and let it locate the problem first:

Because of this bug, I changed it all afternoon and I really didn’t fix it, this time I directly used the command from the “AI Collaborative Coach” prompt word to let the claude code read the logic of this piece in full first.

Then Claude Code worked hard for a long time and gave me a document that basically covered all the logic in this scenario.

Step 2: Sort out the logic with Claude Code

Then I continued the discussion with it and asked it to give me a detailed flowchart.

Step 3: Let Claude Code generate a fix

Based on the flowchart, let it sort out the cause of the current bug and then fix it.

Finally passed once, it was not easy.

These two cases are small and large, but their essence is the same: to help AI see the current situation clearly and give AI more context, so that it can become more reliable when writing code and reduce code rate.

When I was writing this article, I found that the 2.0 version of “Prompt Management Assistant” has been reviewed, so I would like to talk to you about my own development journey at the end, and talk about my moments when I have questioned myself countless times.

I spent a total of 3 weeks developing, and after the architecture optimization failed in the first two weeks, a voice in my head told me that you don’t really need to make this product so heavy, as long as it can be used.

The new features are simply done, there are no fatal bugs, and the front-end style and architecture don’t need to be adjusted. It only takes a day or two for the new version to be launched, and the development difficulty is much reduced.

This is correct from a rational point of view, but I want to do a good job in a serious way.

I can accept spending more time, I can accept writing less articles and less traffic, I want to do a good job in this product and insist on iterating.

When I finished developing the “Prompt Management Assistant” and went to find Mr. Xiaopai and Mr. Da Ming, I said this: My new version has been developed, and I feel that my AI programming level has taken a big step forward.

If I had chosen to be lazy and not face this hurdle, I would have missed a lot of beautiful scenery.

I think we still have to do everything seriously, worthy of ourselves, users, and conscience.

The power of this world is counterproductive after all, and what kind of power you give to this world, it will be returned.

End of text
 0