The summary.
BEFORE AUTOMATING ANYTHING
Ask whether the task is necessary at all, and who maintains the script when you are unavailable.
A script is not finished when it works.
BUILD A REPORTING MODE INTO ANYTHING DESTRUCTIVE
Run it, verify the list is what you expect, then act. A bulk operation on the wrong pattern is immediate and irreversible.
MAKE SCRIPTS SAFE TO RUN AGAIN
They get rerun after an apparent failure. Running twice should be harmless.
FOR SCHEDULED JOBS
Full paths to both the interpreter and the script. Cron inherits nothing.
Redirect output to a log and notify on failure — otherwise a failing job fails silently for months.
Prevent two copies running at once, or a slow job overlaps itself.
FOR ANYTHING PRODUCING A REPORT
Validate the data before producing output. A report from a partial dataset is worse than no report.
FOR API AUTOMATION
Set timeouts, respect rate limits, and handle pagination — taking only the first page and assuming it is everything is a common silent error.
GIVE AUTOMATION ITS OWN LIMITED CREDENTIALS
Never a person's, and never broader permissions than the task requires.