Large, freely available, well-maintained data sets have made astronomy a popular playground for machine learning (ML) projects. Nevertheless, robust insights gained to both ML and physics could be improved by clarity in problem definition and establishing workflows that critically verify, characterize and calibrate ML models. We provide a collection of guidelines to setting up ML projects that are less time-consuming and resource-intensive and more likely to lead to robust and useful scientific insights. We draw examples and experience from astronomy, but the advice is potentially applicable to other areas of science. This Expert Recommendation provides a guide to setting up machine learning projects that are less time-consuming and more likely to lead to robust and useful scientific insights.