Custom Function into Workflow

Custom Function into Workflow

Hello community!
I am the CRM administrator of our small company. I customized the various modules and created workflows to automate some actions in the customer acquisition processes.
I also use tags. When I convert a lead into a contact, it receives the 'prospect' tag.
The opportunity is also created during the lead conversion.
I would like to set up a workflow that, when the opportunity phase becomes 'closed win', the associated contact tag changes from 'prospect' to 'customer'.
The workflow allows me to operate on the fields of the opportunity form and not on those of the contact so I need a custom function but I'm not where to start. Can someone help me?