A software consultant brings intellectual tools with them as well as applications. This capital comes in the form of experience and also the more concrete source code. That includes anything you take advantage of in your personal code repository. Although we typically are not fans of legal issues, we do need to spend the time reviewing contracts and ownership rights before we jump into that project or use our library.
There are two issues to understand when using your code. One is whether using that will contractually cause you to give up ownership. The other is whether a client allows you to use outside code in their project. You may think that the code you use that was previously written does not count as an external source. However, some situations will cause it to be viewed that way. In a similar vein, make sure you are legally allowed to re-use code written for a client. Your personal code repository should not contain any code that you do not have complete rights to use. The last thing you need is a legal battle among your customers.
The consulting contract should be clear on who owns the code you write for that customer. This agreement may also include license rights and related usage. The legal implications of this contract are such that you should have an attorney do a review before you sign. It is even better to have a boilerplate contract put together. Then get it reviewed by an attorney so you can be comfortable with the legalities of your employment. Failure to take these steps can bring you a pile of headaches. As always, better safe than sorry.
Learn more in the book written for Develpreneurs at any stage in their progress: https://www.amazon.com/Source-Code-Happiness-Finding-Success-ebook/dp/B07MKZBF6R