Engineering guide
AI workflows for features and fixes
Two step-by-step workflows for using an AI coding agent on an existing application: one for building a new feature, one for fixing a reported issue.
For a feature, agree on a written plan before any code is written. For a fix, reproduce the failure before anything is changed.
Almost everything that goes wrong with AI-assisted work in an existing app traces back to skipping one of those two steps. The agent writes plausible code quickly; the workflow exists to make sure it is the right code, proven against the real application.
Part 01
Groundwork for both workflows
An agent starts every session knowing nothing about your application. The setup below is done once per repository and pays for itself on every task afterward.
| Groundwork | Why it matters |
|---|---|
| A project instructions file | Records how to build, run, and test the app, plus the conventions and constraints a new engineer would be told on day one. The agent reads it at the start of every session. |
| One command that runs the tests | The agent can only verify its work if checking is cheap. A fast, reliable test command is the single biggest lever on output quality. |
| A way to run the app locally | Tests passing is not the same as the feature working. The agent should be able to start the app and exercise the change. |
| A branch per task | Keeps every change isolated, reviewable, and easy to discard if the approach turns out to be wrong. |
| Scoped permissions | The agent gets what the task needs and no more. Production credentials, deploys, and destructive commands stay behind a human approval. |
Part 02
Engineering a new feature
A feature in an existing app is mostly a question of fit: where the new behavior belongs, which existing code it should reuse, and what it must not disturb. The workflow front-loads that understanding so the code is written once.
-
Write down the outcome.
State what a user will be able to do, what counts as done, and what is out of scope. Include the constraints the agent cannot guess: performance limits, compatibility, who is affected. A paragraph is enough; a one-line request is not.
-
Have the agent explore before it proposes anything.
Ask it to read the relevant code and report back: how similar features are built, which modules it would touch, what data and interfaces are involved. No changes yet. This is where it learns your patterns instead of inventing its own.
-
Ask for a written plan, and review it.
The plan should name the files to change, the approach, the tests to add, and any open questions. Reviewing a plan takes minutes; reviewing the wrong implementation takes hours. Correct the plan until you would be comfortable handing it to a colleague.
-
Settle the decisions that are yours.
Schema changes, public interfaces, new dependencies, and anything touching security or billing should be decided by a person at the plan stage, not discovered in the diff.
-
Build in small, verifiable slices.
Have the agent implement one slice at a time, with tests, running the test suite after each. A slice that works end to end is better than several layers that have never run together.
-
Verify in the running application.
The agent should start the app and exercise the feature the way a user would, including the unhappy paths: empty input, missing permissions, a slow or failing dependency. Ask it to show what it ran and what it observed.
-
Get an independent review.
Run a second review pass in a fresh session that has only the diff and the requirements, not the conversation that produced them. It catches what the author, human or AI, has stopped seeing.
-
Read the diff yourself, then merge.
Check that the change does what the plan said and nothing more. Unrequested refactors, new dependencies, and widened scope are the things to push back on.
-
Release behind a control and watch it.
Ship through your normal pipeline, behind a feature flag where the risk warrants it, and confirm the behavior in production before calling it done.
Part 03
Fixing an issue
A fix is an investigation before it is a change. The risk is not that the agent cannot write the patch; it is that it patches the symptom it was shown, and the real cause stays in place.
-
Give the agent the evidence, not your diagnosis.
Provide the report as it came in: the error text, logs, steps to reproduce, the affected version, and what was expected instead. If you have a theory, label it as a theory. An agent handed a conclusion tends to confirm it.
-
Reproduce the failure first.
Have the agent make the problem happen on demand, ideally as a failing automated test. If it cannot be reproduced, the task is to find out why, not to guess at a fix.
-
Find the root cause and state it.
Ask for a plain explanation of why the failure occurs, traced through the code, with the evidence for it. If the explanation does not account for everything in the report, the cause has not been found yet.
-
Check how far the cause reaches.
The same mistake often exists in neighboring code. Have the agent look for other places with the same pattern, and for data already affected by the bug that may need correcting.
-
Make the smallest change that removes the cause.
A fix should be narrow and easy to review. Cleanup and refactoring the agent notices along the way go on a list for later, not into this change.
-
Prove it with the reproduction.
The test that failed in step two should now pass, and the rest of the suite should still pass. Then repeat the original steps in the running app to confirm the reported behavior is gone.
-
Keep the test.
The reproduction becomes a regression test. It is the only thing that stops the same issue from returning quietly.
-
Review, release, and confirm.
Review the diff against the stated root cause, ship it, and check the original signal in production: the error rate, the log line, or the person who reported it.
-
Record what was learned.
Note the cause and the fix where the team will find it, and add anything the agent should know next time to the project instructions.
Part 04
How the two differ
| New feature | Issue fix | |
|---|---|---|
| Starts from | A described outcome | Evidence of a failure |
| First deliverable | A reviewed plan | A reliable reproduction |
| Main risk | Building the wrong thing, or building it against the grain of the app | Treating a symptom and leaving the cause |
| Size of change | As large as the feature needs, delivered in slices | As small as possible |
| Proof it is done | The feature works in the running app, including failure cases | The reproduction fails before the change and passes after |
| Human decision point | Approving the plan | Accepting the root cause |
Part 05
What stays with the engineer
In both workflows the agent does the reading, writing, and checking. The engineer keeps the decisions: what should be built, whether the plan or the diagnosis is right, and whether the result is good enough to ship.
Three habits make that review effective. Ask for evidence rather than assurance: the command that was run and its output, not a statement that tests pass. Keep each task to one branch and one purpose so the diff can be read in a sitting. And when a session has gone down the wrong path, start a fresh one with a better brief instead of arguing the agent back on course.