Main image of article 5 Tips for Getting Accurate Results When Coding with AI

Artificial Intelligence (AI) has woven its way into many of our tech stacks. In the past few years, an idea has become a foundational part of the day-to-day coding experience for many technologists. IDEs of all kinds are using AI features like autocomplete, and some platforms can create entire blocks of code without human interaction.

For some, coding with AI is a stark reminder of the fragility this career path presents, and a threat to their professional existence. To others, AI is a means to an end, helping them be more productive and write better, cleaner code. AI may be concerning, but it’s nascent and requires human interaction and oversight once you get beyond the simplest code.

AI is also not all-knowing. When coding with help from AI, you still have to ensure that what it returns is accurate and will compile effectively. If left to code haphazardly, AI will create more problems than it solves. To help those interested in using AI while coding, we spoke with a few experienced tech pros on how to get the best results when coding with AI

AI coding assistants don’t guarantee great results, and you shouldn't expect them to. They can help you avoid repetition when coding, but expecting them to return rock-solid code from a simple prompt is misguided.

“I believe AI coding assistants like Copilot or ChatGPT are very helpful for speeding up repetitive coding tasks, debugging, or generating boilerplate code,” Pieter Wellens, co-founder and CTO of APICbase, tells Dice. “They are great at saving time when you need a quick solution or inspiration. However, they’re not perfect. A common issue is that they don’t always understand the context of a specific project, which often leads to irrelevant or overly generic suggestions. Also, they might produce insecure or inefficient code, especially if they’re trained on outdated examples.”

“AI coding assistants are great at speeding up repetitive coding tasks,” notes Burak Özdemir, founder of Morse Code Translator. “For example, they’re effective at generating boilerplate code, like setting up RESTful APIs or creating CRUD operations. They also help with syntax corrections, making it easier for developers to avoid common mistakes in unfamiliar programming languages. However, they struggle with understanding project-specific details or business logic. For instance, when I used an AI assistant to create a multi-step data processing pipeline, it missed dependencies between data structures, causing logic gaps that I had to fix manually.”

AI has numerous use-cases, but there are plenty of times to be wary of it. When prompting a chatbot, remember to be specific, and know it’ll likely give you similar results to the autocomplete function in your IDE. While helpful, AI is still best when leaning on it for the basics.

“Use AI coding assistants when you’re looking for quick snippets, boilerplate code, or help debugging,” notes Wellen. “They’re also great for prototyping or solving more minor problems where the stakes are low. I use them as a productivity booster for repetitive tasks, not as a replacement for careful, thoughtful coding.

“AI coding assistants are fantastic for repetitive tasks like generating unit tests, creating API calls, or writing basic functions. They’re also excellent for learning purposes, providing examples or explanations of unfamiliar code. In my experience, they’re best used as a brainstorming tool or to accelerate routine coding tasks, letting you focus on the more complex parts of the project.”

“Coding assistants should be used for modular and low-risk tasks, such as writing utility functions, generating test cases, or exploring alternative implementations,” adds  Özdemir. “However, they should be avoided in areas involving security, compliance, or business-critical logic. Relying on AI to handle encryption or regulatory workflows can introduce subtle errors that are hard to detect but have serious consequences.”

To get the best results from AI, you need to provide specific instructions and enough context,” Gary Kuznetsov, Engineering Manager at ZFORT Group, says. “First, focus on instructions. If you don't like something about the AI's answer, try to find out precisely what you didn’t like. Sometimes, it’s hard to pinpoint the issue, but it’s essential to make the effort. Once you do, write a clear and specific instruction for the AI.

“In human communication, we rely on existing rules. For instance, when writing code, you follow specific style guidelines. When you talk to a fellow developer, they’re usually aware of these rules too. However, an AI assistant doesn’t know these rules unless you specify them. You need to provide this information so the assistant can generate decent code. 

“Context is equally important. Just as you wouldn’t expect a person to write code without understanding the context, you shouldn’t expect AI to do so either. Unlike humans, AI doesn’t ask questions to clarify unclear instructions. That’s something you need to account for. Additionally, AI cannot open folders or examine your existing codebase on its own, so you must provide the necessary details upfront.”

“One of the more frequent issues is how AI coding assistants tend to deliver incomplete class definitions,” notes Kevin Sahin, co-founder at ScrapingBee. “This can create frustration when developers try to build on these snippets only to discover key elements are missing. Fixing these gaps can take valuable time.

“Asynchronous programming is another tricky area. AI assistants often miss the nuances of handling concurrency, leading to bugs or inefficient processes. This limitation becomes a bigger problem in projects with significant parallel or asynchronous tasks.”

Technologists can worry less about AI-generated code in scenarios where risks are mitigated or minimal,” adds Mitchell Cookson, co-founder at CoinLedger. “For example, you don’t need to worry much if you are using AI for low-risk tasks such as generating code for prototypes or proof-of-concept projects. Such outputs don’t require scrutiny or production-grade precision. Moreover, you can worry less if you use AI in programming environments with robust testing frameworks. It means that any issues with AI-generated code can easily be identified and resolved before deployment. Using AI for brainstorming or educational purposes also falls in this category because the focus in such cases is on exploration rather than execution.

“It is also important to point out that AI models fine-tuned for specific domains, such as infrastructure scripts or SQL queries, are more reliable due to their specialized training. You don’t have to worry much about the code generated by these models, but human oversight is still critical to ensure efficiency and accuracy. I love seeing AI as a collaborative tool that can only help you accelerate your development process rather than replace your human expertise and experience.”

“AI coding assistants are best used for improving existing code by making it more modular,” adds Sahin. “They can help break down code into smaller, reusable components, simplifying both maintenance and scalability. These tools work well in refining projects during iterative development stages, ensuring cleaner and more efficient code.”

“GitHub Copilot does a great job of handling repetitive coding tasks with its autocomplete features. It uses patterns from a huge library of open-source projects, which gives it a lot of depth and versatility. However, relying too much on it might make developers less confident in their manual skills, and some are uneasy about the data it was trained on. GitLab Duo, on the other hand, connects coding with project management tools in a really smart way. Its suggestions are tuned to the specific activity in your repository, making them highly relevant. That said, it hasn’t caught on as quickly with freelancers, and it can be resource-heavy for larger teams.”