Keep the automation small enough to understand
Triggers, conditions, actions — and a useful answer to “why did that happen?”
The interesting part of home automation is not making an action happen. It is making the action happen for an understandable reason, and making the system easy to live with afterward.
Home Assistant's trigger, condition, and action model is a useful way to keep that reasoning visible.
Give each automation one job
Describe the behavior in a single sentence before building it. If the sentence needs several “except when” clauses, consider whether it is really several behaviors sharing one configuration.
Keep the names concrete. “Hallway light after sunset” tells you more than “Smart lighting v3”. Future you is a valid user.
Think about the second event
What happens if the trigger fires again before the first run finishes? What happens after a restart? What happens if a device is unavailable?
Those questions matter more than the happy path. Home Assistant supports different automation modes; choose deliberately for the behavior you want rather than assuming overlapping runs will sort themselves out.
Leave a way to inspect it
Use automation traces while developing and after unexpected behavior. A trace is a much better starting point than trying to remember the state of five devices at the time.
For HomeOS, the same principle belongs in the architecture: an event should carry enough context to explain what caused it, and an action should have a visible outcome.
Small, observable automations are easier to extend. They are also easier to turn off when they are being annoying.
References: Home Assistant automation basics and automation modes.