Artificial Intelligence (AI) has become a game-changer in software development. From enhancing code quality to automating repetitive tasks, AI tools are revolutionizing how developers work. In this course, you will rely on them too: you'll use AI throughout, from scaffolding your Kotlin Multiplatform architecture to generating Compose Multiplatform UI, wiring up networking and persistence, and writing tests. Before you get further into specific tools, it's worth covering how AI actually helps with code and the habits that keep it helping rather than hurting.
This topic isn't tied to one specific tool—the technologies and best practices here apply whether you're using an IDE plugin, an agentic assistant like Junie, or an AI-native IDE.
AI in the development workflow
AI is fundamentally reshaping the software development landscape. Unlike traditional code-completion tools that suggest the next few characters based on fixed rules, AI-powered tools act as true collaborators. You can brainstorm with them, ask for suggestions, and even automate routine tasks. With AI, your workflow shifts from just getting simple suggestions and focusing on syntax to solving the actual problem.
This evolution is largely driven by the advent of large language models (LLMs). These models have been trained on vast datasets of text and source code, which lets them recognize the patterns, syntax, and best practices of programming — including idiomatic Kotlin. When you prompt an AI tool to write a function, it can generate new, contextually relevant code.
However, it's not just LLMs powering this transformation; AI tools also use other machine learning techniques. Sometimes it's cheaper and more practical to use traditional machine learning algorithms, such as classifiers or rule-based models. Simpler tasks like static code analysis and pattern matching benefit from this, and an LLM steps in afterward to explain issues or suggest fixes. This hybrid approach can provide significant cost savings compared to using LLMs for everything.
When testing UI components or interpreting design mockups — for example, checking that a Compose Multiplatform screen renders correctly across Android and iOS — AI tools rely on computer vision models. These can understand layouts, detect visual inconsistencies, and validate interactions far more quickly than manual checks. Reinforcement learning can continually improve coding assistants by rewarding behaviors that produce cleaner, safer, or more efficient code. Finally, there are specialized programming tasks — such as working with a proprietary framework or generating boilerplate for a particular library — where smaller, fine-tuned models offer faster responses and lower costs while still capturing the domain's nuances.
For seasoned developers, AI tools provide acceleration and augmentation. They help speed up common tasks that often take a lot of time. For instance, you can ask an AI assistant to write unit tests for a shared commonMain function, or generate an expect/actual implementation once you've defined the expected declaration. This frees you from routine work and allows you to focus more on solving unique problems and designing the overall structure of your app.
Best practices
AI tools can significantly speed up your work, but they aren't perfect. As the developer, you are always responsible for the final code that gets committed. Following a few key best practices will help you get the most out of these tools while avoiding common pitfalls, and will keep your shared Kotlin code secure, correct, and maintainable.
First, always verify — don't trust. AI models are trained on vast amounts of public code, which may contain biases, security vulnerabilities, or outdated practices. Treat AI-generated code with the same level of scrutiny as code from any other source, with thorough review and testing before it lands in your project — especially in shared code that runs on every platform.
Sometimes AI models produce incorrect code. This is known as hallucination. Hallucinations often occur when models misunderstand your project's context or when you give them vague instructions. Providing adequate context and clear, detailed instructions leads to better and more accurate results. Compare this "bad" prompt to a "good" one:
Bad:
update this codeGood:
Refactor the following Kotlin function in the UserRepository class (commonMain).
- Replace the current for-loop with Kotlin's map and filter functions.
- The goal is to improve readability and follow idiomatic Kotlin style.
- Add a check at the beginning that throws an IllegalArgumentException if the users list is empty.Notice how the good prompt names the exact file and function, states the desired transformation, and specifies the expected behavior — the same level of detail you'd give a teammate reviewing a pull request.
This also means you should break large problems down. Avoid asking an AI assistant to build an entire feature in one go. Instead, assign smaller, more manageable tasks: designing a data model, implementing a single repository function, or generating unit tests for it.
Before accepting any suggestion — especially from agentic assistants that can also perform actions automatically — use the diff viewer in your IDE to see exactly what changes the tool is making, across which files and platforms.
It's essential to treat the output as a suggestion, not as a command from an infallible expert. If you just accept AI suggestions without understanding them, your own problem-solving skills can weaken over time. Take the time to understand why the model suggested a particular solution, and consider whether there's a better way — you must be the final quality check for every line of code, including the parts of your shared module that run on platforms you can't easily test by hand.
Remember, the best way to confirm that AI-generated code works correctly is to have a solid test suite as a safety net. Before applying a suggested refactoring or adding a new feature, make sure you have tests that cover the existing functionality. After applying the change, run your tests — on every target you support — to ensure that nothing has broken.
Ethical and legal considerations
AI tools are now part of nearly every stage of software development — planning, coding, testing, documentation, and even project management. While they can make teams faster and more efficient, they also introduce ethical and legal concerns. As a developer, you're responsible not only for what your code does, but also for how it came to be.
Data privacy is one of the most critical concerns. Many AI tools process prompts, code snippets, and other project data through external servers. If this data includes proprietary logic, client information, or credentials, it could expose sensitive material. Some providers may also use the data for model training. Always review the privacy policies of the tools you use, and prefer enterprise or on-premises versions that guarantee data isolation. Treat anything you send to a public AI service as potentially visible to others.
Accountability doesn't disappear just because an AI tool made a suggestion. Avoid using these tools to create or distribute software that could cause harm, violate laws, or exploit vulnerabilities. Responsible use also involves recognizing bias: AI models may reflect the limitations or assumptions present in their training data, so review output not just for correctness, but also for fairness and inclusivity.
Legal questions around ownership are still evolving. Most jurisdictions recognize that only human creators can hold copyright. Whatever an AI tool produces, the person or organization using the tool typically owns the result — provided it doesn't replicate copyrighted material. If the output closely resembles existing works, especially open-source or licensed content, ethical practice means acknowledging that overlap and avoiding unintentional infringement.
Finally, transparency builds trust. Disclosing that you used AI tools in your workflow helps establish credibility and signals that you're aware of both the benefits and the limits of AI-powered automation. Responsible developers treat AI as a partner, not a replacement for judgment, creativity, or accountability.
Conclusion
AI is fundamentally changing the software development landscape, and the most effective way to view it is not as a replacement for developers, but as a collaborator. Powered by LLMs and other ML techniques, these tools handle repetitive work and let you focus on the more creative aspects of building your app.
The best practices covered here — verifying output, writing precise prompts, breaking work into small steps, and using tests as a safety net — apply to every AI tool you'll use in this course. In the next topics, you'll see exactly how to put them into practice with Junie and the JetBrains AI Assistant directly on the Kotlin Multiplatform project you're building.