Rule #1: You can't. Not with 100% certainty. No sex is completely "safe" or ever has been, since the dawn of humankind. You are only ever rolling the dice and you can adopt some "safer sex" practices to mitigate risk. Not eliminate it. I mean unless you're into latex or something enough to be covered head to toe in it rather than touching skin to skin. I will assume that's not the case.
Yes, you can ask for testing. That is a risk ~mitigation.~ But even then, some viruses can be carried without giving positive test results. Herpes is a common one, which has been around...since the dawn of humankind, apparently, as they've found strains of it in the DNA remains of ancient specimens. Herpes, or HSV2, can also be spread when one is using a condom, and even if no signs of infection are visible, and many people have it and do not know. HSV1, or "cold sores" is another strain of herpes that you can get by kissing, or you can get it with genital symptoms from oral sex. Many cases of "genital herpes" are in fact HSV1.
Neither strain is curable. However, both can be suppressed very effectively, symptoms are usually very minor (contrary to what scare-media might try and tell you--I know because I've known a number of people who have one or the other strain, or both, and are willing to discuss it.) It's incredibly common, so it's worth knowing about. It isn't life threatening. Doctors don't even recommend testing for it, because false negatives and false positives are both possible, and if you find out you are positive, then you have an ethical duty to disclose it to partners, and the single worst thing about having it, is the stigma.
HIV is now on the verge of being cured and can be effectively suppressed with medications, but I hear that they are expensive and some may have frightening side effects. Testing is, however, fairly reliable and condoms and other barriers (such as dental dams for oral on women) are fairly effective at preventing transmission.
HPV is also extremely common, and can increase one's risk of cervical cancer if I remember correctly. I think that there is a vaccine for this one now.
Also, while it's not always considered an STD because it can be transmitted other ways besides sex, Hepatitis is also a concern. Again, I think they have drugs for the management of this, but Hep C is a nasty business. And I believe the medication for it is very expensive. Not sure. Tests are reliable, though. Fluid barriers definitely help prevent transmission.
Those are the "big ones" because they have (at least during my lifetime so far) been "incurable."
However, the other ones that are curable with antibiotics or other drugs now, such as syphilis, gonorrhea, chlamydia... But we are not out of the woods yet where they are concerned. Like most disease causing bacteria, gonorrhea is evolving and some strains are now resistant to antibiotic treatment.
Here is a site with lots of good information about STIs (Sexually Transmitted Infections, same as STDs just a different term) -
https://www.cdc.gov/std/default.htm
My personal policies:
1. Educate myself. Work to reduce stigma by discussing without judgment and encouraging people who are positive to disclose. As I'm part of a sex-positive community, this is part of the community service work I am involved with. (I'm actually working with a group to get a mobile testing facility to come to one of our swinger events soon.)
2. Get tested and ask for testing from partners. When I was "dating" or poly or playing the field or in other words NOT in a committed, closed, monogamous relationship, due to higher risks, I got tested every 3 months. If someone does not want to discuss sexual health and sexual safety with you, then they aren't deserving of your time, in my opinion. They need to grow the hell up. I don't care if it's a buzzkill. People need to be responsible adults about this. Covering our eyes and ears and going "lalala there are no consequences to my actions" does not work. You can not judge because someone hasn't had a lot of partners (that you know of) or they look like a boy/girl next door, that they are not carrying something. You are within your rights, to ask for test results. I have known of some couples who actually went to a clinic together and made a sort of date day of it. I know, sounds un-romantic...kids these days, what can I say? One example of this though? Gorgeous young woman I knew who was dating a somewhat famous band member, demanded a clinic date before she'd have sex with him. So. Groupies notwithstanding, if a celebrity can be expected to abide by such a thing, who does Joe Tinder think he is? Huh?
3. Insist on condoms/barriers, unless you have been together I'd say a minimum of 6 months with shared test results every 3 months (at least twice) along the way. It can take that long for some diseases to incubate and give a positive result. Also of course you must consider any pregnancy risk and how you're handling that. And remember, even with condoms, you are still rolling the dice, especially with regard to herpes.
4. If you are in a closed/monogamous relationship and have established your STI status and believe yourself to no longer be at risk, if you definitely trust your partner not to be possibly cheating or anything...then I tend to back off testing to about once a year with my regular well-woman health exam.