Skip to main content
All AI tricks
Guided workflowDevelopmentIntermediate

AI Code Keeps Breaking Working Features? Write the Safety Test First

Each AI fix seems to break something else. List what works today, turn each item into a check, commit first, ask for the smallest change and revert if anything fails.

15 min practicePlatform independentUpdated · Last checked Oct 24, 2026
Jump to the lesson ↓
Abstract illustration of angle brackets with a shield-shaped test marker, in the colours of the Development topic.
Original conceptual illustration made for this lesson. Not a screenshot, product test or endorsement.

The useful result

Create a keep-working list with runnable checks and a commit-and-revert routine around AI changes.

  • Create a keep-working list with runnable checks and a commit-and-revert routine around AI changes.

You ask an assistant to fix the login page and the checkout stops working. You ask it to fix checkout and the login page breaks again. Builders describe this loop constantly. Agents often see only part of a project, patch the symptom in front of them and cannot tell what else depended on the old behaviour.

The fix is to give the project a memory the model does not have: a short list of behaviours that must keep working, each one turned into a check you can run in a minute. With that list, a commit before every change and a rule to revert on failure, a bad edit costs seconds instead of an afternoon.

The examples below are illustrative exercises, not recorded results from any tool. Sources were checked on 24 October 2026; menus, limits and prices change, so confirm details on the linked pages.

Before you start

  • A small project in a Git repository
  • An AI coding assistant or chat
  • Ten minutes to list how your app should behave today

Review evidence

Documentation-based review · 2026-10-24

Primary documentation and official guidance checked on 24 October 2026. Examples, checks and exercises are original illustrations, not recorded tool tests. Cover artwork is a conceptual illustration.

1

List what works today and make each item a check

Write three to five behaviours that work now, such as “a user can log in with a valid password” or “the cart total updates when quantity changes”. For each, note the exact steps and the expected result. If you can, turn them into automated tests; if not, a written checklist you run by hand still works.

Try this prompt
Here is my project description and the behaviours that must keep working: [list]. For each behaviour, write a test or a manual check with exact steps and the expected result. Do not change any application code. Mark anything you cannot test without more information.

Example / expected result

Illustrative example; not a recorded model result.

“1. Open /login, enter a valid email and password, press Sign in. Expected: dashboard page with the user’s name.”

Check your result

You have a numbered list of behaviours, each with steps and an expected result that takes under a minute to run.

2

Commit first, then ask for the smallest change

Save the current working state with a commit so you can return to it. Then ask for one change only. Ask the assistant to name the files it will touch and explain the plan before writing code, and to leave everything else alone.

Try this prompt
Make only this change: [one change]. First list the files you plan to modify and why. Do not touch other files, rename anything or refactor. After editing, list every file you changed and any behaviour that could be affected.

Example / expected result

Illustrative example; not a recorded model result.

Git add -A && git commit -m "Working state before AI change".

Check your result

A commit exists with a clear message, and the assistant has listed the files it plans to change.

3

Run every check and revert on failure

After the change, run the whole keep-working list, not only the thing you asked for. If any check fails, discard the change and return to the commit instead of asking for a patch on top of a patch. Then try again with a smaller or clearer request.

Check your result

All checks pass, or the change has been discarded and the project is back at the working commit.

When it goes wrong

Tests that the AI wrote for its own change can be too kind, so keep your own checks. A green test only proves what it tests. Do not run unfamiliar commands that the assistant suggests without understanding them, and keep secrets out of prompts.

Make it your own

Pick a small app, write five keep-working checks, make one AI change under this routine and record how many checks passed on the first run.

Useful next resources

Sources and review

Last checked Oct 24, 2026. Features and account limits can change. Verify important results against your original material.

Did this help you complete your task?

Tell us what needs improving. No account or private output required.

Was this useful?
Report incorrect information or a broken link

Genius Forges Editorial

Practical AI lessons with checked sources, labelled examples and human verification.

Keep building your AI habits

Keep learning useful AI tricks

Get practical lessons and resources when we publish them.

Turn this idea into a daily skill

Practice with a small input and check the result before sharing.

We use optional cookies for analytics and referral tracking. Learn more about our privacy policy