Here's the top 3 guidelines to avoid a penalty:
Don't buy links. Links passing SEO value to your site should look natural
Don't overuse keywords. Stuffing your content with exact repetitions of a key phrase can hurt your search engine rankings
Make original, quality content.