Well some general tips are:
1) Dont move kingside pawns up unless doing so gains you a decisive advantage.
2)Always keep a few minor pieces around your king for protection.
3)Avoid pins on the pawns in front of your king. Otherwise this will allow your opponent to place pieces close to your king. Move your king to avoid pins if possible.
4)Try to prevent your opponents pieces from building up on the kingside. Use the middle pawns to block attacking lines.
5)If you get the chance, trade off your opponents pieces that are trained on your kingside.
i notice that even though i got good openings and development i still blundered by king side attacks(especially after i castled). may i know generally, or some tips to defend against king side attack. it usually spoils the offense and you are then focused on defending