Before it touches anything real.
THE PRINCIPLE
Never run anything generated as the first attempt on something that matters.
WHERE TO TEST
A staging copy of your site A test database A copy of the file A sample of the data
FOR SCRIPTS THAT CHANGE THINGS
Ask for a dry-run option.
"Include a mode that shows what it would do without doing it."
Run that first.
FOR DATABASE QUERIES
SELECT before UPDATE or DELETE. Always.
FOR BULK OPERATIONS
Test on ten rows before running on ten thousand.
WHAT TO CHECK IN GENERATED CODE
Error handling What happens on unexpected input Whether it can be stopped Whether it is reversible
FOR ANYTHING IRREVERSIBLE
A person should confirm before it runs.
THE UNDERLYING RULE
Generated code is a suggestion. You are responsible for what you run.