Try to keep your smart contract small, simple, and modularized. Complicated code is difficult to read, understand, and debug, it is also error-prone.
Use well-written library tools where possible.
Limit the amount of local variables.
Move unrelated functionality to other contracts or libraries.