What are the best practices of writing automation code?

I wanted some information related to some of the best practices of writing automation code. Can anyone please provide me some valueable information.