One popular way to remind yourself you're running in privileged mode is to set up your shell prompt to show your username as red. Most prompts will change to a
# when running as root, but it's helpful to also see a "dangerous" color to know you should use caution.
Another idea is to use the principal of least privilege as much as possible. Use a tool like
sudo to restrict your user's ability to run only a subset of commands (in a normal mode). This is also a cornerstone of the selinux patch which implements mandatory access control (MAC) on system resources. Some find selinux to be prohibitively difficult to work with, but if you learn it well, it's a very useful tool.
As others have said, there's really no way to be perfectly safe while running as
root, so it's best to have regular backups and some procedure in place should the worst happen. We all make mistakes, but if you're able to recover from them, the mistakes don't cost you that much.
It may be a little too broad for your application, but check out GitLab's postmortem of their database corruption incident last year. Specifically, here are some steps they took to set up their PS1 to indicate the "safety" of their environment.