In the opening, it's helpful for me as a beginner to remember some basic principles: develop your pieces, castle, knights before bishops (generally), don't move the same piece twice, etc. Are there similar, very basic rules of thumb that one can typically adhere to in the middle game and endgame? Or are middle games and endgames so numerous and sitinct that it really depends on the opening, e.g., in $X$, you want to do $y$ and $z$ but in $A$ you want to do $b$ and $c$?
There are quite a lot of basic principles. Whole books have been written on the principles of strategic play, for example. Basis rules are useful and will get you on your way. For more advanced players it is actually more important to understand when to break the rules.
A couple of rules 'off the top of my head':
- A knight on the rim is dim, meaning that it's better to keep your knights centralised than to put them on the edge of the board.
- Loose Pieces Drop Off (LPDO), meaning that unprotected pieces are vulnerable to (double) attack. So keep your pawns and pieces protecting each other.
- The side with less space should exchange pieces (and vice versa).
- The side with an advantage should attack, or he risks losing his advantage.
- If you have a choice in captures with pawns (say h2xg3 or f2xg3), capture towards the center.
- Try to avoid weaknesses in you pawn structure (isolated pawns, doubled pawns, backward pawns).
- Invite everybody to the party, meaning activate all your pieces especially when attacking the enemy king.
- Don't make pawn moves on the side of the board where you are weaker.
- Etc, etc.
Remember that for every rule above there are a lot of exceptions.
For the endgame:
- Activate your king
- Improve your position to the maximum
- When you have the advantage, try to create a second or third weakness
- In rook endings activity (of king and rook) is usually more important than one or two pawns
- Opposite colored bishops endings have a large drawing tendency
- Knight endings have a lot in common with pawn endings
- In queen endings it's more important how far your passed pawn has advanced, than how many passed pawns you have.
- Etc, etc.
When studying chess you will gather a lot of these rules.