Skip to content

AI Coding Insights: Ditch the "Full Automation" Trap, My "Semi-Guided" Efficient Practice

Recently, I took over a somewhat old CodeIgniter 3 project that required adding several features, such as recruitment, attendance, and income/expense tracking. I considered using AI to assist with the programming. After tinkering around, I've developed some new ideas on how to use AI for coding, or rather, insights gained after stumbling upon some pitfalls.

AI programming is all the rage now. If you say you're not using it, it feels like you're falling behind. But to completely rely on those AI IDEs (like Cursor, Windsurf, Trae, etc.) or hand over the entire project to AI to handle everything, to be honest, I'm really not comfortable with that. Especially when dealing with complex projects or maintaining legacy systems like mine, the result is often "5 minutes of generation, N hours of modification and debugging, and wanting to bang your head against the wall during later maintenance."

So, today I'll share my practical experience and also discuss the pros and cons of pure AI assistance, AI IDEs, and my "semi-guided" approach.

The "Double-Edged Sword" of AI Programming: Contextual Understanding is a Weakness, Maintenance is a Headache

AI can write code quickly, no doubt about it, but its weakness is also quite obvious: its ability to understand the overall "context" of a project is still lacking. How the front-end and back-end interact, how the database is designed, the business logic involved - AI can easily get confused if things are slightly complex.

For example, if you use an AI IDE like Cursor and directly let it start working, it might immediately give you a "cosmic shift," completely changing the file structure; or generate a bunch of code that has nothing to do with your project's style; even scarier, it might even quietly delete your "ancestral" old code, and then you'll have no place to cry.

Especially with legacy projects, which have all kinds of historical issues and customizations, who knows how AI will "freely interpret" and "imagine" functions? A slight oversight could be a small disaster.

Taking adding features this time as an example, if I directly threw the task to an AI IDE and let it "fully autonomously drive," I estimate that I would have to spend at least half a day "cleaning up" after it. Why? CodeIgniter 3, such an "old-fashioned" framework, even if the AI's training library has it, what about those custom libraries and historical legacy issues in the nooks and crannies of the project? The generated code is likely to not run, and I would have to debug it, which would reduce efficiency instead of increasing it.

My "Semi-Guided" Strategy: I Build the Framework, AI Fills in the Details, Efficiency Soars!

To prevent AI from "running wild," I came up with a relatively stable approach: first, draw the project's "rules" and "blueprint" for the AI, and then let it fill in the details. Here's how I did it:

  1. Explain the "Family Assets": Clearly tell the AI, "Our project uses CodeIgniter 3.1.10, MVC architecture, the back-end controller code is in /admin/Renyuan.php, the database operations recognize $this->db, and the front-end is based on Bootstrap 4.6 and jQuery 3." This way, AI doesn't have to guess and can follow the existing path.
  2. Draw a Sketch: Don't let AI guess what the interface looks like. I directly used drawing tools to outline a rough layout (where the form is, where the buttons are), took a screenshot and threw it to the AI, telling it: "Look, just follow this appearance and implement the front-end and back-end functions for me."
  3. Establish "Rules": Add some restrictions to the AI, such as emphasizing that front-end and back-end logic should be separated, first help me generate the SQL statements for creating tables, try not to use external links and subqueries (it often makes mistakes with these two), the front-end code directly outputs HTML, CSS, and JS into one file, and the back-end uses simple queries with a JOIN.
  4. Step-by-Step "Acceptance": After the AI spits out the table structure SQL, back-end controller code, and front-end page code, I manually create the Renyuan.php, renyuan.html files (and a Renyuan_model.php if a model layer is needed), carefully paste the code given by the AI into them, then run the SQL to create the table, and finally run it to test.

How's the effect? Not bad at all! The AI "obediently" generated clear table creation SQL, back-end code with relatively reliable logic, and front-end code that is basically usable. Copying the code to the corresponding files, executing SQL, and doing a simple test, most of the functions ran through at once! The workload that was originally estimated to take a week was compressed to about 1 day , the efficiency improvement is real, and there are fewer errors.

Image illustration: Just like giving AI a clear "construction drawing"

Comparison of Three Approaches: Pure Chat, AI IDE Full Package, My "Semi-Guided"

Let's compare the feelings of these approaches:

  • Pure Chat-Style AI Assistance (like talking directly to ChatGPT or Gemini):

    • Feels like: A readily available technical consultant. Ask about anything you don't understand, and it's convenient to modify a small piece of code.
    • But the problem is: You have to manually piece together the scattered code yourself, lacking an overall sense, and it's easy to "lose the thread" when dealing with complex tasks.
  • AI IDE Full Package (Cursor/Windsurf/Trae, etc.):

    • Feels like: Directly providing you with a "co-pilot" that can directly modify code in the project and automatically complete it. It looks integrated and convenient, especially suitable for new projects or simple scenarios.
    • But the problem is: As mentioned earlier, it doesn't understand the "road conditions" of complex projects, especially old projects, which are prone to incompatibility, easy to operate blindly, and the cost of cleaning up problems is too high.
  • My "Semi-Guided" Model:

    • Feels like: You're driving the car, but using a super-intelligent "navigation + voice assistant." You control the general direction (project structure, core logic), and let AI suggest and fill in the specific "how to go" (code implementation details).
    • The advantage is: It utilizes the AI's ability to quickly generate code while retaining human control. It is especially suitable for complex projects or legacy system transformations. If you provide enough framework and constraints, the AI output will be more in line with actual needs, with fewer errors, and you'll be more confident in later maintenance.
    • Of course, it also takes some thought: It takes some time in the early stage to prepare the "navigation route" (project information, sketches), and the instructions (prompts) given to the AI must be clear and understandable.

In short, AI IDE is a bit like opening "full self-driving," which looks cool and saves trouble, but once the road conditions are complex (old projects are typical), it is easy to get "lost" or even "cause trouble." My method is more like you firmly holding the steering wheel while letting AI, your capable assistant, handle most of the routine operations, flexible and controllable.

Some Thoughts and Ramblings

This time, I mainly relied on gemini-2.5-pro-preview-03-25 to generate code, and overall it was very powerful. Although it occasionally made some small mistakes (such as confusing single and double quotes, or mixing up a native JS method and a jQuery library method), they were all minor repairs, not too troublesome.

In addition, I discovered a "trick": Letting AI use simple queries and JOINs is much more stable than letting it write complex subqueries. I don't know why, but it always crashes when writing subqueries, and it's useless to repeatedly modify the error messages, maybe there are more "pits" in this area of the training data.

Therefore, in the future, when dealing with AI, I will definitely stick to the "I build the framework, AI fills in the details" approach, especially on legacy projects, and avoid those "fully automatic" tools as much as possible, to avoid digging a hole and burying myself.

All in all, AI programming is the general trend, but to use it well, you really need some wisdom of "human-machine collaboration." Don't always think about letting AI handle everything; treat it as a "smart apprentice" or "capable assistant" that needs guidance, give it enough direction and framework, and it can truly help you double your efficiency.