AI-Assisted Coding Best Practices: Sharpening Your Developer Mindset
Recently, we held a brainstorming session with our senior developers to discuss the evolving role of AI-assisted coding.
AI is here to stay—it’s a powerful tool that accelerates development and enhances productivity. However, it can also be a double-edged sword, often producing long, mediocre code. Worse, we have seen cases where the code is not fully understood by the developer…
Developers that were impressed by AI on simple use cases, will often fail to find it useful once approaching real-life projects. And while using it to debug a simple problem is often fast and easy, it is not uncommon for the AI to enter long unproductive “suggestion loops” that actually cost the developer time and effort.
So what is the best way to do AI-assisted coding? What techniques will help us get the most out of this tool?
We brainstormed with the goal of outlining key guidelines and techniques to maximize the benefits of AI-assisted coding while avoiding common pitfalls.
Here are our key takeaways:
-
Own Your Code
Even though AI can generate a significant portion of your code, remember that you are still the ultimate owner. This means:
- Read and understand everything the AI produces.
- Question both the AI and yourself about any unclear parts. This practice not only ensures you own the code, but also that the code aligns with the project’s needs.
AI can be a powerful assistant, but only if you ensure its suggestions are sound, maintainable, and in line with your goals.
-
Work in Small Packets
Progress is most effective when we assign the AI focused, small tasks. These tasks allow us to:
- Continuously assess and own the code.
- Identify issues quickly before they balloon into bigger problems.
- Keep control of the overall structure and design.
Add to that the well known best practice: “Commit early, Commit often”
By limiting the scope of the AI’s input, you’re in the driver’s seat, using AI to assist rather than overwhelm. By committing each step you are protecting yourself against runaway instability loops.
-
Let the AI read up-to-date source and documentation
Often we find ourselves working with tools, libraries and services that are evolving extremely fast. In such situations, the AI can easily lead us down the wrong path by ignoring substantial features, important updates and even breaking changes that it was not trained on.
But this is not a given. Be warry of what versions of key libraries the AI was trained on. Start your session by feeding the AI with links to the up-to-date source and documentation – either through special context enhancement settings or by asking it to read during your chat session
-
Discuss Design and Architecture
Before diving into code, it’s crucial to establish the context by having a clear discussion of the goals, technology stack, APIs, and constraints. This way:
- You clarify your objectives and frame your architectural decisions.
- The AI gets context, enabling it to generate more relevant suggestions.
After setting the stage, break the problem down into smaller pieces and start generating code in manageable chunks.
-
Discuss and Question in order to Learn
AI doesn’t just help you solve problems; it also accelerates your learning process. Adopt a mindset of curiosity:
- Question the answers the AI gives you, particularly those you don’t fully understand.
- Strive to understand the solution during the code generation process. The AI is a learning tool as much as a coding assistant.
When the goal is learning, the quality of the outcome will often be higher because you engage more deeply with the process.
Developers that approach AI with the intent of learning how to solve a challenge are consistently more effective than those who directly ask it to solve the problem by itself.
-
Brainstorm with AI
One of the AI’s key strengths is its ability to serve as a brainstorming partner:
- Present your situation, concerns, or doubts to the AI.
- The process of framing questions often sparks new ideas and insights, even when the AI doesn’t offer direct solutions.
By using AI as a sounding board, you get the benefit of a second “opinion” to fine-tune your ideas, sharpen your approach, and explore creative solutions.
Moreover, several of our coders mentioned that often the effort of framing your challenge and related thoughts helped spark new solutions and ideas BEFORE the AI ever answered. In a way, it’s “rubber-duck debugging on steroids” 🙂
Conclusion
The mindset we found useful is not about handing off your work to AI but leveraging it as a partner in the development process.
By actively engaging with the code, questioning AI outputs, and brainstorming, you’ll grow as a developer. If you regard AI merely as an “advanced code generator” then you are missing huge opportunities. Regard it as a team member – knowledgeable, opinionated, over-confident and sometimes misguided, but always willing to help.
In my next post, I would like to share some specific tasks where AI is super productive.