One trigger, one outcome
The one-line statement
Write your automation as a single sentence in this shape:
When [trigger], make sure [outcome].
Examples from things I actually run:
- When a camera card is plugged in, make sure every new file on it is copied to the server, once, with its date intact.
- When a backup finishes, make sure a record of what was copied exists and can be checked later.
- When the power drops to battery, make sure the machine reduces its power draw within seconds.
What a good trigger looks like
Triggers come in three kinds. Time — every night at two. Event — a file appears, a card is inserted, a message arrives. Condition — free space drops below a threshold.
Time triggers are the easiest to build and the easiest to reason about. Start there unless the task genuinely cannot wait. An event trigger that fires the instant something happens feels better and is meaningfully harder to get right — events arrive twice, arrive out of order, and arrive while the previous one is still being handled.
What a good outcome looks like
An outcome is a state you can check, not an action you performed. “The file has been copied” is checkable. “Run the copy command” is not — the command can run and copy nothing.
This distinction is the whole reason the sentence is worth writing. If your outcome is phrased as a state, you already know how to test whether the automation worked, and you are most of the way to a heartbeat.
The word "once"
Notice that “once” appears in two of my three examples. Put it in yours if it belongs there. It is the shortest possible way of writing down that this automation must be safe to run twice, and it will shape everything you build next.