Predict Your Opponent
Chess isn't just about attacking your opponent. It's also about keeping your opponent from attacking you!
Why Did They Move There?
Every time your opponent moves a piece somewhere, ask yourself, "Why did they move there?" Try to think about what you would do if you were your opponent, and stop that from happening. Here's an example:
In this position, black played d6. What does that do?
Think about it. Black wants to move the bishop on c8 to g4 and pin your knight.
To stop that, you can play h3. You stopped the opponent's plan!
Where Will They Move?
Before you move, you need to think about what your opponent will do after you move. It can be tricky, so let's look at an example:
Here, black plays Nd4.
First, before doing anything, think about why the knight moved there.
How can you stop the knight?
What happens if you capture the knight?
You don't want to trade your bishop for the knight, but you can take it with your knight.
But, black can take back with the pawn and fork your knight and bishop!
So, taking the knight isn't a good idea.
One last thing you could do is move your queen to d1.
Your queen defends the c2 pawn and the f3 knight at the same time.
This is the best move!
Your Weaknesses
In this position, black played h4.
Why did black move there?
Let's say you didn't know what black wanted to do and played something like Nb3.
Now, black can play h3.
But what's the danger here?
If you play gxh3, black can play Rxh3.
Now your king doesn't look very safe, does he?
When you captured the pawn, you opened the wall of the king's fortress!
So, don't let black play h3.
Instead of all of that, you can play h3 first!
This keeps the black pawn away from your fortress and keeps your king safer.