On top of unit tests, functional tests, integration tests, and static analysis, you need a linter. Tom Scott illustrates with the story of a date string format error. https://www.youtube.com/watch?v=D3jxx8Yyw1c
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!