Purpose: The task of software development has become an increasing part of the medical physicist's role. Many physicists who are untrained in the best practices of software development have begun creating scripts for clinical use. There is an increasing need for guidance for both developers and medical physicists to code wisely in the clinic. Materials and Methods: We created a novel model for assessing risk for custom clinical software analogous to failure modes and effects analysis and propose minimum best practices that should be followed to mitigate the risks. Using this risk model, we integrated a literature review and institutional experience to form a practical guide for risk mitigation. Results: Using this new risk assessment model, we outlined several risk mitigation techniques including unit testing, code review, source control, end-user testing, and commissioning from the literature while sharing our institutional guidelines for evaluating software for risk and implementing these strategies. Conclusion: We found very little literature for custom software development guidelines targeted at medical physicists. We have shared our institutional experience and guidelines to help facilitate safe software development for the evolving role of the medical physicist.