Idempotency first

A good operational script should converge toward a desired state. Running it twice should not create an unintended second change.

Discover → Compare → Change only when needed → Verify

Validate inputs

Fail early when required parameters, files, identities or target systems are missing. Avoid destructive defaults and make scope explicit.

Log useful evidence

Record what the script attempted, what target it operated on and whether verification succeeded. Keep sensitive values out of logs.

Handle errors deliberately

Do not treat a zero exit code as proof that the desired state exists. Verify the resulting state and return a meaningful failure signal when validation does not pass.

Operational pattern

Parameterize → Validate → Execute → Verify → Report

Automation is production code. Version it, review it, test it and make its failure mode safer than the manual alternative.