To get good results from an AI coding assistant, brief it the way you would brief a capable new colleague: explain the context, state the constraints, define what "done" looks like, ask for tests, work in small steps and review every change before it goes anywhere near production. Vague requests such as "build me a dashboard" produce vague code. Specific, bounded requests produce code you can actually check.
This applies to developers and to non-developers who use AI to write scripts, spreadsheet formulas or small internal tools. The principles are the same; only the depth of review differs.
Start with context the AI cannot guess
An AI assistant does not know your project, your team's habits or why a piece of code exists. Before asking for a change, tell it:
- The goal in plain language. What problem are you solving, and for whom?
- The environment. Language, framework, the files involved and anything it must not touch.
- Existing conventions. Naming, folder layout, how errors are handled. Point to an example file it should imitate.
- What you have already tried. If you are fixing a bug, include the exact error message and the steps that trigger it.
Tools such as Claude Code can read your project files directly, which reduces how much you have to paste. Even then, a short written summary of the goal prevents the assistant from solving the wrong problem well.
Set constraints before it starts writing
Constraints are the cheapest way to avoid rework. Useful ones include:
- Which files or modules may be changed, and which are off limits.
- Libraries it may or may not add. Unrequested new dependencies are a common source of surprises.
- Security boundaries: never hard-code passwords or keys, never send customer data to an external service, never disable checks to make something pass.
- Style limits, such as keeping the change small or avoiding a rewrite of working code.
If your team uses the same rules repeatedly, write them down once in a shared project file instead of retyping them. Our guide to writing a CLAUDE.md for your team covers that approach.
Define what "done" looks like
AI tends to declare success quickly. Give it a finish line that you can verify:
- "The report should show one row per customer, sorted by last order date."
- "Invalid input must show an error message and must not crash the form."
- "All existing tests must still pass, and the new behaviour must have its own test."
Acceptance criteria written in ordinary sentences are enough. If you cannot describe what correct looks like, you cannot judge whether the output is correct, and that is a signal to clarify the requirement first.
Ask for tests, and read them
Tests turn "it looks right" into "it demonstrably works for these cases." Ask the AI to write tests alongside the change, including awkward cases: empty input, very large input, missing fields, unexpected characters. Then read the test names and assertions yourself. A test that checks nothing meaningful gives false comfort.
For non-developers, the equivalent is a short checklist of sample inputs and the answers you expect. Run the AI's script against those samples before trusting it with real data.
Work in small steps
Large requests hide mistakes. A better pattern is:
- Ask for a plan first. Have the AI describe the approach and list the files it intends to change. Correct the plan before any code exists.
- Implement one piece at a time. A single function or screen, not the whole system.
- Check after each step. Run it, test it, read the diff.
- Save a working state. Use version control so you can return to the last good version if a later step goes wrong.
Small steps also keep each review manageable. A change you can read in five minutes is a change you will actually read.
Review every change like a colleague's work
AI-generated code can look confident and still be wrong, insecure or unnecessarily complicated. Treat it as a draft:
- Ask the AI to explain what each part does, then check that the explanation matches the code.
- Look for hard-coded secrets, skipped validation and anything that sends data outside your systems.
- Prefer the simplest version that meets the requirement; ask it to simplify if the output is bloated.
- Have someone with the right skills review anything that touches money, personal data or production systems.
The habit of checking output applies beyond code. Our guide on how to check if AI output is accurate sets out a general approach.
A reusable briefing template
Many teams find a simple structure keeps requests consistent:
- Goal: what we are trying to achieve.
- Context: the project, files and examples to follow.
- Constraints: what to avoid and what must not change.
- Done when: the checks that prove it works.
- First step: ask for a plan before writing code.
Good instructions are a skill that improves with practice and feedback. If your team wants structured, hands-on practice, see AI training in Malaysia or the Claude Certified Associate workshop, run by Agmo Studio, a Select Partner of the Anthropic Claude Partner Network. Certifications are issued by Anthropic; Agmo runs exam-preparation workshops.