Back to Home

Keeping AI code from crashing: Three prerequisite agreements for requirements, acceptance, and regression

September 7, 2026 at 01:32 PMSource: RunByAI0 comment(s)TechGuide

Many people have had the experience of using AI programming assistants: making small changes is easy, but once it involves modifying logic or structure, the code provided by AI often looks right but runs incorrectly. The problem often lies not in the model's ability, but in the task we assign it being too vague. Before letting AI modify the code, write three "pre agreements" first, and the rollover rate will significantly decrease.

1、 First, clarify 'what to change and why to change'. Don't just say 'change this interface'. To tell AI: where is the current code (files and functions), what problem needs to be solved, why can't existing writing be used, what constraints are there (cannot move public signatures, need to maintain backward compatibility, etc.). The more specific the information, the less likely AI is to make its own decisions.

2、 Agree on 'how to complete the modification'. Before starting, write down the acceptance criteria: the test commands that need to be passed, the output format that must remain unchanged, and the document locations that need to be updated synchronously. At the same time, AI is required to include the actual validations it has run and the results when delivering the code. The acceptance criteria are written first, and discussing code quality is the basis.

3、 Define the 'regression range'. Changing a piece of code often affects both upstream and downstream. Clearly tell AI which modules are most likely to be affected, require it to check all callers, and list all modified files. After receiving the list of changes, the order of manual review should be: first check if the file list meets expectations, then check if the diff is minimized, and finally run the test.

Finally, a habit to add: no matter how skilled the AI is, any changes to the core logic must adhere to the bottom line of "manual interpretation is possible". The code generated by AI is only a preliminary draft. It is only when you can explain clearly why each line exists that the code truly belongs to your project. Only by solidifying these three agreements into the team template can the productivity of AI programming assistants truly be realized.

AI programming
Discussion

Comments (0)

No comments yet. Be the first!

Leave a Comment