Thoughts on AI Assisted Coding

I’ve been using Copilot in VS Code to help build several different projects. I’ve also used Claude, Gemini, and ChatGPT to help start and evolve projects. I find the tools to be very helpful and I feel more productive using them. I also find myself having more fun when using the tools.

I have no doubt that these tools are here to stay and will become a standard part of software development.

What Kinds of Projects

I frequently use code assistance when creating Python-based utility scripts for manipulating data or automating websites. Agents have a solid “understanding” of Python and JavaScript, so I rarely have issues with the generated code itself. I typically need to help with managing the code structure and modularity.

My children and hobbies will sometimes nudge me to create more full-blown web apps. I like to structure those projects as vanilla HTML & JavaScript frontends, with Python-based API backends.

Agents will typically try to use a popular framework, but I push it towards modern JavaScript and Web Components.

My Approach

Make Useful Prompts: Start with an overview of the work you want to accomplish, and then kickoff the initial prompt with the basic starting point. I will make it clear that I want minimal dependencies, and specify any base frameworks we should use.

Get the Right Context: It’s easy for a code assistant to “forget” about existing code and recent changes. Use the context tools to make sure the code assistant is aware of relevant code, and be explicit about the context in that code. If you aren’t mindful of existing context, the code assistant is likely to create duplicate code, or not use existing code. Because I split up frontend and backend code, I will need to remind the code assistant about one or the other when refactoring. Agent-mode can have less issues in this situation.

Prepare for the Journey: Break up the process into tasks/steps. Yes, this means you need to plan out the workflow and have a general idea of the system and architecture. I’ve seen people talk about using a one-shot prompt/agent to build an entire solution, but that has not been my experience. Perhaps a personal bias, but I want to control the development flow. I’m less interested in a one-shot agent building a complete solution.

Options and Suggestions: Even though you have a general idea of the system and architecture, I frequently ask the code assistant for suggestions and options when starting subsequent steps. The code assistant may even recommend one of the suggestions over the others. This is where you need to think about the ramifications of the options. I occasionally veto all suggestions, but use the input to create a new prompt. Other times, I’ll use parts of one of more suggestions, but explicitly define the new approach in the next prompt.

Be Subtractive: Code assistant seem motivated to add code, even expanding beyond the scope of your prompt. Adding new capabilities to your code base can be exciting, but this is a siren song that leads to tech debt and code you no longer understand. I am the editor of this work and I trim and delete parts of the code I do not want at this point. I might want to add something in the future, but not now. One fascinating and frustrating behavior is the code assistant’s desire to always add back the code I edit away. We need to explicitly tell the code assistant we don’t want some parts of the code. Yes, some prompts are just refining the context for the model to avoid future indulgences.

Forest and Trees: Most of the time I end up working with the code assistant on specific pieces and areas of code. Every now and then it’s useful to have the code assistant appraise larger views of the project. This can be easier with agents, but can also be done with context-providing tools too.

Other People’s Thoughts

You might find some of these posts interesting and informative as well: