Compartmentalization would help, if possible.
I do some things to make context better, especially find the Notepads useful.
In every project I have a basic set of instructions “boilerplate” that are common to every project, and another one specific to the project, eg shortcut notations for common phrases (eg “SL = Shopping List”); variable naming conventions, etc.
I also have one I call features, which is a summary of the project’s features that I have the LLM generate every few days. Additionally, I generate a db schema whenever the tables change with an sql query and paste that into a Notepad. Adding key files to the chat context (rt mouse click on the file name) often helps.
Version control is crucial. I have the LLM install git in every project and whenever a significant change is finished to my satisfaction, commit the version to git, and whenever the LLM fails to make the next change with a lot of thrashing around, I just revert and start over, often with notes from the previous attempt pasted in the first prompt.
One of the short cuts in my boilerplate is “■■■” which stands for “Don’t apply any changes, let me review and apply them myself”. Another is “DGD” which means “Don’t guess, debug” which I typically resort to after the third attempt to fix/do something without any sign of progress. I usually have a set of debugging variables in my main file, so toggle display of debugging logic that is conditional on those variables/constants. Instructions on how to construct new debugging logic is in the boilerplate Notepad.
I do old school PHP, so debugging involves tailing the php error log, js alerts, and the browser’s Console for js logging. Too much time is wasted forgetting to open the Console, and missing js errors that pop up, and I’ve spent half an hour fighting the LLM.
That’s what I’ve learned/developed so far, I’m not a good programmer, nor experienced in writing good code. I slap stuff together, often sporadically over years. But AI is helping me to create better code, albeit schizophrenic as the projects bloat up.
Think of AI as a genius, functional alcoholic, working in a vast, dark warehouse with a penlight for illumination. Pack as much context in Notepads and attached files as you can, and keep telling it to not do more than you ask (unless you are willing to risk bad results for the chance of great results that you hadn’t imagined yourself). Give it some free reign if you can be ready to revert, otherwise, keep the leash tight when you really need to get something right.
Be ready to roll up your sleeves and dig into the codebase when the LLM starts going in circles, guessing at solutions.
Tell it to bracket the logic with debugging, or else it will incrementally build them for hours in the wrong areas. Be specific in telling it what parts to add debugging to.
Watch out for it creating new variables and logic, because it doesn’t know they already exist, and especially beware that if it tries to reconcile different names, it will always choose the new one and start renaming the dozens of lines with the old one, but only a handful at a time. Hit the brakes when it says, "I see the issue. Foo is named “bar”, but in this part of the code, it’s called “BAR”, and oversee the process with your own eyes and brain. Do an “all files” search for the two versions of the name to see which one should stay and which one should go.