Defense without the possibility of offense is passivity, and that is bad.
So the number one rule is to always keep the potential to do something active later. Knowing endgames well would help a lot. As a model maybe Ulf Andersson. He tended to take zero risks, and was the 2600 GM equivalent of Carlsen's ability to squeeze blood from a stone.
Most chess players are attacking chess players.and I heard a good offensive is the best defense. But it seems hard to go from A attacking player to defensive player. What are the general rules for a defensive player