You can find a detailed description of writing UMAT in Abaqus manual. UMAT for single crystal plasticity is documented in detail by Huang, Y. from Stanford University, which you can find on the following link:
User Material Subroutine for Single Crystal Plasticity (columbia.edu)
In case you require much simple UMAT for an introduction, the manual documents contain some easy examples for better understanding.
In Ansys, you have a UPF user-programmable feature, equivalent to the UMAT in Abaqus. These both mainly differ in the initialization protocols. Therefore a UMAT can easily be translated to UPF with some modifications. For starters, you can see the following document:
(PDF) Ad training Course User Subroutines | Gustavo Oliveira - Academia.edu
I will add more documents once I get to them to convert UMAT to UPF.