You can't guarantee that you will not develop melanoma at some point in your life, but you can take steps to decrease the likelihood of that happening. The most important thing you can do is protect your skin from UV radiation, which is a known carcinogen:
Make wearing sunscreen a daily habit. Use a broad-spectrum sunscreen with an SPF of at least 30 year round. Be sure to cover all exposed areas of your skin.
Reapply sunscreen frequently--approximately every two hours--when you are in the sun, particularly after swimming or exercising.
Stay in the shade during mid-day, from 10 a.m. to 4 p.m.
Wear protective clothing in the sun, including broad-brimmed hats and sunglasses.
Do not use tanning beds. There is no such thing as a safe "base" tan.
Check your skin regularly using the ABCDE rule. If you notice any suspicious changes or growths, see a reputable dermatologist who is knowledgeable about skin cancer right away.
We all know we need to use sunscreen but looking at the variety of sunscreens on store shelves can be overwhelming and confusing. Here are some answers to common sunscreen questions:
What kind? Sunscreen can act in one of two ways: by creating a physical barrier that blocks UV rays or by filtering those rays chemically. If you are concerned about the chemicals in sunscreen, choose one that creates a physical barrier. The active ingredients in these sunscreens are the minerals zinc oxide and titanium dioxide, which do not penetrate the skin. The Environmental Working Group publishes a yearly guide to sunscreens which includes detailed ratings of most brands on the market currently: https://www.ewg.org/sunscreen/
Why broad-spectrum? Two types of UV radiation are harmful to the skin, UVA and UVB. UVA rays are primarily responsible for premature aging; UVB radiation causes burns. Overexposure to either can lead to skin cancer. Broad-spectrum sunscreen protects against both.
The SPF myth: The SPF (sun protective factor) number listed on sunscreen refers to how long it takes to burn skin that's been treated with the sunscreen as compared to skin with no sunscreen. However, higher SPFs do not offer significantly greater sun protection. A sunscreen with an SPF 30 rating blocks out 97% of UVB rays when applied correctly. SPF 50 blocks only slightly more, and there is no evidence that an SPF higher than 50 adds any additional protection. More important is to be sure you are using an adequate amount (about 3 tablespoons if you are in a bathing suit) and that you reapply every two hours or after swimming or exercising, even if the bottle says "waterproof".