AI Coding Workflow That Keeps Quality
A repeatable workflow for using coding assistants: issue, plan, small diff, tests, review and merge.
Prerequisites
- • A code repository
- • A test command
- • An AI coding assistant
What you will learn
- Write an issue with acceptance criteria and non-goals
- Keep AI-generated diffs small and reviewable
- Use review prompts that prioritise correctness and security
The bottleneck moved
AI made code generation cheap. Review, testing and understanding did not get cheaper at the same rate. A workflow that optimises for generation produces larger diffs and more review work.
Optimise for review instead.
Step 1: Write the issue
Include:
- the user problem,
- acceptance criteria,
- non-goals,
- relevant files or constraints,
- the test that should pass.
Example: “Add a bookmark endpoint. Acceptance: authenticated users can add and remove their own bookmarks; unauthenticated requests return 401; duplicate adds are idempotent. Non-goals: collections, sharing, notifications.”
Step 2: Ask for a plan
Do not ask for code yet. Ask for the files to change, the data model, the failure modes and the tests. Review the plan. A bad plan produces a large, bad diff.
Step 3: Keep the diff small
One logical change per branch. If the assistant starts refactoring unrelated code, stop and split the task. Large diffs get rubber-stamped.
Step 4: Run the checks
npm run lint
npm run typecheck
npm test
If a check fails, fix the cause. Do not disable the check or loosen the assertion to make the output pass.
Step 5: Review for the dangerous classes
Ask for a review focused on:
- authorization and access control,
- injection and unsafe input handling,
- data loss and partial writes,
- concurrency and retries,
- missing tests for the new behaviour.
Then do your own review of the diff. AI review is a supplement, not a replacement.
Step 6: Verify the behaviour
Run the app and exercise the change manually. For a bookmark endpoint, test add, duplicate add, remove, remove twice, unauthenticated access and another user's bookmark ID.
Step 7: Merge with context
Write a pull request description with summary, motivation, test plan, risk and rollback. Future maintainers need to know why the change exists.
A warning about velocity
AI can generate a lot of plausible code quickly. That is useful only if the team can absorb it. Measure review time, defect rate and rollback frequency, not lines of code.
Exercises
Do these before moving on. Reading is not the same as being able to apply it.
Exercise 1
Convert a task into an issue
Take a small feature and write acceptance criteria, non-goals and a test plan before prompting.
Exercise 2
Review a real diff
Run the bug-hunt review prompt on your last pull request and compare its findings with the human review.
References
Finished this tutorial? Continue with a guided path.
Browse learning paths →