Using AI Assistants Effectively
AI assistants can explain code, draft functions, suggest tests, summarise errors and help you reason through a problem. They produce plausible text based on patterns, so they are a fast helper whose work you must still judge.
What they are good at, and what they are not
- Good at: boilerplate, explaining unfamiliar code or error messages, suggesting names, drafting tests and documentation, converting between formats, and giving you a first version to react to.
- Weak at: knowing your system’s context, recent changes to libraries, subtle edge cases, and saying “I don’t know”. They can invent functions, options or facts that do not exist (often called hallucination).
Treat the output as a suggestion from a quick but unreliable colleague.
Writing the prompt
The same ideas that make a good question to a person help here; see Asking Good Questions.
- Give context: the language and version, the framework, the relevant code, the error text and what you already tried.
- State the goal and constraints: what the code should do, what style or libraries to use, what to avoid.
- Say what form the output should take: “explain step by step”, “show only the changed function”, “list the risks”.
- Break big tasks into small steps. Ask for a plan first, then one piece at a time.
- Give examples of input and expected output.
Iterate
The first answer is rarely the last. Respond with what is wrong (“this fails with this error”, “this does not handle empty input”) instead of starting over. If the conversation drifts or the answers get worse, begin a fresh conversation with a better summary of the problem. You can also ask the assistant to explain its answer, list assumptions, or suggest alternatives, and then compare.
Staying responsible for the result
- If you cannot explain a line to a colleague, do not commit it. Using an assistant to learn is fine; using it to avoid learning leaves you stuck when it is wrong.
- Check the result. See Verifying AI Output.
- Mind what you share. See Confidentiality and AI.
- Follow your team’s rules on which tools are approved and how generated code should be disclosed or reviewed, including licensing questions.
- Keep generated changes small and reviewable, as in Commit Hygiene.
Try it
Pick a small, real task, such as writing a function that parses a date string, or explaining a confusing error message. Ask an approved assistant twice: once with a vague one-line prompt, and once with context, constraints and an example. Compare the answers, then find one thing in the better answer that is wrong or questionable.
Common mistakes
- Sending a vague one-line prompt and accepting the first answer.
- Committing generated code you cannot explain.
- Continuing a drifting conversation instead of starting a fresh one with a better summary.
- Ignoring team rules on approved tools and disclosure.
Check yourself
- What should a good prompt include?
- What do you do when the assistant's answers get worse during a conversation?
- Why do you still own code an assistant wrote?