Hello,
In the Contribute section on the Processing website there is a link to creating libraries and tools:
https://processing.org/
Additional resources:
Related topics:
I have not yet created libraries and this has sparked my interest.
Consider the above as initial research on the subject.
:)