If I had kidney stones, what can I do to avoid having them again?

Lots of options. You need a metabolic workup to outline the cause of kidney stones. This involved a 24 hour urine collection and blood work. Increasing your water intake, low sodium diet and low protein diet will help. Other treatments such as thiazides, citrate, caclium, gout treatment etc.... Are determined by your metabolic workup.
Depends. Primarily on what type of stone you had. There are many different types of stones. The most common are calcium based stones but uric acid stones can also happen. If you have had several stones you need to see a urologist for a metabolic evaluation and a 24 hr urine. The most important prevention is hydration hydration hydration. Drink enough water so that your urine is clear like water.