Background and Objective: Many diseases of the spine require surgical treatments that are currently performed based on the experience of the surgeon. The basis of this study is to deliver an automatic and patient-specific algorithm able to come to the aid of the surgeons in pedicle arthrodesis operations, by finding the optimal direction of the screw insertion, the maximum screw diameter and the maximum screw length., Results: The paper introduce an algorithm based on the reconstructed geometry of a vertebra by 3D-scan that is able to identify the best introduction direction for screw and to select, from commercial and/or personalised databases, the best screws in order to maximize the occupation of the bone while not intersecting each other and not going through the walls of the pedicle and the bounds of the vertebral body. In fact, for pedicle arthrodesis surgery, the incorrect positioning of the screws may cause operating failures, an increase in the overall duration of surgery and, therefore, more harmful, real-time X-ray checks. In case of not availability on market, the algorithm also suggests parameters for designing and manufacturing an 'ad hoc' solution. The algorithm has been tested on 6 vertebras extracted by a medical database. Furthermore, the algorithm is based on a procedure through which the surgeon can freely choose the entering point of the screw (based on his/her own experience and will). A real patient vertebra has been processed with almost 400 different entering point, always giving a feedback on the possibility to use the entering point (in case of unavailability of a good trajectory) and on the individuation of the right trajectory and the choose of the better screws., Conclusions: In very recent bibliography, several papers deal with procedure to screw' trajectory planning in arthrodesis surgery by using Computer Aided surgery systems, and some of them used also modern methodologies (KBE, AI, Deep learning, etc.) methods for planning the surgery as better as possible. Nevertheless, no methodologies or algorithm have been still realized to plan the trajectory and choose the perfect fitting screws on the basis of the patient-specific vertebra. This paper represents a wind of novelty in this field and allow surgeons to use the proposed algorithm for planning their surgeries. Finally, it allows also the easy creation of a customized surgical template, characterized by two cylindrical guides that follow a correct trajectory previously calculated by means of that automatic algorithm generated on the basis of a vertebra CAD model for a specific patient. The surgeon will be able to set the template (drilling guides) on the patient's vertebra and safely apply the screws., Competing Interests: The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper., (© 2024 The Authors.)