That seems like simple, easy-to-follow, common sense advice.
It’s simple and it’s common sense, but it’s not so easy.
It works though.
Staying out of trouble is an inverted way of thinking about how to succeed at something. You can be clever ten times and do well, but one dumb mistake can ruin everything. It’s better to work on staying out of trouble, instead of trying to be clever.