1. Password protect phone/computer/social media
Always make sure that you are careful about the accessibility of your communication devices. If you need to buy a pre-paid phone, or even set up an email account.
2. Use cash, not credit cards
If you live with your partner, make sure that nothing suspicious is on your credit card statements by simply opting to use for cash that can't be accounted for nor traced.
3. Don't get mad if you get accused
The biggest sign of someone who is guilty, is to get mad or defense about being accused. Instead just calmly deny and laugh the idea off.
Most Helpful Opinions
Here's a foolproof way:
Don't do it. If you find yourself bored in a relationship, attracted to someone else, or any other stupid reason people cheat, don't be a selfish coward and break up instead. Literally all you have to say is, "I don't want to be with you."