The Right Use of AI Starts Before the Code
The quality of a generated response depends largely on the quality of the context provided. A request such as “Create a validation function” leaves too much room for assumptions.
To get a useful proposal, you need to specify:
- the language and framework being used
- the expected behaviour
- performance requirements
- the team’s conventions
- permitted dependencies
- error cases
- acceptance criteria
This step is about prompting, of course, but above all, it forces you to clarify the problem before asking for a solution. AI does not correct an imprecise specification; it is more likely to turn it into imprecise code.
Once the need has been clearly defined, the assistant can propose an initial implementation, suggest a refactoring or compare different approaches. However, this proposal remains a technical hypothesis to be examined.
What AI Can Accelerate in the Development Cycle
Once the need has been clarified, AI can step in at several points in the development cycle and help to:
- produce an initial version of a function or component
- refactor repetitive logic
- explain existing code
- analyze an error message
- suggest possible fixes
- generate technical documentation
- propose unit and integration tests
- identify edge cases
- break a feature down into tasks
- compare architecture options
This can reduce the time spent on research, formatting and repetitive tasks. It can also speed up the understanding of a codebase or help a team explore several solutions before making a choice.
However, if a proposal produced in a few seconds requires several hours of debugging, analysis and rewriting, the initial benefit disappears.
A Simple Example: Functional but Incomplete Code
Imagine that a team asks an AI assistant to generate a function that validates a reimbursement request. The function must verify that the amount is positive, that the date is valid and that supporting documentation is provided.
The assistant quickly produces a clear solution and generates a few successful tests. The happy path works: a $125 reimbursement accompanied by valid supporting documentation is approved.
During the review, however, a developer notices that a business rule was not mentioned in the prompt: requests over $500 must be approved by a manager. The generated tests do not detect the omission because they cover only amounts below that threshold.
The code is not necessarily bad. It is simply incomplete in relation to the actual need. The review makes it possible to identify the missing rule, add the corresponding scenario and request a new implementation.
This example illustrates the difference between code that runs and code that can be responsibly integrated into an application.
Five Checks Before Integrating Generated Code
Before accepting an AI-generated proposal into a main branch or pull request, a rigorous review goes beyond simply saying, “It works on my machine.”
1. Functional Review
Does the code actually meet the need? Does it comply with all business rules, including those that were not explicit in the initial request?
You also need to verify the assumptions made by AI. What happens when data is missing, invalid or contradictory? What happens when the data volume increases?
2. Security Review
Are inputs validated? Are permissions, secrets and sensitive data handled properly? Has the assistant added a dependency or an approach that creates a risk?
In a Quebec context, this question is important when the code handles personal information, customer data or intellectual property. Internal policies, access rights, the provider’s data-retention practices, and ownership of the proposed code or excerpts must all be considered.
3. Test Review
Do the tests cover only the happy path? Do they check errors, boundary values and unexpected behaviours? Do the assertions test the intended behaviour, or do they simply reproduce the proposed implementation?
A generated test can be technically valid—and still validate an incorrect assumption. Coverage is therefore not enough: you must also examine whether the scenarios are relevant and whether the tests can genuinely detect a regression.
4. Maintainability Review
Does the result comply with the team’s conventions? Will it be understandable to someone else six months from now? Does the solution actually reduce complexity, or does it merely shift the problem elsewhere?
Shorter code is not automatically easier to maintain. You must also check the clarity of names, the separation of responsibilities and how easy it will be to write future tests.
5. Architectural Review
Does the code fit into the existing architecture? Are its dependencies, performance choices and interfaces consistent with the rest of the system?
An isolated component may seem efficient while creating technical debt across the application. This review therefore concerns developers as well as team leads and architects.
Making AI a Team Practice
To prevent every developer from adopting their own method, AI use must be integrated into existing practices: coding conventions, pull requests, the definition of “done,” automated tests and CI/CD pipelines.
For example, a team might require that a generated proposal be understood by the person submitting it, covered by relevant tests and reviewed according to the same criteria as manually written code. The origin of the code should not lower the standard of review.
The workflow can be structured as follows:
- define the need and constraints
- ask AI for a proposal
- examine its assumptions
- run the code and analyze the result
- generate or complete the tests
- conduct the review
- integrate only a solution that has been understood and validated
This shift from individual experimentation to a team method is at the heart of the training.
From Experimentation to a Controlled Method
The AI for Developers: Assisted Coding and Intelligent Programming course applies this approach to a complete workflow, from planning to continuous integration.
Over two days, participants practise code generation and refactoring, debugging, documentation, review, unit and integration test creation, and integration into CI/CD pipelines. The course also covers planning, software architecture design, dependency management and risk assessment.
These concepts are put into practice through a collaborative project. Participants learn how to structure a request, evaluate a proposal, identify its limitations, generate relevant tests and integrate the results into a team’s development practices.