Coding with AI without breaking your project
AI coding assistants can write a working function in seconds, explain an error you have stared at for an hour, and draft the tests you would otherwise put off. They can also change files you never mentioned, delete a check that mattered, or call a function that does not exist, all in code that looks perfectly reasonable.
The habits below keep the speed and limit the damage. They apply whether you paste code into a chat, use an assistant built into your editor, or let an agent edit files on its own.
Before you start: make every change reversible
Put the project under version control before an assistant touches it. Git is the usual choice. Then:
- Commit a clean, working state, so that you always have something to go back to.
- Make a branch for the work you are about to do.
- Check that you can run the project and its tests from the command line.
- Learn the command that throws away uncommitted changes to a file, and the one that undoes a commit. You will use both.
With that in place, a bad suggestion costs you a minute, not an afternoon.
Give it the context a new teammate would need
The assistant sees only what you give it, plus whatever files its tool reads for you. Useful context includes:
- What the project does, its language and its main framework, with their versions.
- The file and the function involved, not just a description of them.
- The full error message, and the steps that trigger it.
- What you expected to happen, and what you have already tried.
- The house rules: naming, formatting, and the existing helpers it should use instead of writing new ones.
Work in small steps
"Add user accounts" is not one change. It is a data model, a sign-up form, password hashing, sessions, emails and tests. Ask for all of it at once and an assistant will produce hundreds of lines that you cannot review properly.
Ask for one small, testable step at a time, and give each step the same loop:
- Ask for the change.
- Read the diff.
- Run the tests, and try the feature yourself.
- Commit, with a message that says what changed.
- Move on to the next step.
Small commits also make it easy to find which step broke something later on.
Read every diff
Never accept code you have not read. You do not need to understand every line at once, but you should look for these:
- Changes outside the scope. Files you did not ask about, renamed functions, or reformatted code that hides the real change.
- Deleted or weakened checks. Validation that was removed, a test that was skipped or deleted, an error that is now caught and ignored, a permission check that disappeared.
- Invented calls. Functions, options or library features that sound right but do not exist in the version you use.
- New dependencies. Every new package deserves its own look (see below).
- Secrets and local details. Keys, passwords or folder paths from your own machine written into the code.
- Quiet changes in behaviour. A new default value, a different sort order, rounding done another way.
If you do not understand part of a change, ask the assistant to explain it line by line. If the explanation does not hold up, undo the change.
Let tests do the checking
Tests turn "looks right" into "works". This pattern is reliable for bugs:
- Ask for a test that reproduces the bug.
- Run it and watch it fail. A test that passes before the fix proves nothing.
- Ask for the smallest change that makes it pass.
- Run the whole test suite, not only the new test.
Be wary when an assistant "fixes" a failing test by changing what the test expects. Sometimes the old expectation was wrong; often the code is. Decide which, yourself.
A worked example
A shop's checkout shows a price of $10.50 as "$10.5". You paste the formatting function, an example input and the wrong output, and ask for a test that shows the bug. The test fails, as it should.
You ask for the smallest fix. The diff should be a line or two inside that one function: formatting to two decimal places, or using the language's own currency formatting. If the diff also changes how prices are rounded somewhere else, ask why before you accept it. Then you run every test, try a few prices by hand (including zero and a very large amount), and commit.
Check every package before you install it
Assistants sometimes suggest packages that do not exist, or names that are one letter away from a popular package. Attackers know this, and publish harmful packages under names that models tend to invent. Before you install anything new:
- Find it on the official package registry, and check the name letter by letter.
- Look at who maintains it, how long it has existed, how widely it is used, and whether its source repository is real and active.
- Ask whether you need it at all. A few lines of your own code can be safer than a new dependency.
- Pin the version, and commit the lock file.
Keep secrets out
Do not paste API keys, passwords, customer data or private configuration into an assistant. Use placeholders and sample data instead. Keeping your data private when using AI covers what to strip out and why.
Take extra care with security-sensitive code that an assistant writes: sign-in and permissions, anything that builds database queries or file paths from what a user typed, and anything that handles payments. Ask specifically what could go wrong, and run your linter and any security scanner you have.
Know when to stop
Stop asking and start thinking for yourself when:
- each fix creates a new failure;
- the assistant keeps going back to an approach you have already rejected;
- you can no longer explain what the code does.
Go back to the last good commit, read the problem again, and either break it into a smaller step or solve that part yourself. An assistant's confident explanation of code you do not understand is not the same as code you understand. How to check AI answers and their sources applies to explanations of code too.
When the assistant can run commands
Agent-style tools can edit many files, run commands and install software without asking each time. They are powerful, and they need firmer boundaries: a dedicated folder, your approval before anything that cannot be undone, and an easy way back. Letting an AI agent act for you, safely explains how to set those up.
Where Noetic Suite fits
In the Noetic Suite desktop app, Noetic works on a folder on your own computer, with the files, the changes, a terminal and a preview beside the conversation, and a restore point that undoes a whole build in one click. It also works with the coding agents you may already use. See the features page and the download page.