There are some great technical solutions offered, but the real one is to publish your data and your code, and be as transparent as you can about what you did.
Yes, that helps. But it’s not quite sufficient, because transparency does not actually adjust the p-value of a study correctly (or makes it easy to do so). For this approach to work, you would have to sort of preregister all the code, too.