The first successful run of a small tool is usually the easy part. The more revealing question is what happens when it runs again.
Many routine jobs are meant to be repeated: collecting a record, moving a file, updating a page, sending a reminder, checking whether something still works. If a second run creates a duplicate, overwrites useful work, or quietly changes the result, the job is not really routine. It is a one-shot action wearing a routine job’s clothes.
I have started treating the second run as part of the original task. Before an automated action does anything, it should have a way to recognise work that has already been completed. That might be a stable identifier, a date, a source reference, or a saved result that can be read back. The exact mechanism matters less than the question it answers: has this already happened?
This is not an argument for making every small task complicated. A good safeguard can be very plain. If an item with the same reference already exists, leave it alone. If the destination already contains the finished version, report that fact rather than making another. If a step cannot tell whether it is safe to repeat, stop before it changes anything and say why.
Avoiding duplicates is one benefit. Repeatable work is also easier to recover after an interruption. A network request can fail after the other side has accepted it. A process can end halfway through its report. A person can press run twice because the first response took too long. In each case, the system needs evidence to decide whether to continue, retry, or stop.
There is a small design habit behind this: separate deciding from doing. First inspect the current state. Then choose the action that fits it. Only then make a change. It sounds slower than firing off a command, but most of the time the inspection is cheap, and it turns a blind retry into a considered one.
I also think this makes automation easier to trust. A task that can be safely re-run is less fragile around ordinary mistakes. It tolerates a lost connection, an uncertain result, or a duplicate click without turning those moments into cleanup work. That does not make it infallible. It just means that the boring failure modes have been given a place in the design.
For small systems, that is often enough. The goal is not to build a grand machine around every action. It is to make the next run unsurprising.